VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
DtArticulatedPartCollection Class Reference

A DtArticulatedPartCollection is a collection of articulated parts typically of an entity. More...

+ Collaboration diagram for DtArticulatedPartCollection:

Public Types

enum  DtAttachResult { DtAttachSuccess, DtAttachFailNullChild, DtAttachFailNullParent, DtAttachFailCycle }
 
typedef std::map< unsigned int,
DtArticulatedPart * > 
PartMap
 
typedef PartMap::const_iterator const_iterator
 
typedef std::set< unsigned intPartTypeSet
 

Public Member Functions

 DtArticulatedPartCollection (DtClock *clock=0)
 CTOR. More...
 
 DtArticulatedPartCollection (const DtArticulatedPartCollection &)
 Copy CTOR. More...
 
DtArticulatedPartCollectionoperator= (const DtArticulatedPartCollection &)
 Assignment operator. More...
 
virtual ~DtArticulatedPartCollection ()
 DTOR. More...
 
bool operator== (const DtArticulatedPartCollection &other) const
 
bool operator!= (const DtArticulatedPartCollection &other) const
 
virtual void getPartTypes (PartTypeSet &aSet)
 Get all of the part types by adding each part type to a part type set. More...
 
virtual DtArticulatedPartgetPart (unsigned int partType)
 Get the art part of a part type. If the part type does not exist it will be created. More...
 
virtual void removeAllParts ()
 Removes all parts. More...
 
virtual void removePart (unsigned int partType)
 Remove a part. More...
 
virtual bool attachPart (DtArticulatedPart *childPart, DtArticulatedPart *parentPart, DtAttachResult *attachResult=0)
 Attach a child part to a parent part. More...
 
bool attachPart (unsigned int childPartType, unsigned int parentPartType, DtAttachResult *attachResult=0)
 Attach a child part to a parent part. More...
 
virtual bool attachCreatesCycle (DtArticulatedPart *childPart, DtArticulatedPart *parentPart)
 Determine if attachment would create circular dependency (e.g, child == parent). More...
 
virtual unsigned int totalParameterCount () const
 Get the sum of the number of parameters for all parts. More...
 
virtual unsigned int partCount () const
 Get the number of parts. More...
 
virtual DtArticulatedPartcreatePart (DtArticulatedPart *copy=0) const
 Function used to create a part instance. More...
 
const_iterator begin () const
 Get a constant iterator to the first part. More...
 
const_iterator end () const
 Get a constant iterator beyond the last part. More...
 
virtual void setClock (DtClock *clock, bool setForAllParts=true)
 Set the clock object. More...
 
bool partsApproximateByDefault () const
 Get if parts approximate by default. More...
 
void setPartsApproximateByDefault (bool deadReckonByDefault)
 Set whether parts approximate by default. More...
 
void printDataToStream (std::ostream &stream) const
 Print the collection to a stream. More...
 
const std::vector
< DtArticulatedPart * > & 
getSortedList () const
 Get the parts in a sorted list useful for encoding. More...
 
virtual DtArticulatedPartfindPart (unsigned int partType)
 Search for a particular part. More...
 
virtual const DtArticulatedPartfindPart (unsigned int partType) const
 Search for a particular part. More...
 
DtClockclock ()
 Get the clock pointer, it may be NULL. More...
 
const DtClockclock () const
 Get the clock pointer, it may be NULL. More...
 

Protected Member Functions

virtual void sortArtParts () const
 Sort the internal list. More...
 
virtual int calculatePartDistance (const DtArticulatedPart *part) const
 Calculate distance to base. More...
 
virtual int fixPartAttachment (DtArticulatedPart *part)
 Fix the part attachment (e.g., attached to missing part or cycle) Returns the part distance after being fixed. More...
 

Protected Attributes

PartMap myPartMap
 
DtClockmyClock
 
bool myDefaultApproximatingFlag
 
std::vector< DtArticulatedPart * > mySortedList
 
bool myNeedsSortingFlag
 

Detailed Description

A DtArticulatedPartCollection is a collection of articulated parts typically of an entity.

Examples

Member Typedef Documentation

typedef PartMap::const_iterator DtArticulatedPartCollection::const_iterator
typedef std::set<unsigned int> DtArticulatedPartCollection::PartTypeSet

Member Enumeration Documentation

Enumerator
DtAttachSuccess 
DtAttachFailNullChild 
DtAttachFailNullParent 
DtAttachFailCycle 

Constructor & Destructor Documentation

DtArticulatedPartCollection::DtArticulatedPartCollection ( DtClock clock = 0)

CTOR.

Parameters
Input
clockis an optional parameter for setting the clock. The clock is passed to each newly create part.
DtArticulatedPartCollection::DtArticulatedPartCollection ( const DtArticulatedPartCollection )

Copy CTOR.

Warning
If sub classing do not change the subclass copy constructor with this Copy CTOR as copying will not be done correctly. Chain the subclass with the default constructor and explicitly copy the internal parts using the desired class.
virtual DtArticulatedPartCollection::~DtArticulatedPartCollection ( )
virtual

DTOR.

Member Function Documentation

virtual bool DtArticulatedPartCollection::attachCreatesCycle ( DtArticulatedPart childPart,
DtArticulatedPart parentPart 
)
virtual

Determine if attachment would create circular dependency (e.g, child == parent).

If either parent or child is null, then no cycle is returned. Return bool: cycle would be created if parts were attached?

virtual bool DtArticulatedPartCollection::attachPart ( DtArticulatedPart childPart,
DtArticulatedPart parentPart,
DtAttachResult attachResult = 0 
)
virtual

