#include <CigiCollDetSegRespV2.h>
Inheritance diagram for CigiCollDetSegRespV2:
Public Member Functions | |
CigiCollDetSegRespV2 () | |
virtual | ~CigiCollDetSegRespV2 () |
virtual int | Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const |
virtual int | Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec) |
int | SetSegID (const Cigi_uint8 SegIDIn, bool bndchk=true) |
Cigi_uint8 | GetSegID (void) const |
int | SetCollType (const CollTypeGrp CollTypeIn, bool bndchk=true) |
CollTypeGrp | GetCollType (void) const |
int | SetCollEntityID (const Cigi_uint16 CollEntityIDIn, bool bndchk=true) |
Cigi_uint16 | GetCollEntityID (void) const |
int | SetX (const float XIn, bool bndchk=true) |
float | GetX (void) const |
int | SetY (const float YIn, bool bndchk=true) |
float | GetY (void) const |
int | SetZ (const float ZIn, bool bndchk=true) |
float | GetZ (void) const |
Definition at line 61 of file CigiCollDetSegRespV2.h.
CigiCollDetSegRespV2::CigiCollDetSegRespV2 | ( | ) |
General Constructor
Definition at line 82 of file CigiCollDetSegRespV2.cpp.
References CIGI_COLL_DET_SEG_RESP_PACKET_ID_V2, CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V2, CigiBaseCollDetSegResp::CollEntityID, CigiBaseCollDetSegResp::CollType, CigiBaseCollDetSegResp::EntityID, CigiBaseCollDetSegResp::IntersectDist, CigiBaseCollDetSegResp::IsValidV1or2, CigiBaseCollDetSegResp::Material, CigiBasePacket::MinorVersion, CigiBaseCollDetSegResp::NonEntity, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseCollDetSegResp::SegID, CigiBasePacket::Version, CigiBaseCollDetSegResp::X, CigiBaseCollDetSegResp::Y, and CigiBaseCollDetSegResp::Z.
00083 { 00084 00085 PacketID = CIGI_COLL_DET_SEG_RESP_PACKET_ID_V2; 00086 PacketSize = CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V2; 00087 Version = 2; 00088 MinorVersion = 0; 00089 00090 EntityID = 0; 00091 SegID = 0; 00092 CollType = NonEntity; 00093 CollEntityID = 0; 00094 Material = 0; 00095 IntersectDist = 0.0; 00096 X = 0.0; 00097 Y = 0.0; 00098 Z = 0.0; 00099 IsValidV1or2 = true; 00100 00101 }
CigiCollDetSegRespV2::~CigiCollDetSegRespV2 | ( | ) | [virtual] |
Cigi_uint16 CigiCollDetSegRespV2::GetCollEntityID | ( | void | ) | const [inline] |
Gets the CollEntityID value.
Definition at line 164 of file CigiCollDetSegRespV2.h.
00164 { return(CollEntityID); }
CollTypeGrp CigiCollDetSegRespV2::GetCollType | ( | void | ) | const [inline] |
Gets the CollType value.
Definition at line 143 of file CigiCollDetSegRespV2.h.
00143 { return(CollType); }
Cigi_uint8 CigiCollDetSegRespV2::GetSegID | ( | void | ) | const [inline] |
Gets the SegID value.
Definition at line 124 of file CigiCollDetSegRespV2.h.
00124 { return(SegID); }
float CigiCollDetSegRespV2::GetX | ( | void | ) | const [inline] |
Gets the X value.
Definition at line 186 of file CigiCollDetSegRespV2.h.
00186 { return(X); }
float CigiCollDetSegRespV2::GetY | ( | void | ) | const [inline] |
Gets the Y value.
Definition at line 208 of file CigiCollDetSegRespV2.h.
00208 { return(Y); }
float CigiCollDetSegRespV2::GetZ | ( | void | ) | const [inline] |
Gets the Z value.
Definition at line 230 of file CigiCollDetSegRespV2.h.
00230 { return(Z); }
int CigiCollDetSegRespV2::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 CigiBaseCollDetSegResp.
Definition at line 118 of file CigiCollDetSegRespV2.cpp.
References PackPointerUnion::c, CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V2, CIGI_SCOPY2, CIGI_SCOPY4, CigiBaseCollDetSegResp::CollEntityID, CigiBaseCollDetSegResp::CollType, PackPointerUnion::d, CigiBaseCollDetSegResp::EntityID, PackPointerUnion::f, CigiBaseCollDetSegResp::IsValidV1or2, PackPointerUnion::l, CigiBaseCollDetSegResp::Material, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, PackPointerUnion::s, CigiBaseCollDetSegResp::SegID, CigiBaseCollDetSegResp::X, CigiBaseCollDetSegResp::Y, and CigiBaseCollDetSegResp::Z.
00119 { 00120 double DBuf[6]; 00121 00122 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00123 00124 PackPointer CDta; 00125 00126 CigiBaseCollDetSegResp * Data = ( CigiBaseCollDetSegResp *)Base; 00127 00128 CDta.d = DBuf; 00129 00130 *CDta.c++ = PacketID; 00131 *CDta.c++ = PacketSize; 00132 00133 CIGI_SCOPY2(CDta.s++, &Data->EntityID); 00134 00135 Cigi_uint8 HDta = (Data->SegID << 1) & 0xfe; 00136 HDta |= ((Cigi_uint8)Data->CollType) & 0x01; 00137 *CDta.c++ = HDta; 00138 00139 *CDta.c++ = 0; 00140 00141 CIGI_SCOPY2(CDta.s++, &Data->CollEntityID); 00142 CIGI_SCOPY4(CDta.l++, &Data->Material); 00143 00144 if(Data->IsValidV1or2) 00145 { 00146 CIGI_SCOPY4(CDta.f++, &Data->X); 00147 CIGI_SCOPY4(CDta.f++, &Data->Y); 00148 CIGI_SCOPY4(CDta.f++, &Data->Z); 00149 } 00150 else 00151 { 00152 float tzero = 0.0f; 00153 CIGI_SCOPY4(CDta.f++, &tzero); 00154 CIGI_SCOPY4(CDta.f++, &tzero); 00155 CIGI_SCOPY4(CDta.f++, &tzero); 00156 } 00157 00158 memcpy(Buff,tBuf,CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V2); 00159 00160 return(PacketSize); 00161 00162 }
int CigiCollDetSegRespV2::SetCollEntityID | ( | const Cigi_uint16 | CollEntityIDIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the CollEntityID with bound checking control
CollEntityIDIn | - Entity ID of the entity collided with. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 155 of file CigiCollDetSegRespV2.h.
References CIGI_SUCCESS.
00156 { 00157 CollEntityID = CollEntityIDIn; 00158 return(CIGI_SUCCESS); 00159 }
int CigiCollDetSegRespV2::SetCollType | ( | const CollTypeGrp | CollTypeIn, | |
bool | bndchk = true | |||
) |
Sets the CollType with bound checking control
CollTypeIn | - Collision type NonEntity=0 Entity=1 | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 234 of file CigiCollDetSegRespV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCollDetSegResp::CollType.
00235 { 00236 00237 #ifndef CIGI_NO_BND_CHK 00238 if(bndchk && ((CollTypeIn < 0)||(CollTypeIn > 1))) 00239 { 00240 #ifndef CIGI_NO_EXCEPT 00241 throw CigiValueOutOfRangeException("CollType",(CollTypeGrp)CollTypeIn,0,1); 00242 #endif 00243 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00244 } 00245 #endif 00246 00247 CollType = CollTypeIn; 00248 return(CIGI_SUCCESS); 00249 00250 }
int CigiCollDetSegRespV2::SetSegID | ( | const Cigi_uint8 | SegIDIn, | |
bool | bndchk = true | |||
) |
Sets the SegID with bound checking control
SegIDIn | - Segment ID | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 212 of file CigiCollDetSegRespV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCollDetSegResp::SegID.
00213 { 00214 00215 #ifndef CIGI_NO_BND_CHK 00216 if(bndchk && ((SegIDIn < 0)||(SegIDIn > 127))) 00217 { 00218 #ifndef CIGI_NO_EXCEPT 00219 throw CigiValueOutOfRangeException("SegID",(Cigi_uint8)SegIDIn,0,127); 00220 #endif 00221 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00222 } 00223 #endif 00224 00225 SegID = SegIDIn; 00226 return(CIGI_SUCCESS); 00227 00228 }
int CigiCollDetSegRespV2::SetX | ( | const float | XIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the X with bound checking control
XIn | - The collision point along the X axis of the originating entity. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 177 of file CigiCollDetSegRespV2.h.
References CIGI_SUCCESS.
00178 { 00179 X = XIn; 00180 return(CIGI_SUCCESS); 00181 }
int CigiCollDetSegRespV2::SetY | ( | const float | YIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the Y with bound checking control
YIn | - The collision point along the Y axis of the originating entity. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 199 of file CigiCollDetSegRespV2.h.
References CIGI_SUCCESS.
00200 { 00201 Y = YIn; 00202 return(CIGI_SUCCESS); 00203 }
int CigiCollDetSegRespV2::SetZ | ( | const float | ZIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the Z with bound checking control
ZIn | - The collision point along the Z axis of the originating entity. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 221 of file CigiCollDetSegRespV2.h.
References CIGI_SUCCESS.
00222 { 00223 Z = ZIn; 00224 return(CIGI_SUCCESS); 00225 }
int CigiCollDetSegRespV2::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 CigiBaseCollDetSegResp.
Definition at line 167 of file CigiCollDetSegRespV2.cpp.
References PackPointerUnion::c, CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V2, CIGI_SCOPY2, CIGI_SCOPY4, CigiBaseCollDetSegResp::CollEntityID, CigiBaseCollDetSegResp::CollType, PackPointerUnion::d, CigiBaseCollDetSegResp::EntityID, PackPointerUnion::f, CigiBaseCollDetSegResp::IsValidV1or2, PackPointerUnion::l, CigiBaseCollDetSegResp::Material, CigiBasePacket::PacketSize, PackPointerUnion::s, CigiBaseCollDetSegResp::SegID, CigiBaseCollDetSegResp::X, CigiBaseCollDetSegResp::Y, and CigiBaseCollDetSegResp::Z.
00168 { 00169 double DBuf[6]; 00170 00171 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00172 00173 PackPointer CDta; 00174 00175 memcpy(tBuf,Buff,CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V2); 00176 00177 CDta.d = DBuf; 00178 00179 CDta.c += 2; // Step over packet id and size 00180 00181 CIGI_SCOPY2(&EntityID, CDta.s++); 00182 00183 Cigi_uint8 HDta = *CDta.c++; 00184 SegID = (HDta >> 1) & 0x7f; 00185 CollType = (CollTypeGrp)(HDta & 0x01); 00186 00187 CDta.c++; 00188 00189 CIGI_SCOPY2(&CollEntityID, CDta.s++); 00190 CIGI_SCOPY4(&Material, CDta.l++); 00191 00192 CIGI_SCOPY4(&X, CDta.f++); 00193 CIGI_SCOPY4(&Y, CDta.f++); 00194 CIGI_SCOPY4(&Z, CDta.f++); 00195 00196 IsValidV1or2 = true; 00197 00198 return(PacketSize); 00199 00200 }