#include <CigiCompCtrlV2.h>
Inheritance diagram for CigiCompCtrlV2:
Public Member Functions | |
CigiCompCtrlV2 () | |
virtual | ~CigiCompCtrlV2 () |
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 | SetInstanceID (const Cigi_uint16 InstanceIDIn, bool bndchk=true) |
Cigi_uint16 | GetInstanceID (void) const |
int | SetCompState (const Cigi_uint16 CompStateIn, bool bndchk=true) |
Cigi_uint16 | GetCompState (void) const |
int | SetCompClassV2 (const CompClassV2Grp CompClassV2In, bool bndchk=true) |
CompClassV2Grp | GetCompClassV2 (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 = 6 |
static const CompAssocGrp | CompClassV2xV1 [CompClassCnvtSz] |
static const CompClassV3Grp | CompClassV2xV3 [CompClassCnvtSz] |
Definition at line 69 of file CigiCompCtrlV2.h.
CigiCompCtrlV2::CigiCompCtrlV2 | ( | ) |
General Constructor
Definition at line 120 of file CigiCompCtrlV2.cpp.
References CIGI_COMP_CTRL_PACKET_ID_V2, CIGI_COMP_CTRL_PACKET_SIZE_V2, 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.
00121 { 00122 00123 PacketID = CIGI_COMP_CTRL_PACKET_ID_V2; 00124 PacketSize = CIGI_COMP_CTRL_PACKET_SIZE_V2; 00125 Version = 2; 00126 MinorVersion = 0; 00127 00128 CompID = 0; 00129 InstanceID = 0; 00130 EntityID = 0; 00131 ViewID = 0; 00132 CompState = 0; 00133 CompAssoc = CigiBaseCompCtrl::Entity; 00134 CompClassV2 = CigiBaseCompCtrl::EntityV2; 00135 CompClassV3 = CigiBaseCompCtrl::EntityV3; 00136 CompData[0] = 0; 00137 CompData[1] = 0; 00138 CompData[2] = 0; 00139 CompData[3] = 0; 00140 CompData[4] = 0; 00141 CompData[5] = 0; 00142 00143 }
CigiCompCtrlV2::~CigiCompCtrlV2 | ( | ) | [virtual] |
Gets the specified CompData
Word | - The word position | |
Pos | - The byte position |
Definition at line 706 of file CigiCompCtrlV2.cpp.
References CigiBaseCompCtrl::CompData.
00708 { 00709 union { 00710 Cigi_int8 sc; 00711 Cigi_uint8 uc; 00712 } tDta; 00713 00714 int Err = 0; 00715 00716 if(Word > 1) 00717 Err = 1; 00718 else if((Pos < 0) || (Pos > 3)) 00719 Err = 2; 00720 00721 if(Err != 0) 00722 { 00723 #ifndef CIGI_NO_EXCEPT 00724 if(Err == 1) 00725 throw CigiValueOutOfRangeException("Word",Word,0,1); 00726 else 00727 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00728 #endif 00729 00730 tDta.uc = 0; 00731 } 00732 else 00733 tDta.uc = (Cigi_uint8)((CompData[Word] >> (Pos * 8)) & 0x000000ff); 00734 00735 return(tDta.sc); 00736 }
int CigiCompCtrlV2::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 243 of file CigiCompCtrlV2.cpp.
References CIGI_COMP_CTRL_PACKET_ID_V1, CIGI_COMP_CTRL_PACKET_ID_V2, CIGI_SHORT_COMP_CTRL_PACKET_ID_V3, CIGI_SUCCESS, CigiVersionID::CigiMajorVersion, CigiCnvtInfoType::CigiCnvtInfoStruct::CnvtPacketID, CigiBaseCompCtrl::CompAssoc, CigiBaseCompCtrl::Entity, CigiCnvtInfoType::CigiCnvtInfoStruct::ProcID, CigiProcessType::TwoPassCnvtProcNone, CigiProcessType::TwoPassCnvtProcStd, and CigiBaseCompCtrl::View.
00245 { 00246 00247 if(CnvtVersion.CigiMajorVersion == 2) 00248 { 00249 CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd; 00250 CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V2; 00251 } 00252 else if(CnvtVersion.CigiMajorVersion == 1) 00253 { 00254 if((CompAssoc >= Entity)&&(CompAssoc <= View)) 00255 { 00256 CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd; 00257 CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V1; 00258 } 00259 else 00260 { 00261 CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcNone; 00262 CnvtInfo.CnvtPacketID = 0; 00263 } 00264 } 00265 else 00266 { 00267 CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd; 00268 CnvtInfo.CnvtPacketID = CIGI_SHORT_COMP_CTRL_PACKET_ID_V3; 00269 } 00270 00271 return(CIGI_SUCCESS); 00272 00273 }
CompClassV2Grp CigiCompCtrlV2::GetCompClassV2 | ( | void | ) | const [inline] |
Gets the CompClassV2 value.
Definition at line 195 of file CigiCompCtrlV2.h.
00195 { return(CompClassV2); }
Cigi_uint16 CigiCompCtrlV2::GetCompState | ( | void | ) | const [inline] |
Gets the CompState value.
Definition at line 172 of file CigiCompCtrlV2.h.
00172 { return(CompState); }
double CigiCompCtrlV2::GetDoubleCompData | ( | const unsigned int | Pos | ) |
Gets the specified CompData
Pos | - The double word position |
Definition at line 924 of file CigiCompCtrlV2.cpp.
References _I64_CONST_, and CigiBaseCompCtrl::CompData.
00925 { 00926 00927 union DtaXfer { 00928 Cigi_uint64 i; 00929 double d; 00930 } XDta; 00931 00932 if(Pos > 1) 00933 { 00934 #ifndef CIGI_NO_EXCEPT 00935 throw CigiValueOutOfRangeException("Pos",Pos,0,0); 00936 #endif 00937 00938 } 00939 else 00940 { 00941 00942 int Word = Pos * 2; 00943 Cigi_uint64 tDtah = (Cigi_uint64)(CompData[Word++]); 00944 tDtah = (tDtah << 32) & _I64_CONST_(0xffffffff00000000); 00945 00946 Cigi_uint64 tDtal = (Cigi_uint64)(CompData[Word]); 00947 tDtal &= _I64_CONST_(0x00000000ffffffff); 00948 00949 XDta.i = tDtah | tDtal; 00950 00951 } 00952 00953 return(XDta.d); 00954 }
float CigiCompCtrlV2::GetFloatCompData | ( | const unsigned int | Word | ) |
Gets the specified CompData
Word | - The word position |
Definition at line 863 of file CigiCompCtrlV2.cpp.
References CigiBaseCompCtrl::CompData.
00864 { 00865 00866 union { 00867 float f32; 00868 Cigi_uint32 u32; 00869 } tDta; 00870 00871 if(Word > 1) 00872 { 00873 #ifndef CIGI_NO_EXCEPT 00874 throw CigiValueOutOfRangeException("Word",Word,0,1); 00875 #endif 00876 00877 tDta.u32 = 0; 00878 } 00879 else 00880 tDta.u32 = (Cigi_uint32)(CompData[Word]); 00881 00882 return(tDta.f32); 00883 }
Cigi_uint64 CigiCompCtrlV2::GetI64CompData | ( | const unsigned int | Pos | ) |
Gets the specified CompData
Pos | - The double word position |
Definition at line 890 of file CigiCompCtrlV2.cpp.
References _I64_CONST_, and CigiBaseCompCtrl::CompData.
00891 { 00892 00893 Cigi_uint64 tDta; 00894 00895 if(Pos > 0) 00896 { 00897 #ifndef CIGI_NO_EXCEPT 00898 throw CigiValueOutOfRangeException("Pos",Pos,0,0); 00899 #endif 00900 00901 tDta = 0; 00902 } 00903 else 00904 { 00905 int Word = Pos * 2; 00906 Cigi_uint64 tDtah = (Cigi_uint64)(CompData[Word++]); 00907 tDtah = (tDtah << 32) & _I64_CONST_(0xffffffff00000000); 00908 00909 Cigi_uint64 tDtal = (Cigi_uint64)(CompData[Word]); 00910 tDtal &= _I64_CONST_(0x00000000ffffffff); 00911 00912 tDta = tDtah | tDtal; 00913 } 00914 00915 00916 return(tDta); 00917 }
Cigi_uint16 CigiCompCtrlV2::GetInstanceID | ( | void | ) | const [inline] |
Gets the InstanceID value.
Definition at line 151 of file CigiCompCtrlV2.h.
00151 { return(InstanceID); }
Cigi_int32 CigiCompCtrlV2::GetLongCompData | ( | const unsigned int | Word | ) |
Gets the specified CompData
Word | - The word position |
Definition at line 836 of file CigiCompCtrlV2.cpp.
References CigiBaseCompCtrl::CompData.
00837 { 00838 00839 union { 00840 Cigi_int32 s32; 00841 Cigi_uint32 u32; 00842 } tDta; 00843 00844 if(Word > 1) 00845 { 00846 #ifndef CIGI_NO_EXCEPT 00847 throw CigiValueOutOfRangeException("Word",Word,0,1); 00848 #endif 00849 00850 tDta.u32 = 0; 00851 } 00852 else 00853 tDta.u32 = (Cigi_uint32)(CompData[Word]); 00854 00855 return(tDta.s32); 00856 }
Cigi_int16 CigiCompCtrlV2::GetShortCompData | ( | const unsigned int | Word, | |
const HalfWordPos | Pos | |||
) |
Gets the specified CompData
Word | - The word position | |
Pos | - The half word position |
Definition at line 775 of file CigiCompCtrlV2.cpp.
References CigiBaseCompCtrl::CompData.
00777 { 00778 union { 00779 Cigi_int16 s16; 00780 Cigi_uint16 u16; 00781 } tDta; 00782 00783 int Err = 0; 00784 00785 if(Word > 1) 00786 Err = 1; 00787 else if((Pos < 0) || (Pos > 1)) 00788 Err = 2; 00789 00790 if(Err != 0) 00791 { 00792 #ifndef CIGI_NO_EXCEPT 00793 if(Err == 1) 00794 throw CigiValueOutOfRangeException("Word",Word,0,1); 00795 else 00796 throw CigiValueOutOfRangeException("Pos",Pos,0,1); 00797 #endif 00798 00799 tDta.u16 = 0; 00800 } 00801 else 00802 tDta.u16 = (Cigi_uint16)((CompData[Word] >> (Pos * 16)) & 0x0000ffff); 00803 00804 return(tDta.s16); 00805 }
Cigi_uint8 CigiCompCtrlV2::GetUCharCompData | ( | const unsigned int | Word, | |
const BytePos | Pos | |||
) |
Gets the specified CompData
Word | - The word position | |
Pos | - The byte position |
Definition at line 672 of file CigiCompCtrlV2.cpp.
References CigiBaseCompCtrl::CompData.
00674 { 00675 00676 Cigi_uint8 tDta; 00677 00678 int Err = 0; 00679 00680 if(Word > 1) 00681 Err = 1; 00682 else if((Pos < 0) || (Pos > 3)) 00683 Err = 2; 00684 00685 if(Err != 0) 00686 { 00687 #ifndef CIGI_NO_EXCEPT 00688 if(Err == 1) 00689 throw CigiValueOutOfRangeException("Word",Word,0,1); 00690 else 00691 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00692 #endif 00693 00694 tDta = 0; 00695 } 00696 else 00697 tDta = (Cigi_uint8)((CompData[Word] >> (Pos * 8)) & 0x000000ff); 00698 00699 return(tDta); 00700 }
Cigi_uint32 CigiCompCtrlV2::GetULongCompData | ( | const unsigned int | Word | ) |
Gets the specified CompData
Word | - The word position |
Definition at line 811 of file CigiCompCtrlV2.cpp.
References CigiBaseCompCtrl::CompData.
00812 { 00813 00814 Cigi_uint32 tDta; 00815 00816 00817 if(Word > 1) 00818 { 00819 #ifndef CIGI_NO_EXCEPT 00820 throw CigiValueOutOfRangeException("Word",Word,0,1); 00821 #endif 00822 00823 tDta = 0; 00824 } 00825 else 00826 tDta = CompData[Word]; 00827 00828 return(tDta); 00829 }
Cigi_uint16 CigiCompCtrlV2::GetUShortCompData | ( | const unsigned int | Word, | |
const HalfWordPos | Pos | |||
) |
Gets the specified CompData
Word | - The word position | |
Pos | - The half word position |
Definition at line 742 of file CigiCompCtrlV2.cpp.
References CigiBaseCompCtrl::CompData.
00744 { 00745 Cigi_uint16 tDta; 00746 00747 int Err = 0; 00748 00749 if(Word > 1) 00750 Err = 1; 00751 else if((Pos < 0) || (Pos > 1)) 00752 Err = 2; 00753 00754 if(Err != 0) 00755 { 00756 #ifndef CIGI_NO_EXCEPT 00757 if(Err == 1) 00758 throw CigiValueOutOfRangeException("Word",Word,0,1); 00759 else 00760 throw CigiValueOutOfRangeException("Pos",Pos,0,1); 00761 #endif 00762 00763 tDta = 0; 00764 } 00765 else 00766 tDta = (Cigi_uint16)((CompData[Word] >> (Pos * 16)) & 0x0000ffff); 00767 00768 return(tDta); 00769 }
int CigiCompCtrlV2::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 CigiBaseCompCtrl.
Definition at line 160 of file CigiCompCtrlV2.cpp.
References PackPointerUnion::c, CIGI_COMP_CTRL_PACKET_SIZE_V2, CIGI_SCOPY2, CIGI_SCOPY4, CigiBaseCompCtrl::CompClassV2, CigiBaseCompCtrl::CompData, CigiBaseCompCtrl::CompID, CigiBaseCompCtrl::CompState, PackPointerUnion::d, CigiBaseCompCtrl::InstanceID, PackPointerUnion::l, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, and PackPointerUnion::s.
00161 { 00162 double DBuf[6]; 00163 00164 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00165 00166 PackPointer CDta; 00167 00168 CigiBaseCompCtrl * Data = ( CigiBaseCompCtrl *)Base; 00169 00170 CDta.d = DBuf; 00171 00172 *CDta.c++ = PacketID; 00173 *CDta.c++ = PacketSize; 00174 00175 CIGI_SCOPY2(CDta.s++, &Data->InstanceID); 00176 *CDta.c++ = Data->CompClassV2; 00177 00178 *CDta.c++ = 0; 00179 *CDta.s++ = 0; 00180 00181 CIGI_SCOPY2(CDta.s++, &Data->CompID); 00182 CIGI_SCOPY2(CDta.s++, &Data->CompState); 00183 CIGI_SCOPY4(CDta.l++, &Data->CompData[0]); 00184 CIGI_SCOPY4(CDta.l++, &Data->CompData[1]); 00185 00186 00187 memcpy(Buff,tBuf,CIGI_COMP_CTRL_PACKET_SIZE_V2); 00188 00189 return(PacketSize); 00190 00191 }
int CigiCompCtrlV2::SetCompClassV2 | ( | const CompClassV2Grp | CompClassV2In, | |
bool | bndchk = true | |||
) |
Sets the CompClassV2 with bound checking control
CompClassV2In | - EntityV2=0 EnvironmentV2=1 ViewV2=2 ViewGrpV2=3 SensorV2=4 SystemV2=5 | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 285 of file CigiCompCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, CigiBaseCompCtrl::CompAssoc, CigiBaseCompCtrl::CompClassV2, CompClassV2xV1, CompClassV2xV3, and CigiBaseCompCtrl::CompClassV3.
00286 { 00287 00288 #ifndef CIGI_NO_BND_CHK 00289 if(bndchk && ((CompClassV2In < 0)||(CompClassV2In > 5))) 00290 { 00291 #ifndef CIGI_NO_EXCEPT 00292 throw CigiValueOutOfRangeException("CompClassV2",(CompClassV2Grp)CompClassV2In,0,5); 00293 #endif 00294 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00295 } 00296 #endif 00297 00298 CompClassV2 = CompClassV2In; 00299 00300 00301 CompAssoc = CompClassV2xV1[CompClassV2]; 00302 CompClassV3 = CompClassV2xV3[CompClassV2]; 00303 00304 00305 return(CIGI_SUCCESS); 00306 00307 }
int CigiCompCtrlV2::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 629 of file CigiCompCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00632 { 00633 00634 if(Pos > 0) 00635 { 00636 #ifndef CIGI_NO_BND_CHK 00637 if(bndchk) 00638 { 00639 #ifndef CIGI_NO_EXCEPT 00640 throw CigiValueOutOfRangeException("Pos",Pos,0,0); 00641 #endif 00642 } 00643 #endif 00644 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00645 } 00646 00647 union DtaXfer { 00648 Cigi_uint64 i; 00649 double d; 00650 } XDta; 00651 00652 XDta.d = CompDataIn; 00653 00654 int Word = Pos * 2; 00655 00656 CompData[Word++] = (Cigi_uint32)((XDta.i >> 32) & 0x00000000ffffffff); 00657 CompData[Word] = (Cigi_uint32)(XDta.i & 0x00000000ffffffff); 00658 00659 00660 return(CIGI_SUCCESS); 00661 }
int CigiCompCtrlV2::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 598 of file CigiCompCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00601 { 00602 00603 if(Pos > 0) 00604 { 00605 #ifndef CIGI_NO_BND_CHK 00606 if(bndchk) 00607 { 00608 #ifndef CIGI_NO_EXCEPT 00609 throw CigiValueOutOfRangeException("Pos",Pos,0,0); 00610 #endif 00611 } 00612 #endif 00613 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00614 } 00615 00616 00617 int Word = Pos * 2; 00618 00619 CompData[Word++] = (Cigi_uint32)((CompDataIn >> 32) & 0x00000000ffffffff); 00620 CompData[Word] = (Cigi_uint32)(CompDataIn & 0x00000000ffffffff); 00621 00622 return(CIGI_SUCCESS); 00623 }
int CigiCompCtrlV2::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 564 of file CigiCompCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00567 { 00568 00569 if(Word > 1) 00570 { 00571 #ifndef CIGI_NO_BND_CHK 00572 if(bndchk) 00573 { 00574 #ifndef CIGI_NO_EXCEPT 00575 throw CigiValueOutOfRangeException("Word",Word,0,1); 00576 #endif 00577 } 00578 #endif 00579 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00580 } 00581 00582 00583 union DtaXfer { 00584 Cigi_uint32 lDta; 00585 float fDta; 00586 } XDta; 00587 00588 XDta.fDta = CompDataIn; 00589 CompData[Word] = XDta.lDta; 00590 00591 return(CIGI_SUCCESS); 00592 }
int CigiCompCtrlV2::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 530 of file CigiCompCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00533 { 00534 00535 union { 00536 Cigi_uint32 u32; 00537 Cigi_int32 s32; 00538 } tDta; 00539 00540 if(Word > 1) 00541 { 00542 #ifndef CIGI_NO_BND_CHK 00543 if(bndchk) 00544 { 00545 #ifndef CIGI_NO_EXCEPT 00546 throw CigiValueOutOfRangeException("Word",Word,0,1); 00547 #endif 00548 } 00549 #endif 00550 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00551 } 00552 00553 00554 tDta.s32 = CompDataIn; 00555 CompData[Word] = (Cigi_uint32)tDta.u32; 00556 00557 return(CIGI_SUCCESS); 00558 }
int CigiCompCtrlV2::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 502 of file CigiCompCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00505 { 00506 00507 if(Word > 1) 00508 { 00509 #ifndef CIGI_NO_BND_CHK 00510 if(bndchk) 00511 { 00512 #ifndef CIGI_NO_EXCEPT 00513 throw CigiValueOutOfRangeException("Word",Word,0,1); 00514 #endif 00515 } 00516 #endif 00517 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00518 } 00519 00520 00521 CompData[Word] = CompDataIn; 00522 00523 return(CIGI_SUCCESS); 00524 }
int CigiCompCtrlV2::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 452 of file CigiCompCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00456 { 00457 00458 union { 00459 Cigi_int16 s16; 00460 Cigi_uint16 u16; 00461 } sxfer; 00462 00463 int Err = 0; 00464 00465 if(Word > 1) 00466 Err = 1; 00467 else if((Pos < 0) || (Pos > 1)) 00468 Err = 2; 00469 00470 if(Err != 0) 00471 { 00472 #ifndef CIGI_NO_BND_CHK 00473 if(bndchk) 00474 { 00475 #ifndef CIGI_NO_EXCEPT 00476 if(Err == 1) 00477 throw CigiValueOutOfRangeException("Word",Word,0,1); 00478 else 00479 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00480 #endif 00481 } 00482 #endif 00483 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00484 } 00485 00486 00487 int bitPos = Pos * 16; 00488 00489 sxfer.s16 = CompDataIn; 00490 Cigi_uint32 tDta = (Cigi_uint32)sxfer.u16; 00491 00492 CompData[Word] &= ~(0x0000ffff << bitPos); 00493 CompData[Word] |= ((tDta & 0x0000ffff) << bitPos); 00494 00495 return(CIGI_SUCCESS); 00496 }
int CigiCompCtrlV2::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 408 of file CigiCompCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00412 { 00413 00414 int Err = 0; 00415 00416 if(Word > 1) 00417 Err = 1; 00418 else if((Pos < 0) || (Pos > 1)) 00419 Err = 2; 00420 00421 if(Err != 0) 00422 { 00423 #ifndef CIGI_NO_BND_CHK 00424 if(bndchk) 00425 { 00426 #ifndef CIGI_NO_EXCEPT 00427 if(Err == 1) 00428 throw CigiValueOutOfRangeException("Word",Word,0,1); 00429 else 00430 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00431 #endif 00432 } 00433 #endif 00434 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00435 } 00436 00437 00438 int bitPos = Pos * 16; 00439 00440 Cigi_uint32 tDta = (Cigi_uint32)CompDataIn; 00441 00442 CompData[Word] &= ~(0x0000ffff << bitPos); 00443 CompData[Word] |= ((tDta & 0x0000ffff) << bitPos); 00444 00445 return(CIGI_SUCCESS); 00446 }
int CigiCompCtrlV2::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 358 of file CigiCompCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00362 { 00363 00364 union { 00365 Cigi_int8 sc; 00366 Cigi_uint8 uc; 00367 } cxfer; 00368 00369 int Err = 0; 00370 00371 if(Word > 1) 00372 Err = 1; 00373 else if((Pos < 0) || (Pos > 3)) 00374 Err = 2; 00375 00376 if(Err != 0) 00377 { 00378 #ifndef CIGI_NO_BND_CHK 00379 if(bndchk) 00380 { 00381 #ifndef CIGI_NO_EXCEPT 00382 if(Err == 1) 00383 throw CigiValueOutOfRangeException("Word",Word,0,1); 00384 else 00385 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00386 #endif 00387 } 00388 #endif 00389 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00390 } 00391 00392 00393 int bitPos = Pos * 8; 00394 00395 cxfer.sc = CompDataIn; 00396 Cigi_uint32 tDta = (Cigi_uint32)cxfer.uc; 00397 00398 CompData[Word] &= ~(0x000000ff << bitPos); 00399 CompData[Word] |= ((tDta & 0x000000ff) << bitPos); 00400 00401 return(CIGI_SUCCESS); 00402 }
int CigiCompCtrlV2::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 314 of file CigiCompCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.
00318 { 00319 00320 int Err = 0; 00321 00322 if(Word > 1) 00323 Err = 1; 00324 else if((Pos < 0) || (Pos > 3)) 00325 Err = 2; 00326 00327 if(Err != 0) 00328 { 00329 #ifndef CIGI_NO_BND_CHK 00330 if(bndchk) 00331 { 00332 #ifndef CIGI_NO_EXCEPT 00333 if(Err == 1) 00334 throw CigiValueOutOfRangeException("Word",Word,0,1); 00335 else 00336 throw CigiValueOutOfRangeException("Pos",Pos,0,3); 00337 #endif 00338 } 00339 #endif 00340 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00341 } 00342 00343 00344 int bitPos = Pos * 8; 00345 00346 Cigi_uint32 tDta = (Cigi_uint32)CompDataIn; 00347 00348 CompData[Word] &= ~(0x000000ff << bitPos); 00349 CompData[Word] |= ((tDta & 0x000000ff) << bitPos); 00350 00351 return(CIGI_SUCCESS); 00352 }
int CigiCompCtrlV2::SetCompState | ( | const Cigi_uint16 | CompStateIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the CompState with bound checking control
CompStateIn | - | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 163 of file CigiCompCtrlV2.h.
References CIGI_SUCCESS.
00164 { 00165 CompState = CompStateIn; 00166 return(CIGI_SUCCESS); 00167 }
int CigiCompCtrlV2::SetInstanceID | ( | const Cigi_uint16 | InstanceIDIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the InstanceID with bound checking control
InstanceIDIn | - | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 142 of file CigiCompCtrlV2.h.
References CIGI_SUCCESS.
00143 { 00144 InstanceID = InstanceIDIn; 00145 return(CIGI_SUCCESS); 00146 }
int CigiCompCtrlV2::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 CigiBaseCompCtrl.
Definition at line 196 of file CigiCompCtrlV2.cpp.
References PackPointerUnion::c, CIGI_COMP_CTRL_PACKET_SIZE_V2, CIGI_SCOPY2, CIGI_SCOPY4, CigiBaseCompCtrl::CompAssoc, CigiBaseCompCtrl::CompClassV2, CompClassV2xV1, CompClassV2xV3, CigiBaseCompCtrl::CompClassV3, CigiBaseCompCtrl::CompData, CigiBaseCompCtrl::CompID, CigiBaseCompCtrl::CompState, PackPointerUnion::d, CigiBaseCompCtrl::EntityV2, CigiBaseCompCtrl::InstanceID, PackPointerUnion::l, CigiBaseCompCtrl::NoCnvtV1, CigiBaseCompCtrl::NoCnvtV3, CigiBasePacket::PacketSize, PackPointerUnion::s, and CigiBaseCompCtrl::SystemV2.
00197 { 00198 double DBuf[6]; 00199 00200 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00201 00202 PackPointer CDta; 00203 00204 memcpy(tBuf,Buff,CIGI_COMP_CTRL_PACKET_SIZE_V2); 00205 00206 CDta.d = DBuf; 00207 00208 CDta.c += 2; // Step over packet id and size 00209 00210 00211 CIGI_SCOPY2(&InstanceID, CDta.s++); 00212 CompClassV2 = (CompClassV2Grp)*CDta.c++; 00213 00214 CDta.c += 3; 00215 00216 CIGI_SCOPY2(&CompID, CDta.s++); 00217 CIGI_SCOPY2(&CompState, CDta.s++); 00218 CIGI_SCOPY4(&CompData[0], CDta.l++); 00219 CIGI_SCOPY4(&CompData[1], CDta.l++); 00220 00221 00222 if((CompClassV2 >= CigiBaseCompCtrl::EntityV2) && 00223 (CompClassV2 <= CigiBaseCompCtrl::SystemV2)) 00224 { 00225 CompAssoc = CompClassV2xV1[CompClassV2]; 00226 CompClassV3 = CompClassV2xV3[CompClassV2]; 00227 } 00228 else 00229 { 00230 CompAssoc = CigiBaseCompCtrl::NoCnvtV1; 00231 CompClassV3 = CigiBaseCompCtrl::NoCnvtV3; 00232 } 00233 00234 00235 return(PacketSize); 00236 00237 }
const int CigiCompCtrlV2::CompClassCnvtSz = 6 [static, protected] |
Definition at line 393 of file CigiCompCtrlV2.h.
const CigiBaseCompCtrl::CompAssocGrp CigiCompCtrlV2::CompClassV2xV1 [static, protected] |
Initial value:
{ Entity, Environment, View, NoCnvtV1, NoCnvtV1, NoCnvtV1 }
Definition at line 394 of file CigiCompCtrlV2.h.
Referenced by SetCompClassV2(), and Unpack().
const CigiBaseCompCtrl::CompClassV3Grp CigiCompCtrlV2::CompClassV2xV3 [static, protected] |
Initial value:
Definition at line 395 of file CigiCompCtrlV2.h.
Referenced by SetCompClassV2(), and Unpack().