#include <CigiCompCtrlV1.h>
Inheritance diagram for CigiCompCtrlV1:
Public Member Functions | |
CigiCompCtrlV1 () | |
virtual | ~CigiCompCtrlV1 () |
virtual int | Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const |
virtual int | Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec) |
virtual int | GetCnvt (CigiVersionID &CnvtVersion, CigiCnvtInfoType::Type &CnvtInfo) |
int | SetEntityID (const Cigi_uint16 EntityIDIn, bool bndchk=true) |
Cigi_uint16 | GetEntityID (void) const |
int | SetViewID (const Cigi_uint8 ViewIDIn, bool bndchk=true) |
Cigi_uint8 | GetViewID (void) const |
int | SetCompState (const Cigi_uint16 CompStateIn, bool bndchk=true) |
Cigi_uint16 | GetCompState (void) const |
int | SetCompAssoc (const CompAssocGrp CompAssocIn, bool bndchk=true) |
CompAssocGrp | GetCompAssoc (void) const |
int | SetCompData (const Cigi_uint8 CompDataIn, const unsigned int Word, const BytePos Pos, bool bndchk=true) |
int | SetCompData (const Cigi_int8 CompDataIn, const unsigned int Word, const BytePos Pos, bool bndchk=true) |
int | SetCompData (const Cigi_uint16 CompDataIn, const unsigned int Word, const HalfWordPos Pos, bool bndchk=true) |
int | SetCompData (const Cigi_int16 CompDataIn, const unsigned int Word, const HalfWordPos Pos, bool bndchk=true) |
int | SetCompData (const Cigi_uint32 CompDataIn, const unsigned int Word, bool bndchk=true) |
int | SetCompData (const Cigi_int32 CompDataIn, const unsigned int Word, bool bndchk=true) |
int | SetCompData (const float CompDataIn, const unsigned int Word, bool bndchk=true) |
int | SetCompData (const Cigi_uint64 CompDataIn, const unsigned int Pos, bool bndchk=true) |
int | SetCompData (const double CompDataIn, const unsigned int Pos, bool bndchk=true) |
Cigi_uint8 | GetUCharCompData (const unsigned int Word, const BytePos Pos) |
Cigi_int8 | GetCharCompData (const unsigned int Word, const BytePos Pos) |
Cigi_uint16 | GetUShortCompData (const unsigned int Word, const HalfWordPos Pos) |
Cigi_int16 | GetShortCompData (const unsigned int Word, const HalfWordPos Pos) |
Cigi_uint32 | GetULongCompData (const unsigned int Word) |
Cigi_int32 | GetLongCompData (const unsigned int Word) |
float | GetFloatCompData (const unsigned int Word) |
Cigi_uint64 | GetI64CompData (const unsigned int Pos) |
double | GetDoubleCompData (const unsigned int Pos) |
Static Protected Attributes | |
static const int | CompClassCnvtSz = 3 |
static const CompClassV3Grp | CompClassV1xV3 [CompClassCnvtSz] |
Definition at line 65 of file CigiCompCtrlV1.h.
CigiCompCtrlV1::CigiCompCtrlV1 | ( | ) |
General Constructor
Definition at line 103 of file CigiCompCtrlV1.cpp.
References CIGI_COMP_CTRL_PACKET_ID_V1, CIGI_COMP_CTRL_PACKET_SIZE_V1, CigiBaseCompCtrl::CompAssoc, CigiBaseCompCtrl::CompClassV2, CigiBaseCompCtrl::CompClassV3, CigiBaseCompCtrl::CompData, CigiBaseCompCtrl::CompID, CigiBaseCompCtrl::CompState, CigiBaseCompCtrl::Entity, CigiBaseCompCtrl::EntityID, CigiBaseCompCtrl::EntityV2, CigiBaseCompCtrl::EntityV3, CigiBaseCompCtrl::InstanceID, CigiBasePacket::MinorVersion, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBasePacket::Version, and CigiBaseCompCtrl::ViewID.
00104 { 00105 00106 PacketID = CIGI_COMP_CTRL_PACKET_ID_V1; 00107 PacketSize = CIGI_COMP_CTRL_PACKET_SIZE_V1; 00108 Version = 1; 00109 MinorVersion = 0; 00110 00111 CompID = 0; 00112 InstanceID = 0; 00113 EntityID = 0; 00114 ViewID = 0; 00115 CompState = 0; 00116 CompAssoc = Entity; 00117 CompClassV2 = EntityV2; 00118 CompClassV3 = EntityV3; 00119 CompData[0] = 0; 00120 CompData[1] = 0; 00121 CompData[2] = 0; 00122 CompData[3] = 0; 00123 CompData[4] = 0; 00124 CompData[5] = 0; 00125 00126 }
CigiCompCtrlV1::~CigiCompCtrlV1 | ( | ) | [virtual] |
Gets the specified CompData
Word | - The word position | |
Pos | - The byte position |
Definition at line 717 of file CigiCompCtrlV1.cpp.
References CigiBaseCompCtrl::CompData.
00719 { 00720 union { 00721 Cigi_int8 sc; 00722 Cigi_uint8 uc; 00723 } tDta; 00724 00725 int Err = 0; 00726 00727 if(Word > 1) 00728 Err = 1; 00729 else if((Pos < 0) || (Pos > 3)) 00730 Err = 2; 00731 00732 if(Err != 0) 00733 { 00734 #ifndef CIGI_NO_EXCEPT 00735 if(Err == 1) 00736 throw CigiValueOutOfRangeException("Word",Word,0,1); 00737 else 00738 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00739 #endif 00740 00741 tDta.uc = 0; 00742 } 00743 else 00744 tDta.uc = (Cigi_uint8)((CompData[Word] >> (Pos * 8)) & 0x000000ff); 00745 00746 return(tDta.sc); 00747 }
int CigiCompCtrlV1::GetCnvt | ( | CigiVersionID & | CnvtVersion, | |
CigiCnvtInfoType::Type & | CnvtInfo | |||
) | [virtual] |
A virtual Conversion Information function. This function provides conversion information for this packet.
CnvtVersion | - The CIGI version to which this packet is being converted. | |
CnvtInfo | - The information needed for conversion |
Implements CigiBaseCompCtrl.
Definition at line 233 of file CigiCompCtrlV1.cpp.
References CIGI_COMP_CTRL_PACKET_ID_V2, CIGI_SHORT_COMP_CTRL_PACKET_ID_V3, CIGI_SUCCESS, CigiVersionID::CigiMajorVersion, CigiCnvtInfoType::CigiCnvtInfoStruct::CnvtPacketID, CigiCnvtInfoType::CigiCnvtInfoStruct::ProcID, and CigiProcessType::ProcStd.
00235 { 00236 CnvtInfo.ProcID = CigiProcessType::ProcStd; 00237 00238 // Note: CIGI_ART_PART_CTRL_PACKET_ID_V1 & 00239 // CIGI_ART_PART_CTRL_PACKET_ID_V2 are the same 00240 if(CnvtVersion.CigiMajorVersion < 3) 00241 CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V2; 00242 else 00243 CnvtInfo.CnvtPacketID = CIGI_SHORT_COMP_CTRL_PACKET_ID_V3; 00244 00245 return(CIGI_SUCCESS); 00246 00247 }
CompAssocGrp CigiCompCtrlV1::GetCompAssoc | ( | void | ) | const [inline] |
Gets the CompAssoc value.
Definition at line 209 of file CigiCompCtrlV1.h.
00209 { return(CompAssoc); }
Cigi_uint16 CigiCompCtrlV1::GetCompState | ( | void | ) | const [inline] |
Gets the CompState value.
Definition at line 189 of file CigiCompCtrlV1.h.
00189 { return(CompState); }
double CigiCompCtrlV1::GetDoubleCompData | ( | const unsigned int | Pos | ) |
Gets the specified CompData
Pos | - The double word position |
Definition at line 936 of file CigiCompCtrlV1.cpp.
References _I64_CONST_, and CigiBaseCompCtrl::CompData.
00937 { 00938 00939 union DtaXfer { 00940 Cigi_uint64 i; 00941 double d; 00942 } XDta; 00943 00944 if(Pos > 1) 00945 { 00946 #ifndef CIGI_NO_EXCEPT 00947 throw CigiValueOutOfRangeException("Pos",Pos,0,0); 00948 #endif 00949 00950 XDta.d = 0.0; 00951 } 00952 else 00953 { 00954 00955 int Word = Pos * 2; 00956 Cigi_uint64 tDtah = (Cigi_uint64)(CompData[Word++]); 00957 tDtah = (tDtah << 32) & _I64_CONST_(0xffffffff00000000); 00958 00959 Cigi_uint64 tDtal = (Cigi_uint64)(CompData[Word]); 00960 tDtal &= _I64_CONST_(0x00000000ffffffff); 00961 00962 XDta.i = tDtah | tDtal; 00963 00964 } 00965 00966 return(XDta.d); 00967 }
Cigi_uint16 CigiCompCtrlV1::GetEntityID | ( | void | ) | const [inline] |
Gets the EntityID value.
Definition at line 151 of file CigiCompCtrlV1.h.
00151 { return(EntityID); }
float CigiCompCtrlV1::GetFloatCompData | ( | const unsigned int | Word | ) |
Gets the specified CompData
Word | - The word position |
Definition at line 875 of file CigiCompCtrlV1.cpp.
References CigiBaseCompCtrl::CompData.
00876 { 00877 00878 union { 00879 float f32; 00880 Cigi_uint32 u32; 00881 } tDta; 00882 00883 if(Word > 1) 00884 { 00885 #ifndef CIGI_NO_EXCEPT 00886 throw CigiValueOutOfRangeException("Word",Word,0,1); 00887 #endif 00888 00889 tDta.u32 = 0; 00890 } 00891 else 00892 tDta.u32 = (Cigi_uint32)(CompData[Word]); 00893 00894 return(tDta.f32); 00895 }
Cigi_uint64 CigiCompCtrlV1::GetI64CompData | ( | const unsigned int | Pos | ) |
Gets the specified CompData
Pos | - The double word position |
Definition at line 902 of file CigiCompCtrlV1.cpp.
References _I64_CONST_, and CigiBaseCompCtrl::CompData.
00903 { 00904 00905 Cigi_uint64 tDta; 00906 00907 if(Pos > 0) 00908 { 00909 #ifndef CIGI_NO_EXCEPT 00910 throw CigiValueOutOfRangeException("Pos",Pos,0,0); 00911 #endif 00912 00913 tDta = 0; 00914 } 00915 else 00916 { 00917 int Word = Pos * 2; 00918 Cigi_uint64 tDtah = (Cigi_uint64)(CompData[Word++]); 00919 tDtah = (tDtah << 32) & _I64_CONST_(0xffffffff00000000); 00920 00921 Cigi_uint64 tDtal = (Cigi_uint64)(CompData[Word]); 00922 tDtal &= _I64_CONST_(0x00000000ffffffff); 00923 00924 tDta = tDtah | tDtal; 00925 } 00926 00927 00928 return(tDta); 00929 }
Cigi_int32 CigiCompCtrlV1::GetLongCompData | ( | const unsigned int | Word | ) |
Gets the specified CompData
Word | - The word position |
Definition at line 848 of file CigiCompCtrlV1.cpp.
References CigiBaseCompCtrl::CompData.
00849 { 00850 00851 union { 00852 Cigi_int32 s32; 00853 Cigi_uint32 u32; 00854 } tDta; 00855 00856 if(Word > 1) 00857 { 00858 #ifndef CIGI_NO_EXCEPT 00859 throw CigiValueOutOfRangeException("Word",Word,0,1); 00860 #endif 00861 00862 tDta.u32 = 0; 00863 } 00864 else 00865 tDta.u32 = (Cigi_uint32)(CompData[Word]); 00866 00867 return(tDta.s32); 00868 }
Cigi_int16 CigiCompCtrlV1::GetShortCompData | ( | const unsigned int | Word, | |
const HalfWordPos | Pos | |||
) |
Gets the specified CompData
Word | - The word position | |
Pos | - The half word position |
Definition at line 786 of file CigiCompCtrlV1.cpp.
References CigiBaseCompCtrl::CompData.
00788 { 00789 00790 union { 00791 Cigi_int16 s16; 00792 Cigi_uint16 u16; 00793 } tDta; 00794 00795 int Err = 0; 00796 00797 if(Word > 1) 00798 Err = 1; 00799 else if((Pos < 0) || (Pos > 1)) 00800 Err = 2; 00801 00802 if(Err != 0) 00803 { 00804 #ifndef CIGI_NO_EXCEPT 00805 if(Err == 1) 00806 throw CigiValueOutOfRangeException("Word",Word,0,1); 00807 else 00808 throw CigiValueOutOfRangeException("Pos",Pos,0,1); 00809 #endif 00810 00811 tDta.u16 = 0; 00812 } 00813 else 00814 tDta.u16 = (Cigi_uint16)((CompData[Word] >> (Pos * 16)) & 0x0000ffff); 00815 00816 return(tDta.s16); 00817 }
Cigi_uint8 CigiCompCtrlV1::GetUCharCompData | ( | const unsigned int | Word, | |
const BytePos | Pos | |||
) |
Gets the specified CompData
Word | - The word position | |
Pos | - The byte position |
Definition at line 683 of file CigiCompCtrlV1.cpp.
References CigiBaseCompCtrl::CompData.
00685 { 00686 00687 Cigi_uint8 tDta; 00688 00689 int Err = 0; 00690 00691 if(Word > 1) 00692 Err = 1; 00693 else if((Pos < 0) || (Pos > 3)) 00694 Err = 2; 00695 00696 if(Err != 0) 00697 { 00698 #ifndef CIGI_NO_EXCEPT 00699 if(Err == 1) 00700 throw CigiValueOutOfRangeException("Word",Word,0,1); 00701 else 00702 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00703 #endif 00704 00705 tDta = 0; 00706 } 00707 else 00708 tDta = (Cigi_uint8)((CompData[Word] >> (Pos * 8)) & 0x000000ff); 00709 00710 return(tDta); 00711 }
Cigi_uint32 CigiCompCtrlV1::GetULongCompData | ( | const unsigned int | Word | ) |
Gets the specified CompData
Word | - The word position |
Definition at line 823 of file CigiCompCtrlV1.cpp.
References CigiBaseCompCtrl::CompData.
00824 { 00825 00826 Cigi_uint32 tDta; 00827 00828 00829 if(Word > 1) 00830 { 00831 #ifndef CIGI_NO_EXCEPT 00832 throw CigiValueOutOfRangeException("Word",Word,0,1); 00833 #endif 00834 00835 tDta = 0; 00836 } 00837 else 00838 tDta = CompData[Word]; 00839 00840 return(tDta); 00841 }
Cigi_uint16 CigiCompCtrlV1::GetUShortCompData | ( | const unsigned int | Word, | |
const HalfWordPos | Pos | |||
) |
Gets the specified CompData
Word | - The word position | |
Pos | - The half word position |
Definition at line 753 of file CigiCompCtrlV1.cpp.
References CigiBaseCompCtrl::CompData.
00755 { 00756 Cigi_uint16 tDta; 00757 00758 int Err = 0; 00759 00760 if(Word > 1) 00761 Err = 1; 00762 else if((Pos < 0) || (Pos > 1)) 00763 Err = 2; 00764 00765 if(Err != 0) 00766 { 00767 #ifndef CIGI_NO_EXCEPT 00768 if(Err == 1) 00769 throw CigiValueOutOfRangeException("Word",Word,0,1); 00770 else 00771 throw CigiValueOutOfRangeException("Pos",Pos,0,1); 00772 #endif 00773 00774 tDta = 0; 00775 } 00776 else 00777 tDta = (Cigi_uint16)((CompData[Word] >> (Pos * 16)) & 0x0000ffff); 00778 00779 return(tDta); 00780 }
Cigi_uint8 CigiCompCtrlV1::GetViewID | ( | void | ) | const [inline] |
Gets the ViewID value.
Definition at line 168 of file CigiCompCtrlV1.h.
00168 { return(ViewID); }
int CigiCompCtrlV1::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 CigiBaseCompCtrl.
Definition at line 143 of file CigiCompCtrlV1.cpp.
References PackPointerUnion::c, CIGI_COMP_CTRL_PACKET_SIZE_V1, CIGI_SCOPY2, CIGI_SCOPY4, CigiBaseCompCtrl::CompAssoc, CigiBaseCompCtrl::CompData, CigiBaseCompCtrl::CompID, CigiBaseCompCtrl::CompState, PackPointerUnion::d, CigiBaseCompCtrl::EntityID, PackPointerUnion::l, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, PackPointerUnion::s, and CigiBaseCompCtrl::ViewID.
00144 { 00145 double DBuf[6]; 00146 00147 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00148 00149 PackPointer CDta; 00150 00151 CigiBaseCompCtrl * Data = ( CigiBaseCompCtrl *)Base; 00152 00153 CDta.d = DBuf; 00154 00155 *CDta.c++ = PacketID; 00156 *CDta.c++ = PacketSize; 00157 00158 CIGI_SCOPY2(CDta.s++, &Data->EntityID); 00159 00160 Cigi_uint8 HDta = (Data->ViewID << 3) & 0xf8; 00161 HDta |= (Data->CompAssoc << 1) & 0x06; 00162 *CDta.c++ = HDta; 00163 00164 *CDta.c++ = 0; 00165 *CDta.s++ = 0; 00166 00167 CIGI_SCOPY2(CDta.s++, &Data->CompID); 00168 CIGI_SCOPY2(CDta.s++, &Data->CompState); 00169 CIGI_SCOPY4(CDta.l++, &Data->CompData[0]); 00170 CIGI_SCOPY4(CDta.l++, &Data->CompData[1]); 00171 00172 memcpy(Buff,tBuf,CIGI_COMP_CTRL_PACKET_SIZE_V1); 00173 00174 return(PacketSize); 00175 00176 }
int CigiCompCtrlV1::SetCompAssoc | ( | const CompAssocGrp | CompAssocIn, | |
bool | bndchk = true | |||
) |
Sets the CompAssoc with bound checking control
CompAssocIn | - Component association Entity=0 Environment=1 View=2 | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 284 of file CigiCompCtrlV1.cpp.
References CigiBaseCompCtrl::AtmosphereV3, CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, CigiBaseCompCtrl::CompAssoc, CompClassV1xV3, CigiBaseCompCtrl::CompClassV2, CigiBaseCompCtrl::CompClassV3, CigiBaseCompCtrl::Entity, CigiBaseCompCtrl::EntityID, CigiBaseCompCtrl::EntityV3, CigiBaseCompCtrl::InstanceID, CigiBaseCompCtrl::View, CigiBaseCompCtrl::ViewID, and CigiBaseCompCtrl::ViewV3.
00285 { 00286 // V1 to V3 Component Class conversion table 00287 const CompClassV3Grp Assoc2ClassV3[3] = 00288 { 00289 EntityV3, 00290 AtmosphereV3, 00291 ViewV3 00292 }; 00293 00294 00295 #ifndef CIGI_NO_BND_CHK 00296 if(bndchk && ((CompAssocIn < 0)||(CompAssocIn > 3))) 00297 { 00298 #ifndef CIGI_NO_EXCEPT 00299 throw CigiValueOutOfRangeException("CompAssoc",(CompAssocGrp)CompAssocIn,0,3); 00300 #endif 00301 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00302 } 00303 #endif 00304 00305 CompAssoc = CompAssocIn; 00306 00307 CompClassV2 = (CompClassV2Grp)CompAssoc; 00308 CompClassV3 = CompClassV1xV3[CompAssocIn]; 00309 00310 if(CompAssoc == CigiBaseCompCtrl::Entity) 00311 InstanceID = EntityID; 00312 else if(CompAssoc == CigiBaseCompCtrl::View) 00313 InstanceID = ViewID; 00314 else 00315 InstanceID = 0; 00316 00317 return(CIGI_SUCCESS); 00318 00319 }
int CigiCompCtrlV1::SetCompData | ( | const double | CompDataIn, | |
const unsigned int | Pos, | |||
bool | bndchk = true | |||
) |
Sets the specified CompData with bound checking control
CompDataIn | - The byte data | |
Pos | - The double word position | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 640 of file CigiCompCtrlV1.cpp.
References _I64_CONST_, CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00643 { 00644 00645 if(Pos > 0) 00646 { 00647 #ifndef CIGI_NO_BND_CHK 00648 if(bndchk) 00649 { 00650 #ifndef CIGI_NO_EXCEPT 00651 throw CigiValueOutOfRangeException("Pos",Pos,0,0); 00652 #endif 00653 } 00654 #endif 00655 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00656 } 00657 00658 union DtaXfer { 00659 Cigi_uint64 i; 00660 double d; 00661 } XDta; 00662 00663 XDta.d = CompDataIn; 00664 00665 int Word = Pos * 2; 00666 00667 CompData[Word++] = (Cigi_uint32)((XDta.i >> 32) & _I64_CONST_(0x00000000ffffffff)); 00668 CompData[Word] = (Cigi_uint32)(XDta.i & _I64_CONST_(0x00000000ffffffff)); 00669 00670 00671 return(CIGI_SUCCESS); 00672 }
int CigiCompCtrlV1::SetCompData | ( | const Cigi_uint64 | CompDataIn, | |
const unsigned int | Pos, | |||
bool | bndchk = true | |||
) |
Sets the specified CompData with bound checking control
CompDataIn | - The byte data | |
Pos | - The double word position | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 609 of file CigiCompCtrlV1.cpp.
References _I64_CONST_, CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00612 { 00613 00614 if(Pos > 0) 00615 { 00616 #ifndef CIGI_NO_BND_CHK 00617 if(bndchk) 00618 { 00619 #ifndef CIGI_NO_EXCEPT 00620 throw CigiValueOutOfRangeException("Pos",Pos,0,0); 00621 #endif 00622 } 00623 #endif 00624 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00625 } 00626 00627 00628 int Word = Pos * 2; 00629 00630 CompData[Word++] = (Cigi_uint32)((CompDataIn >> 32) & _I64_CONST_(0x00000000ffffffff)); 00631 CompData[Word] = (Cigi_uint32)(CompDataIn & _I64_CONST_(0x00000000ffffffff)); 00632 00633 return(CIGI_SUCCESS); 00634 }
int CigiCompCtrlV1::SetCompData | ( | const float | CompDataIn, | |
const unsigned int | Word, | |||
bool | bndchk = true | |||
) |
Sets the specified CompData with bound checking control
CompDataIn | - The byte data | |
Word | - The word position | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 575 of file CigiCompCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00578 { 00579 00580 if(Word > 1) 00581 { 00582 #ifndef CIGI_NO_BND_CHK 00583 if(bndchk) 00584 { 00585 #ifndef CIGI_NO_EXCEPT 00586 throw CigiValueOutOfRangeException("Word",Word,0,1); 00587 #endif 00588 } 00589 #endif 00590 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00591 } 00592 00593 00594 union DtaXfer { 00595 Cigi_uint32 lDta; 00596 float fDta; 00597 } XDta; 00598 00599 XDta.fDta = CompDataIn; 00600 CompData[Word] = XDta.lDta; 00601 00602 return(CIGI_SUCCESS); 00603 }
int CigiCompCtrlV1::SetCompData | ( | const Cigi_int32 | CompDataIn, | |
const unsigned int | Word, | |||
bool | bndchk = true | |||
) |
Sets the specified CompData with bound checking control
CompDataIn | - The byte data | |
Word | - The word position | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 541 of file CigiCompCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00544 { 00545 00546 union { 00547 Cigi_int32 s32; 00548 Cigi_uint32 u32; 00549 } tDta; 00550 00551 if(Word > 1) 00552 { 00553 #ifndef CIGI_NO_BND_CHK 00554 if(bndchk) 00555 { 00556 #ifndef CIGI_NO_EXCEPT 00557 throw CigiValueOutOfRangeException("Word",Word,0,1); 00558 #endif 00559 } 00560 #endif 00561 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00562 } 00563 00564 00565 tDta.s32 = CompDataIn; 00566 CompData[Word] = (Cigi_uint32)tDta.u32; 00567 00568 return(CIGI_SUCCESS); 00569 }
int CigiCompCtrlV1::SetCompData | ( | const Cigi_uint32 | CompDataIn, | |
const unsigned int | Word, | |||
bool | bndchk = true | |||
) |
Sets the specified CompData with bound checking control
CompDataIn | - The byte data | |
Word | - The word position | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 513 of file CigiCompCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00516 { 00517 00518 if(Word > 1) 00519 { 00520 #ifndef CIGI_NO_BND_CHK 00521 if(bndchk) 00522 { 00523 #ifndef CIGI_NO_EXCEPT 00524 throw CigiValueOutOfRangeException("Word",Word,0,1); 00525 #endif 00526 } 00527 #endif 00528 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00529 } 00530 00531 00532 CompData[Word] = CompDataIn; 00533 00534 return(CIGI_SUCCESS); 00535 }
int CigiCompCtrlV1::SetCompData | ( | const Cigi_int16 | CompDataIn, | |
const unsigned int | Word, | |||
const HalfWordPos | Pos, | |||
bool | bndchk = true | |||
) |
Sets the specified CompData with bound checking control
CompDataIn | - The byte data | |
Word | - The word position | |
Pos | - The half word position | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 463 of file CigiCompCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00467 { 00468 00469 union { 00470 Cigi_int16 s16; 00471 Cigi_uint16 u16; 00472 } sxfer; 00473 00474 int Err = 0; 00475 00476 if(Word > 1) 00477 Err = 1; 00478 else if((Pos < 0) || (Pos > 1)) 00479 Err = 2; 00480 00481 if(Err != 0) 00482 { 00483 #ifndef CIGI_NO_BND_CHK 00484 if(bndchk) 00485 { 00486 #ifndef CIGI_NO_EXCEPT 00487 if(Err == 1) 00488 throw CigiValueOutOfRangeException("Word",Word,0,1); 00489 else 00490 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00491 #endif 00492 } 00493 #endif 00494 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00495 } 00496 00497 00498 int bitPos = Pos * 16; 00499 00500 sxfer.s16 = CompDataIn; 00501 Cigi_uint32 tDta = (Cigi_uint32)sxfer.u16; 00502 00503 CompData[Word] &= ~(0x0000ffff << bitPos); 00504 CompData[Word] |= ((tDta & 0x0000ffff) << bitPos); 00505 00506 return(CIGI_SUCCESS); 00507 }
int CigiCompCtrlV1::SetCompData | ( | const Cigi_uint16 | CompDataIn, | |
const unsigned int | Word, | |||
const HalfWordPos | Pos, | |||
bool | bndchk = true | |||
) |
Sets the specified CompData with bound checking control
CompDataIn | - The byte data | |
Word | - The word position | |
Pos | - The half word position | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 419 of file CigiCompCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00423 { 00424 00425 int Err = 0; 00426 00427 if(Word > 1) 00428 Err = 1; 00429 else if((Pos < 0) || (Pos > 1)) 00430 Err = 2; 00431 00432 if(Err != 0) 00433 { 00434 #ifndef CIGI_NO_BND_CHK 00435 if(bndchk) 00436 { 00437 #ifndef CIGI_NO_EXCEPT 00438 if(Err == 1) 00439 throw CigiValueOutOfRangeException("Word",Word,0,1); 00440 else 00441 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00442 #endif 00443 } 00444 #endif 00445 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00446 } 00447 00448 00449 int bitPos = Pos * 16; 00450 00451 Cigi_uint32 tDta = (Cigi_uint32)CompDataIn; 00452 00453 CompData[Word] &= ~(0x0000ffff << bitPos); 00454 CompData[Word] |= ((tDta & 0x0000ffff) << bitPos); 00455 00456 return(CIGI_SUCCESS); 00457 }
int CigiCompCtrlV1::SetCompData | ( | const Cigi_int8 | CompDataIn, | |
const unsigned int | Word, | |||
const BytePos | Pos, | |||
bool | bndchk = true | |||
) |
Sets the specified CompData with bound checking control
CompDataIn | - The byte data | |
Word | - The word position | |
Pos | - The byte position | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 369 of file CigiCompCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00373 { 00374 00375 union { 00376 Cigi_uint8 uc; 00377 Cigi_int8 sc; 00378 } cxfer; 00379 00380 int Err = 0; 00381 00382 if(Word > 1) 00383 Err = 1; 00384 else if((Pos < 0) || (Pos > 3)) 00385 Err = 2; 00386 00387 if(Err != 0) 00388 { 00389 #ifndef CIGI_NO_BND_CHK 00390 if(bndchk) 00391 { 00392 #ifndef CIGI_NO_EXCEPT 00393 if(Err == 1) 00394 throw CigiValueOutOfRangeException("Word",Word,0,1); 00395 else 00396 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00397 #endif 00398 } 00399 #endif 00400 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00401 } 00402 00403 00404 int bitPos = Pos * 8; 00405 00406 cxfer.sc = CompDataIn; 00407 Cigi_uint32 tDta = (Cigi_uint32)cxfer.uc; 00408 00409 CompData[Word] &= ~(0x000000ff << bitPos); 00410 CompData[Word] |= ((tDta & 0x000000ff) << bitPos); 00411 00412 return(CIGI_SUCCESS); 00413 }
int CigiCompCtrlV1::SetCompData | ( | const Cigi_uint8 | CompDataIn, | |
const unsigned int | Word, | |||
const BytePos | Pos, | |||
bool | bndchk = true | |||
) |
Sets the specified CompData with bound checking control
CompDataIn | - The byte data | |
Word | - The word position | |
Pos | - The byte position | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 325 of file CigiCompCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00329 { 00330 00331 int Err = 0; 00332 00333 if(Word > 1) 00334 Err = 1; 00335 else if((Pos < 0) || (Pos > 3)) 00336 Err = 2; 00337 00338 if(Err != 0) 00339 { 00340 #ifndef CIGI_NO_BND_CHK 00341 if(bndchk) 00342 { 00343 #ifndef CIGI_NO_EXCEPT 00344 if(Err == 1) 00345 throw CigiValueOutOfRangeException("Word",Word,0,1); 00346 else 00347 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00348 #endif 00349 } 00350 #endif 00351 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00352 } 00353 00354 00355 int bitPos = Pos * 8; 00356 00357 Cigi_uint32 tDta = (Cigi_uint32)CompDataIn; 00358 00359 CompData[Word] &= ~(0x000000ff << bitPos); 00360 CompData[Word] |= ((tDta & 0x000000ff) << bitPos); 00361 00362 return(CIGI_SUCCESS); 00363 }
int CigiCompCtrlV1::SetCompState | ( | const Cigi_uint16 | CompStateIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the CompState with bound checking control
CompStateIn | - Component State Data | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 180 of file CigiCompCtrlV1.h.
References CIGI_SUCCESS.
00181 { 00182 CompState = CompStateIn; 00183 return(CIGI_SUCCESS); 00184 }
int CigiCompCtrlV1::SetEntityID | ( | const Cigi_uint16 | EntityIDIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the EntityID with bound checking control
EntityIDIn | - Entity ID | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 138 of file CigiCompCtrlV1.h.
References CIGI_SUCCESS, and CigiBaseCompCtrl::Entity.
00139 { 00140 EntityID = EntityIDIn; 00141 00142 if(CompAssoc == CigiBaseCompCtrl::Entity) 00143 InstanceID = EntityID; 00144 00145 return(CIGI_SUCCESS); 00146 }
int CigiCompCtrlV1::SetViewID | ( | const Cigi_uint8 | ViewIDIn, | |
bool | bndchk = true | |||
) |
Sets the ViewID with bound checking control
ViewIDIn | - View ID | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 259 of file CigiCompCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, CigiBaseCompCtrl::CompAssoc, CigiBaseCompCtrl::InstanceID, CigiBaseCompCtrl::View, and CigiBaseCompCtrl::ViewID.
00260 { 00261 00262 #ifndef CIGI_NO_BND_CHK 00263 if(bndchk && (ViewIDIn > 31)) 00264 { 00265 #ifndef CIGI_NO_EXCEPT 00266 throw CigiValueOutOfRangeException("ViewID",(Cigi_uint8)ViewIDIn,0,31); 00267 #endif 00268 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00269 } 00270 #endif 00271 00272 ViewID = ViewIDIn; 00273 if(CompAssoc == CigiBaseCompCtrl::View) 00274 InstanceID = ViewID; 00275 00276 return(CIGI_SUCCESS); 00277 00278 }
int CigiCompCtrlV1::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 CigiBaseCompCtrl.
Definition at line 181 of file CigiCompCtrlV1.cpp.
References PackPointerUnion::c, CIGI_COMP_CTRL_PACKET_SIZE_V1, CIGI_SCOPY2, CIGI_SCOPY4, CigiBaseCompCtrl::CompAssoc, CompClassV1xV3, CigiBaseCompCtrl::CompClassV2, CigiBaseCompCtrl::CompClassV3, CigiBaseCompCtrl::CompData, CigiBaseCompCtrl::CompID, CigiBaseCompCtrl::CompState, PackPointerUnion::d, CigiBaseCompCtrl::Entity, CigiBaseCompCtrl::EntityID, PackPointerUnion::l, CigiBaseCompCtrl::NoCnvtV2, CigiBaseCompCtrl::NoCnvtV3, CigiBasePacket::PacketSize, PackPointerUnion::s, CigiBaseCompCtrl::View, and CigiBaseCompCtrl::ViewID.
00182 { 00183 00184 double DBuf[6]; 00185 00186 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00187 00188 PackPointer CDta; 00189 00190 memcpy(tBuf,Buff,CIGI_COMP_CTRL_PACKET_SIZE_V1); 00191 00192 CDta.d = DBuf; 00193 00194 CDta.c += 2; // Step over packet id and size 00195 00196 CIGI_SCOPY2(&EntityID, CDta.s++); 00197 00198 Cigi_uint8 HDta = *CDta.c++; 00199 ViewID = (HDta >> 3) & 0x1f; 00200 CompAssoc = (CompAssocGrp)((HDta >> 1) & 0x03); 00201 00202 CDta.c += 3; 00203 00204 CIGI_SCOPY2(&CompID, CDta.s++); 00205 CIGI_SCOPY2(&CompState, CDta.s++); 00206 CIGI_SCOPY4(&CompData[0], CDta.l++); 00207 CIGI_SCOPY4(&CompData[1], CDta.l++); 00208 00209 00210 if((CompAssoc >= CigiBaseCompCtrl::Entity) && 00211 (CompAssoc <= CigiBaseCompCtrl::View)) 00212 { 00213 // The Component classes in V2 valued at 0, 1, & 2 00214 // match the classes in V1 in value and purpose. 00215 CompClassV2 = (CompClassV2Grp)CompAssoc; 00216 CompClassV3 = CompClassV1xV3[(int)CompAssoc]; 00217 } 00218 else 00219 { 00220 CompClassV2 = CigiBaseCompCtrl::NoCnvtV2; 00221 CompClassV3 = CigiBaseCompCtrl::NoCnvtV3; 00222 } 00223 00224 00225 return(PacketSize); 00226 00227 }
const int CigiCompCtrlV1::CompClassCnvtSz = 3 [static, protected] |
Definition at line 407 of file CigiCompCtrlV1.h.
const CigiBaseCompCtrl::CompClassV3Grp CigiCompCtrlV1::CompClassV1xV3 [static, protected] |
Initial value:
{ EntityV3, AtmosphereV3, ViewV3 }
Definition at line 408 of file CigiCompCtrlV1.h.
Referenced by SetCompAssoc(), and Unpack().