SIM_Relationship Class Reference

#include <SIM_Relationship.h>

Inheritance diagram for SIM_Relationship:

SIM_RootData SIM_Data

List of all members.

Public Member Functions

SIM_DatagetRelationshipTypeData ()
 Returns the single subdata that defines the relationship type.
const SIM_DatagetConstRelationshipTypeData () const
 Returns the single const subdata that defines the relationship type.
void setGroup (const SIM_ObjectArray &objects)
 Sets the object group equal to the set of supplied objects.
void setGroup (SIM_Object *object)
 Sets the object group to contain only the single specified object.
void addGroup (const SIM_ObjectArray &objects)
 Adds a number of objects to the object group.
void addGroup (SIM_Object *object)
 Adds a single object to the object group.
void removeGroup (const SIM_ObjectArray &objects)
 Removes a number of objects from the object group.
void removeGroup (SIM_Object *object)
 Removes a single object from the object group.
void clearGroup ()
 Removes all objects from the object group.
int getGroupEntries () const
 Gets the number of objects in the object group.
const SIM_ObjectgetGroupObject (int index) const
 Gets the object at position index within the object group.
bool getGroupHasObject (const SIM_Object *object) const
 Tests whether the supplied object is in the object group.
void setAffGroup (const SIM_ObjectArray &objects)
 Sets the affector group equal to the set of supplied objects.
void setAffGroup (SIM_Object *object)
 Sets the affector group to contain only the single specified object.
void addAffGroup (const SIM_ObjectArray &objects)
 Adds a number of objects to the affector group.
void addAffGroup (SIM_Object *object)
 Adds a single object to the affector group.
void removeAffGroup (const SIM_ObjectArray &objects)
 Removes a number of objects from the affector group.
void removeAffGroup (SIM_Object *object)
 Removes a single object from the affector group.
void clearAffGroup ()
 Removes all objects from the affector group.
int getAffGroupEntries () const
 Gets the number of objects in the affector group.
const SIM_ObjectgetAffGroupObject (int index) const
 Gets the object at position index within the affector group.
bool getAffGroupHasObject (const SIM_Object *object) const
 Tests whether the supplied object is in the affector group.

Protected Member Functions

 SIM_Relationship (const SIM_SimulationState *factory)
virtual ~SIM_Relationship ()
virtual void initializeSubclass ()
 Clears all attached objects.
virtual void makeEqualSubclass (const SIM_Data *source)
virtual void saveSubclass (ostream &os) const
virtual bool loadSubclass (UT_IStream &is)
 Loads a relationship from a stream.
virtual SIM_QuerycreateQueryObjectSubclass () const
 Creates a query object specific to SIM_Relationship.
virtual int64 getMemorySizeSubclass () const
 Returns the memory usage of our group data.
virtual bool getMatchesStringSubclass (const char *pattern) const
 Override the SIM_RootData function for matching us to a string.
virtual void getRootDataIdSubclass (SIM_RootDataId &id) const
 Override the SIM_RootData function for getting our identifier.

Friends

class SIM_SimulationState
class SIM_Object


Detailed Description

This class defines a relationship between two groups of objects. The first group of objects, called simply the "group", is the set of objects that are modified or controlled by the relationship. The second group of objects, the "affector group", is the set of objects that control the "group" objects. Note that these sets of objects can overlap in any way. It is also possible to have a relationship without any affector group. A DOP Object Group is an example of this kind of affector-less relationship. Mutual affector relationships occur when one or more objects are in both the object group and the affector group. This also implies a self-affecting relationship.

This data type is not meant to be subclassed, and does not contain any information about the nature or meaning of the relationship. That semantic information is held in the subdata of the SIM_Relationship. Only one subdata can be attached to this data at a time, and it must be a subclass of SIM_RelationshipData. Any other kind or number of subdata are ignored and invalidate the relationship.

Any data that refers to other data should be implemented as a SIM_Relationship. Doing so avoids problems of having to lookup objects based on name, enforces proper solve order (so affector objects are always solved before the group objects), and allows reverse lookups (what objects are in a relationship, and what relationships refer to a particular object).

Like SIM_Objects, SIM_Relationships are created and controlled by a SIM_SimulationState. They cannot be created and attached as subdata on existing data. Unlike SIM_Objects, SIM_Relationships do not have a unique integer identifier. Relationships must be given unique names.

Examples:

DOP/DOP_GroupAndApply.C.

Definition at line 53 of file SIM_Relationship.h.


Constructor & Destructor Documentation

SIM_Relationship::SIM_Relationship ( const SIM_SimulationState *  factory  )  [protected]

virtual SIM_Relationship::~SIM_Relationship (  )  [protected, virtual]


Member Function Documentation

void SIM_Relationship::addAffGroup ( SIM_Object object  ) 

Adds a single object to the affector group.

void SIM_Relationship::addAffGroup ( const SIM_ObjectArray objects  ) 

Adds a number of objects to the affector group.

void SIM_Relationship::addGroup ( SIM_Object object  ) 

Adds a single object to the object group.

void SIM_Relationship::addGroup ( const SIM_ObjectArray objects  ) 

Adds a number of objects to the object group.

Examples:
DOP/DOP_GroupAndApply.C.

void SIM_Relationship::clearAffGroup (  ) 

Removes all objects from the affector group.

void SIM_Relationship::clearGroup (  ) 

Removes all objects from the object group.

virtual SIM_Query* SIM_Relationship::createQueryObjectSubclass (  )  const [protected, virtual]

Creates a query object specific to SIM_Relationship.

Reimplemented from SIM_Data.

int SIM_Relationship::getAffGroupEntries (  )  const

Gets the number of objects in the affector group.

bool SIM_Relationship::getAffGroupHasObject ( const SIM_Object object  )  const

Tests whether the supplied object is in the affector group.

const SIM_Object* SIM_Relationship::getAffGroupObject ( int  index  )  const

Gets the object at position index within the affector group.

const SIM_Data* SIM_Relationship::getConstRelationshipTypeData (  )  const

Returns the single const subdata that defines the relationship type.

int SIM_Relationship::getGroupEntries (  )  const

Gets the number of objects in the object group.

bool SIM_Relationship::getGroupHasObject ( const SIM_Object object  )  const

Tests whether the supplied object is in the object group.

const SIM_Object* SIM_Relationship::getGroupObject ( int  index  )  const

Gets the object at position index within the object group.

virtual bool SIM_Relationship::getMatchesStringSubclass ( const char *  pattern  )  const [protected, virtual]

Override the SIM_RootData function for matching us to a string.

Implements SIM_RootData.

virtual int64 SIM_Relationship::getMemorySizeSubclass (  )  const [protected, virtual]

Returns the memory usage of our group data.

Reimplemented from SIM_Data.

SIM_Data* SIM_Relationship::getRelationshipTypeData (  ) 

Returns the single subdata that defines the relationship type.

virtual void SIM_Relationship::getRootDataIdSubclass ( SIM_RootDataId id  )  const [protected, virtual]

Override the SIM_RootData function for getting our identifier.

Implements SIM_RootData.

virtual void SIM_Relationship::initializeSubclass (  )  [protected, virtual]

Clears all attached objects.

Reimplemented from SIM_Data.

virtual bool SIM_Relationship::loadSubclass ( UT_IStream is  )  [protected, virtual]

Loads a relationship from a stream.

Reimplemented from SIM_Data.

virtual void SIM_Relationship::makeEqualSubclass ( const SIM_Data source  )  [protected, virtual]

Makes the relationship groups equal, but doesn't set the relationship name, which must be kept unique.

Reimplemented from SIM_Data.

void SIM_Relationship::removeAffGroup ( SIM_Object object  ) 

Removes a single object from the affector group.

void SIM_Relationship::removeAffGroup ( const SIM_ObjectArray objects  ) 

Removes a number of objects from the affector group.

void SIM_Relationship::removeGroup ( SIM_Object object  ) 

Removes a single object from the object group.

void SIM_Relationship::removeGroup ( const SIM_ObjectArray objects  ) 

Removes a number of objects from the object group.

virtual void SIM_Relationship::saveSubclass ( ostream &  os  )  const [protected, virtual]

Saves a relationship to a stream. The object groups are saved to the stream as arrays of object id numbers.

Reimplemented from SIM_Data.

void SIM_Relationship::setAffGroup ( SIM_Object object  ) 

Sets the affector group to contain only the single specified object.

void SIM_Relationship::setAffGroup ( const SIM_ObjectArray objects  ) 

Sets the affector group equal to the set of supplied objects.

void SIM_Relationship::setGroup ( SIM_Object object  ) 

Sets the object group to contain only the single specified object.

void SIM_Relationship::setGroup ( const SIM_ObjectArray objects  ) 

Sets the object group equal to the set of supplied objects.


Friends And Related Function Documentation

friend class SIM_Object [friend]

Definition at line 144 of file SIM_Relationship.h.

friend class SIM_SimulationState [friend]

Reimplemented from SIM_Data.

Definition at line 143 of file SIM_Relationship.h.


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

Generated on Mon Jan 28 00:30:00 2013 for HDK by  doxygen 1.5.9