Attach a child part to a parent part.

Attach fails if child or parent is null or attach will create a cycle (e.g. childPart == parentPart) If supplied, the attach result returns the result of the attach operation If an attach result parameter is not supplied, failure results print warnings Returns bool: attach succeeded?

Referenced by attachPart().

bool DtArticulatedPartCollection::attachPart ( unsigned int  childPartType,
unsigned int  parentPartType,
DtArticulatedPartCollection::DtAttachResult attachResult = 0 
)
inline

Attach a child part to a parent part.

Helper function which looks up via type. Attach fails if child or parent cannot be found or attach will create a cycle (e.g. childPart == parentPart) If supplied, the attach result returns the result of the attach operation If an attach result parameter is not supplied, failure results print warnings Returns bool: attach succeeded?

References attachPart(), and findPart().

const_iterator DtArticulatedPartCollection::begin ( ) const

Get a constant iterator to the first part.

virtual int DtArticulatedPartCollection::calculatePartDistance ( const DtArticulatedPart part) const
protectedvirtual

Calculate distance to base.

Returns the number of parts between given part and base.

DtClock* DtArticulatedPartCollection::clock ( )

Get the clock pointer, it may be NULL.

const DtClock* DtArticulatedPartCollection::clock ( ) const

Get the clock pointer, it may be NULL.

virtual DtArticulatedPart* DtArticulatedPartCollection::createPart ( DtArticulatedPart copy = 0) const
virtual

Function used to create a part instance.

This is a separate function to allow subclasses to create the part instances.

Parameters
Input
copyis an optional parameter which should be used with a copy constructor when copy is valid.
const_iterator DtArticulatedPartCollection::end ( ) const

Get a constant iterator beyond the last part.

virtual DtArticulatedPart* DtArticulatedPartCollection::findPart ( unsigned int  partType)
virtual

Search for a particular part.

If the part does not exist the function will return null.

Return values
0If the part is not found.
Warning
Do not delete the returned pointer it is owned and managed by the collection.
Do not hold on to the pointer it is owned and managed by the collection and may be deallocated anytime in the future.

Referenced by attachPart().

virtual const DtArticulatedPart* DtArticulatedPartCollection::findPart ( unsigned int  partType) const
virtual

Search for a particular part.

If the part does not exist the function will return null.

Return values
0If the part is not found.
Warning
Do not delete the returned pointer it is owned and managed by the collection.
Do not hold on to the pointer it is owned and managed by the collection and may be deallocated anytime in the future.
virtual int DtArticulatedPartCollection::fixPartAttachment ( DtArticulatedPart part)
protectedvirtual

Fix the part attachment (e.g., attached to missing part or cycle) Returns the part distance after being fixed.

virtual DtArticulatedPart& DtArticulatedPartCollection::getPart ( unsigned int  partType)
virtual

Get the art part of a part type. If the part type does not exist it will be created.

virtual void DtArticulatedPartCollection::getPartTypes ( PartTypeSet aSet)
virtual

Get all of the part types by adding each part type to a part type set.

This

Parameters
Output
aSetis used to store the part types. Note aSet is not cleared.
const std::vector<DtArticulatedPart*>& DtArticulatedPartCollection::getSortedList ( ) const

Get the parts in a sorted list useful for encoding.

bool DtArticulatedPartCollection::operator!= ( const DtArticulatedPartCollection other) const
DtArticulatedPartCollection& DtArticulatedPartCollection::operator= ( const DtArticulatedPartCollection )

Assignment operator.

bool DtArticulatedPartCollection::operator== ( const DtArticulatedPartCollection other) const
virtual unsigned int DtArticulatedPartCollection::partCount ( ) const
virtual

Get the number of parts.

bool DtArticulatedPartCollection::partsApproximateByDefault ( ) const

Get if parts approximate by default.

This is true by default for all articulated part collections.

void DtArticulatedPartCollection::printDataToStream ( std::ostream &  stream) const

Print the collection to a stream.

virtual void DtArticulatedPartCollection::removeAllParts ( )
virtual

Removes all parts.

Warning
This function invalidates all iterators.
virtual void DtArticulatedPartCollection::removePart ( unsigned int  partType)
virtual

Remove a part.

If the part is not found the function does nothing.

Warning
This function may invalidate an iterator if it points to the part that was just removed.
virtual void DtArticulatedPartCollection::setClock ( DtClock clock,
bool  setForAllParts = true 
)
virtual

Set the clock object.

Optionally this will set the clock object for all existing parts.

Parameters
Input
clockthe clock pointer, which may be NULL.
setForAllPartscontrols whether each existing part get the new clock pointer as well.
void DtArticulatedPartCollection::setPartsApproximateByDefault ( bool  deadReckonByDefault)

Set whether parts approximate by default.

virtual void DtArticulatedPartCollection::sortArtParts ( ) const
protectedvirtual

Sort the internal list.

virtual unsigned int DtArticulatedPartCollection::totalParameterCount ( ) const
virtual

Get the sum of the number of parameters for all parts.

Member Data Documentation

DtClock* DtArticulatedPartCollection::myClock
protected
bool DtArticulatedPartCollection::myDefaultApproximatingFlag
protected
bool DtArticulatedPartCollection::myNeedsSortingFlag
mutableprotected
PartMap DtArticulatedPartCollection::myPartMap
protected
std::vector<DtArticulatedPart*> DtArticulatedPartCollection::mySortedList
mutableprotected

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

Document ID: Generated on Thu Sep 19 02:12:35 EDT 2024 from SVN revision 269601
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)