The base for all class that can have (and can be) an owner. More...

Inheritance diagram for Ownable:

Classes

struct  Owned
 The structure with information about the owned object. More...
 

Public Types

typedef QList< OwnedOwnedList
 The type for the list of owned objects.
 

Public Member Functions

 Ownable ()
 Constructor.
 
virtual ~Ownable ()
 Destructor.
 
const QList< Owned > & owned () const
 Returns the list of objects owned by this one.
 
Ownableowner () const
 Returns the owner of this object.
 
void setOwner (Ownable *owner, bool destroy=true)
 Sets the owner of this object.
 

Detailed Description

The base for all class that can have (and can be) an owner.

When an object has an owner, the owner is responsible of freeing the owned classes when it is deleted. This can be done automatically by this class destructor or can be left to the owner implementation (for example when there must be a precise order in destroying owned objects). This class models both owner and ownable classes

Definition at line 37 of file ownable.h.

Member Typedef Documentation

typedef QList<Owned> OwnedList

The type for the list of owned objects.

Definition at line 86 of file ownable.h.

Constructor & Destructor Documentation

Ownable ( )

Constructor.

Definition at line 24 of file ownable.cpp.

~Ownable ( )
virtual

Destructor.

This deletes all owned object marked to be automatically destroyed

Definition at line 30 of file ownable.cpp.

References Ownable::Owned::destroy, and Ownable::Owned::object.

Member Function Documentation

const QList<Owned>& owned ( ) const
inline

Returns the list of objects owned by this one.

Returns
the list of objects owned by this one

Definition at line 125 of file ownable.h.

Ownable* owner ( ) const
inline

Returns the owner of this object.

Returns
the owner of this object

Definition at line 115 of file ownable.h.

Referenced by RenderCamera::paintGL(), Ownable::setOwner(), RenderWObjectContainer::setupColorTexture(), and World::~World().

void setOwner ( Ownable owner,
bool  destroy = true 
)

Sets the owner of this object.

Parameters
ownerthe owner of this object
destroyif true this object is automatically destroyed by the owner destructor

Definition at line 47 of file ownable.cpp.

References Ownable::owner().

Referenced by GraphicalWObject::attachToObject(), PhyMarXbot::enableAttachmentDevice(), PhyEpuck::PhyEpuck(), PhyiCub::PhyiCub(), PhyKhepera::PhyKhepera(), and PhyMarXbot::PhyMarXbot().


The documentation for this class was generated from the following files: