#include <CigiCollDetSegRespV1.h>
Inheritance diagram for CigiCollDetSegRespV1:
Public Member Functions | |
CigiCollDetSegRespV1 () | |
virtual | ~CigiCollDetSegRespV1 () |
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 | 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 57 of file CigiCollDetSegRespV1.h.
CigiCollDetSegRespV1::CigiCollDetSegRespV1 | ( | ) |
General Constructor
Definition at line 82 of file CigiCollDetSegRespV1.cpp.
References CIGI_COLL_DET_SEG_RESP_PACKET_ID_V1, CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V1, 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_V1; 00086 PacketSize = CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V1; 00087 Version = 1; 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 }
CigiCollDetSegRespV1::~CigiCollDetSegRespV1 | ( | ) | [virtual] |
Cigi_uint8 CigiCollDetSegRespV1::GetSegID | ( | void | ) | const [inline] |
Gets the SegID value.
Definition at line 120 of file CigiCollDetSegRespV1.h.
00120 { return(SegID); }
float CigiCollDetSegRespV1::GetX | ( | void | ) | const [inline] |
Gets the X value.
Definition at line 142 of file CigiCollDetSegRespV1.h.
00142 { return(X); }
float CigiCollDetSegRespV1::GetY | ( | void | ) | const [inline] |
Gets the Y value.
Definition at line 164 of file CigiCollDetSegRespV1.h.
00164 { return(Y); }
float CigiCollDetSegRespV1::GetZ | ( | void | ) | const [inline] |
Gets the Z value.
Definition at line 186 of file CigiCollDetSegRespV1.h.
00186 { return(Z); }
int CigiCollDetSegRespV1::Pack | ( | CigiBasePacket * | Base, | |
Cigi_uint8 * | Buff, | |||
void * | Spec | |||
) | const [virtual] |
The virtual Pack function for CIGI 1
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 CigiCollDetSegRespV1.cpp.
References PackPointerUnion::c, CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V1, CIGI_SCOPY2, CIGI_SCOPY4, 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 *CDta.c++ = HDta; 00137 00138 *CDta.c++ = 0; 00139 *CDta.s++ = 0; 00140 00141 CIGI_SCOPY4(CDta.l++, &Data->Material); 00142 00143 if(Data->IsValidV1or2) 00144 { 00145 CIGI_SCOPY4(CDta.f++, &Data->X); 00146 CIGI_SCOPY4(CDta.f++, &Data->Y); 00147 CIGI_SCOPY4(CDta.f++, &Data->Z); 00148 } 00149 else 00150 { 00151 float tzero = 0.0f; 00152 CIGI_SCOPY4(CDta.f++, &tzero); 00153 CIGI_SCOPY4(CDta.f++, &tzero); 00154 CIGI_SCOPY4(CDta.f++, &tzero); 00155 } 00156 00157 00158 memcpy(Buff,tBuf,CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V1); 00159 00160 return(PacketSize); 00161 00162 }
int CigiCollDetSegRespV1::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 209 of file CigiCollDetSegRespV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCollDetSegResp::SegID.
00210 { 00211 00212 #ifndef CIGI_NO_BND_CHK 00213 if(bndchk && ((SegIDIn < 0)||(SegIDIn > 127))) 00214 { 00215 #ifndef CIGI_NO_EXCEPT 00216 throw CigiValueOutOfRangeException("SegID",(Cigi_uint8)SegIDIn,0,127); 00217 #endif 00218 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00219 } 00220 #endif 00221 00222 SegID = SegIDIn; 00223 return(CIGI_SUCCESS); 00224 00225 }
int CigiCollDetSegRespV1::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 133 of file CigiCollDetSegRespV1.h.
References CIGI_SUCCESS.
00134 { 00135 X = XIn; 00136 return(CIGI_SUCCESS); 00137 }
int CigiCollDetSegRespV1::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 155 of file CigiCollDetSegRespV1.h.
References CIGI_SUCCESS.
00156 { 00157 Y = YIn; 00158 return(CIGI_SUCCESS); 00159 }
int CigiCollDetSegRespV1::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 177 of file CigiCollDetSegRespV1.h.
References CIGI_SUCCESS.
00178 { 00179 Z = ZIn; 00180 return(CIGI_SUCCESS); 00181 }
int CigiCollDetSegRespV1::Unpack | ( | Cigi_uint8 * | Buff, | |
bool | Swap, | |||
void * | Spec | |||
) | [virtual] |
The virtual Unpack function for CIGI 1
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 CigiCollDetSegRespV1.cpp.
References PackPointerUnion::c, CIGI_COLL_DET_SEG_RESP_PACKET_SIZE_V1, CIGI_SCOPY2, CIGI_SCOPY4, 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_V1); 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 SegID = (*CDta.c++ >> 1) & 0x7f; 00184 00185 CDta.c += 3; 00186 00187 CIGI_SCOPY4(&Material, CDta.l++); 00188 00189 CIGI_SCOPY4(&X, CDta.f++); 00190 CIGI_SCOPY4(&Y, CDta.f++); 00191 CIGI_SCOPY4(&Z, CDta.f++); 00192 00193 IsValidV1or2 = true; 00194 00195 return(PacketSize); 00196 00197 }