Group. More...

#include <rgroup.h>

Inheritance diagram for RGroup< cGroup, cObj, cGroups >:
[legend]

Public Member Functions

 RGroup (RGroup *grp)
 
 RGroup (cGroups *owner, const size_t id)
 
virtual void Verify (void)
 
virtual void Clear (void)
 
void Insert (cObj *obj)
 
void Delete (cObj *obj)
 
virtual void PostInsert (const cObj *obj)
 
virtual bool PreInsertAll (const cGroup *from)
 
virtual void PostDelete (const cObj *obj)
 
virtual bool PreDeleteAll (void)
 
virtual bool CanInsert (const cObj *obj)
 
virtual bool IsCompatible (const cObj *obj)
 
virtual bool CanDelete (const cObj *obj)
 
size_t GetId (void) const
 
size_t GetNbObjs (void) const
 
size_t GetObjsPos (void) const
 
RCursor< cObj > GetObjs (void) const
 
bool IsIn (const size_t id) const
 
bool CommonObjs (const cGroup *grp) const
 
virtual bool IsCompatible (const cGroup *grp) const
 
bool SameObjs (const cGroup *grp) const
 
size_t * GetObjectsId (void) const
 
int Compare (const cGroup &grp) const
 
cObj * GetObjPos (const size_t pos)
 
virtual ~RGroup (void)
 

Protected Attributes

size_t Id
 
cGroups * Owner
 
size_t SubObjects
 
size_t NbSubObjects
 
bool Reserved
 

Detailed Description

template<class cGroup, class cObj, class cGroups>
class R::RGroup< cGroup, cObj, cGroups >

Group.

The RGroup class provides a representation for a group that will contain objects.

Constructor & Destructor Documentation

RGroup ( RGroup< cGroup, cObj, cGroups > *  grp)

Construct the group.

Parameters
grpGroup used as source.
RGroup ( cGroups *  owner,
const size_t  id 
)

Construct the group.

Parameters
ownerOwner of the group.
idIdentifier of the group.
virtual ~RGroup ( void  )
virtual

Destruct the group.

Member Function Documentation

virtual void Verify ( void  )
virtual

Verify if the group is not violating the integrity of the system.

virtual void Clear ( void  )
virtual

Clear the information container in a group.

Reimplemented in RGroupSG< cGroup, cObj, cGroups >, and RGroupNN< cGroup, cObj, cGroups >.

void Insert ( cObj *  obj)

Put an object in the group.

Parameters
objPointer to the object to insert.
void Delete ( cObj *  obj)

Delete an object in the group.

Parameters
objPointer to the object to delete.
virtual void PostInsert ( const cObj *  obj)
virtual

Method call after an object was inserted in the group.

Parameters
objPointer to the object to insert.

Reimplemented in RGroupSG< cGroup, cObj, cGroups >, and RGroupNN< cGroup, cObj, cGroups >.

virtual bool PreInsertAll ( const cGroup *  from)
virtual

Method call before all the objects of a given group are inserted into the current one. This method can be used to copy internal information from one group to the other.

Parameters
fromThe group used as source.
Returns
true if the PostInsert method should be called after each object is inserted from the group (true is the default value).

Reimplemented in RGroupNN< cGroup, cObj, cGroups >.

virtual void PostDelete ( const cObj *  obj)
virtual

Method call after one object was deleted from the group.

Parameters
objPointer to the object to delete.

Reimplemented in RGroupSG< cGroup, cObj, cGroups >, and RGroupNN< cGroup, cObj, cGroups >.

virtual bool PreDeleteAll ( void  )
virtual

Method call each time all the objects are deleted from the group.

Returns
true if the PostDelete method should be called after each object was deleted from the group (true if the default value).

Reimplemented in RGroupNN< cGroup, cObj, cGroups >.

virtual bool CanInsert ( const cObj *  obj)
virtual

Look if an object can be insert in the group. By default, the method returns always true.

Parameters
objPointer to the object to insert.

Reimplemented in RGroupSG< cGroup, cObj, cGroups >, and RGroupNN< cGroup, cObj, cGroups >.

virtual bool IsCompatible ( const cObj *  obj)
virtual

Look if an object is "compatible" with a specific group. By default, the method returns always true.

Parameters
objPointer to the object to verify.
virtual bool CanDelete ( const cObj *  obj)
virtual

Look if an object can be delete from the group. By default, the method returns always true.

Parameters
objPointer to the object to delete.
size_t GetId ( void  ) const

Return the identifier of the group.

size_t GetNbObjs ( void  ) const

Get the number of objects in the group.

Returns
size_t.
size_t GetObjsPos ( void  ) const

Get the position of the first object in the group.

Returns
size_t.
RCursor<cObj> GetObjs ( void  ) const

Return a cursor over the objects of a group.

bool IsIn ( const size_t  id) const

Return true if an object is in the group.

Parameters
idIdentifier of the object to test.
bool CommonObjs ( const cGroup *  grp) const

Look if the two groups have common objects.

Parameters
grpPointer to the group.
Returns
boolean.
virtual bool IsCompatible ( const cGroup *  grp) const
virtual

Look if two groups are "compatible".

Parameters
grpPointer to the group.
Returns
boolean.
bool SameObjs ( const cGroup *  grp) const

Return true if the two groups have the same objects.

Parameters
grpPointer to the group.
size_t* GetObjectsId ( void  ) const

Return the list of the objects. The list is created by RGroup, but must be deleted by the caller. The list is ended by a cNoRef value.

int Compare ( const cGroup &  grp) const

Compare two groups. Used for RContainer.

cObj* GetObjPos ( const size_t  pos)

Get a pointer to an object at a given position in the group.

Parameters
posPosition.
Returns
cObj*

Member Data Documentation

size_t Id
protected

Identifier of the Group.

cGroups* Owner
protected

Owner of the group.

size_t SubObjects
protected

Index of the first object attached to the group.

size_t NbSubObjects
protected

Number of objects attached to the group.

bool Reserved
protected

Is the group reserved?