#include <CigiCollDetVolDefV2.h>
Inheritance diagram for CigiCollDetVolDefV2:
Public Member Functions | |
CigiCollDetVolDefV2 () | |
virtual | ~CigiCollDetVolDefV2 () |
virtual int | Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const |
virtual int | Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec) |
Definition at line 57 of file CigiCollDetVolDefV2.h.
CigiCollDetVolDefV2::CigiCollDetVolDefV2 | ( | ) |
General Constructor
Definition at line 85 of file CigiCollDetVolDefV2.cpp.
References CIGI_COLL_DET_VOL_DEF_PACKET_ID_V2, CIGI_COLL_DET_VOL_DEF_PACKET_SIZE_V2, CigiBaseCollDetVolDef::Depth, CigiBaseCollDetVolDef::EntityID, CigiBaseCollDetVolDef::HeightOrRadius, CigiBasePacket::MinorVersion, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseCollDetVolDef::Pitch, CigiBaseCollDetVolDef::Roll, CigiBaseCollDetVolDef::Sphere, CigiBasePacket::Version, CigiBaseCollDetVolDef::VolEn, CigiBaseCollDetVolDef::VolID, CigiBaseCollDetVolDef::VolType, CigiBaseCollDetVolDef::Width, CigiBaseCollDetVolDef::Xoff, CigiBaseCollDetVolDef::Yaw, CigiBaseCollDetVolDef::Yoff, and CigiBaseCollDetVolDef::Zoff.
00086 { 00087 00088 PacketID = CIGI_COLL_DET_VOL_DEF_PACKET_ID_V2; 00089 PacketSize = CIGI_COLL_DET_VOL_DEF_PACKET_SIZE_V2; 00090 Version = 2; 00091 MinorVersion = 0; 00092 00093 EntityID = 0; 00094 VolID = 0; 00095 VolEn = false; 00096 VolType = Sphere; 00097 Xoff = 0.0; 00098 Yoff = 0.0; 00099 Zoff = 0.0; 00100 HeightOrRadius = 0.0; 00101 Width = 0.0; 00102 Depth = 0.0; 00103 Roll = 0.0; 00104 Pitch = 0.0; 00105 Yaw = 0.0; 00106 00107 }
CigiCollDetVolDefV2::~CigiCollDetVolDefV2 | ( | ) | [virtual] |
int CigiCollDetVolDefV2::Pack | ( | CigiBasePacket * | Base, | |
Cigi_uint8 * | Buff, | |||
void * | Spec | |||
) | const [virtual] |
The virtual Pack function for CIGI 2
Base | - A pointer to the instance of the packet to be packed. (Downcast to CigiBasePacket) | |
Buff | - A pointer to the current pack point. | |
Spec | - A pointer to special data - This is not used in this class. |
Implements CigiBaseCollDetVolDef.
Definition at line 124 of file CigiCollDetVolDefV2.cpp.
References PackPointerUnion::c, CIGI_COLL_DET_VOL_DEF_PACKET_SIZE_V2, CIGI_SCOPY2, PackPointerUnion::d, CigiBaseCollDetVolDef::Depth, CigiBaseCollDetVolDef::EntityID, CigiBaseCollDetVolDef::HeightOrRadius, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, PackPointerUnion::s, CigiBaseCollDetVolDef::VolEn, CigiBaseCollDetVolDef::VolID, CigiBaseCollDetVolDef::Width, CigiBaseCollDetVolDef::Xoff, CigiBaseCollDetVolDef::Yoff, and CigiBaseCollDetVolDef::Zoff.
00125 { 00126 double DBuf[6]; 00127 00128 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00129 00130 PackPointer CDta; 00131 00132 CigiBaseCollDetVolDef * Data = ( CigiBaseCollDetVolDef *)Base; 00133 00134 CDta.d = DBuf; 00135 00136 *CDta.c++ = PacketID; 00137 *CDta.c++ = PacketSize; 00138 00139 CIGI_SCOPY2(CDta.s++, &Data->EntityID); 00140 00141 Cigi_uint8 HDta = Data->VolID & 0x7f; 00142 HDta |= (Data->VolEn) ? 0x80 : 0; 00143 *CDta.c++ = HDta; 00144 00145 *CDta.c++ = 0; 00146 *CDta.s++ = 0; 00147 00148 float tfDim = Data->Xoff / 0.015625f; 00149 Cigi_int16 tsDim = (short)tfDim; 00150 CIGI_SCOPY2(CDta.s++, &tsDim); 00151 00152 tfDim = Data->Yoff / 0.015625f; 00153 tsDim = (Cigi_int16)tfDim; 00154 CIGI_SCOPY2(CDta.s++, &tsDim); 00155 00156 tfDim = Data->Zoff / 0.015625f; 00157 tsDim = (Cigi_int16)tfDim; 00158 CIGI_SCOPY2(CDta.s++, &tsDim); 00159 00160 tfDim = Data->HeightOrRadius / 0.015625f; 00161 tsDim = (Cigi_int16)tfDim; 00162 CIGI_SCOPY2(CDta.s++, &tsDim); 00163 00164 tfDim = Data->Width / 0.015625f; 00165 tsDim = (Cigi_int16)tfDim; 00166 CIGI_SCOPY2(CDta.s++, &tsDim); 00167 00168 tfDim = Data->Depth / 0.015625f; 00169 tsDim = (Cigi_int16)tfDim; 00170 CIGI_SCOPY2(CDta.s++, &tsDim); 00171 00172 00173 00174 memcpy(Buff,tBuf,CIGI_COLL_DET_VOL_DEF_PACKET_SIZE_V2); 00175 00176 return(PacketSize); 00177 00178 }
int CigiCollDetVolDefV2::Unpack | ( | Cigi_uint8 * | Buff, | |
bool | Swap, | |||
void * | Spec | |||
) | [virtual] |
The virtual Unpack function for CIGI 2
Buff | - A pointer to the current pack point. | |
Swap | - N/A for V1 & V2 | |
Spec | - A pointer to special data - This is not used in this class. |
Implements CigiBaseCollDetVolDef.
Definition at line 183 of file CigiCollDetVolDefV2.cpp.
References PackPointerUnion::c, CIGI_COLL_DET_VOL_DEF_PACKET_SIZE_V2, CIGI_SCOPY2, PackPointerUnion::d, CigiBaseCollDetVolDef::Depth, CigiBaseCollDetVolDef::EntityID, CigiBaseCollDetVolDef::HeightOrRadius, CigiBasePacket::PacketSize, PackPointerUnion::s, CigiBaseCollDetVolDef::VolEn, CigiBaseCollDetVolDef::VolID, CigiBaseCollDetVolDef::Width, CigiBaseCollDetVolDef::Xoff, CigiBaseCollDetVolDef::Yoff, and CigiBaseCollDetVolDef::Zoff.
00184 { 00185 double DBuf[6]; 00186 00187 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00188 00189 PackPointer CDta; 00190 00191 memcpy(tBuf,Buff,CIGI_COLL_DET_VOL_DEF_PACKET_SIZE_V2); 00192 00193 CDta.d = DBuf; 00194 00195 CDta.c += 2; // Step over packet id and size 00196 00197 CIGI_SCOPY2(&EntityID, CDta.s++); 00198 00199 Cigi_uint8 HDta = *CDta.c++; 00200 VolID = HDta & 0x7f; 00201 VolEn = ((HDta & 0x80) != 0); 00202 00203 CDta.c += 3; 00204 00205 00206 Cigi_int16 tsScl; 00207 00208 CIGI_SCOPY2(&tsScl, CDta.s++); 00209 float tfScl = (float)tsScl; 00210 Xoff = tfScl * 0.015625f; 00211 00212 CIGI_SCOPY2(&tsScl, CDta.s++); 00213 tfScl = (float)tsScl; 00214 Yoff = tfScl * 0.015625f; 00215 00216 00217 CIGI_SCOPY2(&tsScl, CDta.s++); 00218 tfScl = (float)tsScl; 00219 Zoff = tfScl * 0.015625f; 00220 00221 CIGI_SCOPY2(&tsScl, CDta.s++); 00222 tfScl = (float)tsScl; 00223 HeightOrRadius = tfScl * 0.015625f; 00224 00225 CIGI_SCOPY2(&tsScl, CDta.s++); 00226 tfScl = (float)tsScl; 00227 Width = tfScl * 0.015625f; 00228 00229 CIGI_SCOPY2(&tsScl, CDta.s++); 00230 tfScl = (float)tsScl; 00231 Depth = tfScl * 0.015625f; 00232 00233 return(PacketSize); 00234 00235 }