![]() |
VR-Link API Documentation for DIS
|
00001 /********************************************************************* 00002 ** Copyright (c) 1992-2010 VT MAK 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 00009 00010 #ifndef esPdu_h_ 00011 #define esPdu_h_ 00012 00013 #if DtDIS 00014 00015 00016 00017 #include "hostStructs.h" 00018 #include "pdu.h" 00019 #include "packets/entityStateP.h" 00020 #include "stateMsg.h" 00021 00022 #include <vlpi/articulatedPartCollection.h> 00023 #include <vlpi/attachedPartCollection.h> 00024 #include <vlpi/disEnums.h> 00025 00026 #include <matrix/vlMath.h> 00027 #include <matrix/vlDcm.h> 00028 #include <matrix/vlTaitBryan.h> 00029 00030 #define DtMaxNumArtParts 83 00031 #define DtMaxNumAttachedParts 83 00032 #define DtINCREMENT -1 00033 00034 #define DtNO_SUCH_ART_PART 0 00035 #define DtART_PART_SUCCESS 1 00036 00037 class DtExerciseConn; 00038 class DtEntityStatePdu; 00039 00040 typedef void (*DtEntityStatePduCb)(DtEntityStatePdu* pdu, void* usr); 00041 00045 class DT_DLL_VL DtEntityStatePdu : public DtStateMsg 00046 { 00047 public: 00048 00049 enum { PduStaticSize=144 }; 00050 00051 DtEntityStatePdu(DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); 00052 00054 DtEntityStatePdu(const DtNetEntityStatePdu* initial, 00055 DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); 00056 00058 DtEntityStatePdu(const DtEntityIdentifier& id, const DtEntityType& type, 00059 const DtEntityType& guise, DtDeadReckonTypes algorithm, 00060 DtForceType forceId, DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); 00061 00063 virtual ~DtEntityStatePdu() {}; 00064 00065 /****************** INSPECTOR FUNCTIONS *******************/ 00066 const DtEntityIdentifier& id() const; 00067 void setId(const DtEntityIdentifier& id); 00068 00069 DtForceType forceId() const; 00070 void setForceId(DtForceType force); 00071 00072 int numArtParams() const; 00073 int numAttachedParams() const; 00074 int numArtPlusAttachedParams() const; 00075 00076 const DtEntityType& entityType() const; 00077 void setEntityType(const DtEntityType& type); 00078 00079 const DtEntityType& guise() const; 00080 void setGuise(const DtEntityType& type); 00081 00082 const DtVector& velocity() const; 00083 void setVelocity(const DtVector& Velocity); 00084 00085 const DtVector& location() const; 00086 void setLocation(const DtVector& Location); 00087 00088 const DtTaitBryan& orientation() const; 00089 void setOrientation(const DtTaitBryan& Orient); 00090 00092 DtU32 appearance() const; 00093 00095 void setAppearance(DtU32 app); 00096 00098 DtAppearAttrVal appearanceAttribute(const DtAppearAttribute& attr) const; 00099 00101 void setAppearanceAttribute(const DtAppearAttribute attr, 00102 const DtAppearAttrVal val); 00103 00104 DtDeadReckonTypes algorithm() const; 00105 void setAlgorithm(DtDeadReckonTypes alg); 00106 00107 const DtVector& acceleration() const; 00108 void setAcceleration(const DtVector& Acceleration); 00109 00110 const DtVector& rotationalVelocity() const; 00111 void setRotationalVelocity(const DtVector& BodyRates); 00112 00113 int markingCharSet() const; 00114 void setMarkingText(const char* text); 00115 00116 const char* markingText() const; 00117 void setMarkingCharSet(int charSet); 00118 00119 DtU32 capabilities() const; 00120 void setCapabilities(DtU32 cap); 00121 00123 00124 00125 00126 const DtArticulatedPartCollection& artPartList() const; 00127 void setArtPartList(const DtArticulatedPartCollection& apList); 00129 00131 00132 00133 00134 const DtAttachedPartCollection& attPartList() const; 00135 void setAttPartList(const DtAttachedPartCollection& apList); 00137 00138 void setNumArtPlusAttachedParams(int num); 00139 00141 00142 00143 00144 00145 const DtNetArtPartRecord* artPartRecord(int index) const; 00146 DtNetArtPartRecord* artPartRecord(int index); 00148 00150 00151 00152 00153 00154 DtNetAttachedPart* attPartRecord(int index); 00155 const DtNetAttachedPart* attPartRecord(int index) const; 00157 00158 00159 void printData() const; 00160 void printDataToStream(std::ostream& stream) const; 00161 00163 static DtPdu* create(const DtNetPacket* initial, 00164 DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); 00165 00167 static void addCallback(DtExerciseConn* conn, DtEntityStatePduCb cb, 00168 void* usr); 00169 00171 static void removeCallback(DtExerciseConn* conn, DtEntityStatePduCb cb, 00172 void* usr); 00173 00174 protected: 00175 00176 DtPduKind internalGetPduKind() const 00177 { 00178 return DtEntityStatePduKind; 00179 } 00180 00181 DtNetArtPartRecord* artPartRecord(int partType, int param) const; 00182 DtNetArtPartRecord* attachedPartRecord(int station) const; 00183 00184 DtEntityIdentifier myId; 00185 DtEntityType type, theGuise; 00186 DtVector vel, loc, acc; 00187 DtTaitBryan ori; 00188 DtBodyRates rvel; 00189 char markingBuff[DtMaxEntityMarkingLength+1]; 00190 00192 mutable DtArticulatedPartCollection myArtPartList; 00193 mutable DtAttachedPartCollection myAttPartList; 00194 int myStationList[DtMaxNumAttachedParts]; 00195 00196 }; 00197 00198 DT_DLL_VL std::ostream& operator<<(std::ostream& str, 00199 const DtEntityStatePdu& pdu); 00200 00201 #endif 00202 #endif