VR-Link API Documentation for DIS
articulatedPartCollection.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *********************************************************************/
00005 
00010 
00011 #ifndef articulatedPartCollection_H_
00012 #define articulatedPartCollection_H_
00013 
00014 #include <vlutil/vlMachineTypes.h>
00015 
00016 #include <map>
00017 #include <set>
00018 #include <vector>
00019 #include <ostream>
00020 
00021 class DtArticulatedPart;
00022 class DtClock;
00023 
00029 class DT_DLL_VLPROTIND DtArticulatedPartCollection
00030 {
00031 public:
00032 
00033    typedef std::map<unsigned int,DtArticulatedPart*> PartMap;
00034    typedef PartMap::const_iterator const_iterator;
00035    typedef std::set<unsigned int> PartTypeSet;
00036 
00041    DtArticulatedPartCollection(DtClock* clock = 0);
00042 
00048    DtArticulatedPartCollection(const DtArticulatedPartCollection&);
00049 
00051    DtArticulatedPartCollection& operator=(const DtArticulatedPartCollection&);   
00052 
00054    virtual ~DtArticulatedPartCollection();
00055 
00056    bool operator==(const DtArticulatedPartCollection& other) const;
00057    bool operator!=(const DtArticulatedPartCollection& other) const;
00058 
00062    virtual void getPartTypes(PartTypeSet& aSet); 
00063 
00065    virtual DtArticulatedPart& getPart(unsigned int partType);
00066 
00068 
00069 
00070 
00071 
00072 
00073    virtual DtArticulatedPart* findPart(unsigned int partType);
00074    virtual const DtArticulatedPart* findPart(unsigned int partType) const;
00076 
00079    virtual void removeAllParts();
00080 
00083    virtual void removePart(unsigned int partType);   
00084 
00087    virtual void attachPart(DtArticulatedPart* childPart, DtArticulatedPart* parentPart);
00088    
00090    inline void attachPart(unsigned int childPartType, unsigned int parentPartType);
00091 
00093    virtual unsigned int totalParameterCount() const;
00094 
00096    virtual unsigned int partCount() const;
00097 
00103    virtual DtArticulatedPart* createPart(DtArticulatedPart* copy = 0) const;
00104 
00106    const_iterator begin() const;
00107 
00109    const_iterator end() const;
00110 
00117    virtual void setClock(DtClock* clock, bool setForAllParts = true);
00118 
00120 
00121    DtClock* clock();
00122    const DtClock* clock() const;
00124 
00127    bool partsApproximateByDefault() const;
00128 
00130    void setPartsApproximateByDefault(bool deadReckonByDefault);
00131 
00133    void printDataToStream(std::ostream& stream) const;
00134 
00137    const std::vector<DtArticulatedPart*>& getSortedList() const;
00138 
00139 protected:
00140 
00143    virtual void sortArtParts() const;  
00144 
00147    int calculatePartDistance(DtArticulatedPart* part) const;
00148 
00149 protected:
00150 
00151    PartMap myPartMap;
00152    DtClock* myClock;
00153    bool myDefaultApproximatingFlag;
00154    mutable std::vector<DtArticulatedPart*> mySortedList;
00155    mutable bool myNeedsSortingFlag;
00156 };
00157 
00158 inline void DtArticulatedPartCollection::attachPart(
00159    unsigned int childPartType, unsigned int parentPartType)
00160 {
00161    attachPart(findPart(childPartType),findPart(parentPartType));
00162 }
00163 
00164 
00165 #endif

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)