CigiShortCompCtrlV3 Class Reference

#include <CigiShortCompCtrlV3.h>

Inheritance diagram for CigiShortCompCtrlV3:

CigiBaseCompCtrl CigiBasePacket List of all members.

Public Member Functions

 CigiShortCompCtrlV3 ()
virtual ~CigiShortCompCtrlV3 ()
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_uint8 CompStateIn, bool bndchk=true)
Cigi_uint8 GetCompState (void)
int SetCompClassV3 (const CompClassV3Grp CompClassV3In, bool bndchk=true)
CompClassV3Grp GetCompClassV3 (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 = 14
static const CompAssocGrp CompClassV3xV1 [CompClassCnvtSz]
static const CompClassV2Grp CompClassV3xV2 [CompClassCnvtSz]

Detailed Description

Definition at line 66 of file CigiShortCompCtrlV3.h.


Constructor & Destructor Documentation

CigiShortCompCtrlV3::CigiShortCompCtrlV3 (  ) 

General Constructor

Definition at line 122 of file CigiShortCompCtrlV3.cpp.

References CIGI_SHORT_COMP_CTRL_PACKET_ID_V3, CIGI_SHORT_COMP_CTRL_PACKET_SIZE_V3, 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.

00123 {
00124 
00125    PacketID = CIGI_SHORT_COMP_CTRL_PACKET_ID_V3;
00126    PacketSize = CIGI_SHORT_COMP_CTRL_PACKET_SIZE_V3;
00127    Version = 3;
00128    MinorVersion = 0;
00129 
00130    CompID = 0;
00131    InstanceID = 0;
00132    EntityID = 0;
00133    ViewID = 0;
00134    CompState = 0;
00135    CompAssoc = Entity;
00136    CompClassV2 = EntityV2;
00137    CompClassV3 = EntityV3;
00138    CompData[0] = 0;
00139    CompData[1] = 0;
00140    CompData[2] = 0;
00141    CompData[3] = 0;
00142    CompData[4] = 0;
00143    CompData[5] = 0;
00144 
00145 }

CigiShortCompCtrlV3::~CigiShortCompCtrlV3 (  )  [virtual]

General Destructor

Definition at line 150 of file CigiShortCompCtrlV3.cpp.

00151 {
00152 
00153 }


Member Function Documentation

Cigi_int8 CigiShortCompCtrlV3::GetCharCompData ( const unsigned int  Word,
const BytePos  Pos 
)

Gets the specified CompData

Parameters:
Word - The word position
Pos - The byte position
Returns:
This returns the specified Cigi_int8 value.

Definition at line 727 of file CigiShortCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00729 {
00730    union {
00731       Cigi_int8 sc;
00732       Cigi_uint8 uc;
00733    } tDta;
00734 
00735    int Err = 0;
00736 
00737    if(Word > 1)
00738       Err = 1;
00739    else if((Pos < 0) || (Pos > 3))
00740       Err = 2;
00741 
00742    if(Err != 0)
00743    {
00744 #ifndef CIGI_NO_EXCEPT
00745       if(Err == 1)
00746          throw CigiValueOutOfRangeException("Word",Word,0,1);
00747       else
00748          throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00749 #endif
00750 
00751       tDta.uc = 0;
00752    }
00753    else
00754       tDta.uc = (Cigi_uint8)((CompData[Word] >> (Pos * 8)) & 0x000000ff);
00755 
00756    return(tDta.sc);
00757 }

int CigiShortCompCtrlV3::GetCnvt ( CigiVersionID CnvtVersion,
CigiCnvtInfoType::Type CnvtInfo 
) [virtual]

A virtual Conversion Information function. This function provides conversion information for this packet.

Parameters:
CnvtVersion - The CIGI version to which this packet is being converted.
CnvtInfo - The information needed for conversion
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Implements CigiBaseCompCtrl.

Definition at line 245 of file CigiShortCompCtrlV3.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, CigiVersionID::CigiMinorVersion, CigiCnvtInfoType::CigiCnvtInfoStruct::CnvtPacketID, CigiBaseCompCtrl::CompAssoc, CigiBaseCompCtrl::CompClassV2, CigiBaseCompCtrl::CompClassV3, CigiBaseCompCtrl::Entity, CigiBaseCompCtrl::EntityV2, CigiBaseCompCtrl::EntityV3, CigiCnvtInfoType::CigiCnvtInfoStruct::ProcID, CigiBaseCompCtrl::SystemV2, CigiBaseCompCtrl::SystemV3, CigiProcessType::TwoPassCnvtProcNone, CigiProcessType::TwoPassCnvtProcStd, and CigiBaseCompCtrl::View.

00247 {
00248    // Do not convert unless a conversion is found
00249    CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcNone;
00250    CnvtInfo.CnvtPacketID = 0;
00251 
00252    if(CnvtVersion.CigiMajorVersion == 3)
00253    {
00254       // All Component control packets from version 3 and above
00255       //  use the same packet id number
00256 
00257       if(CnvtVersion.CigiMinorVersion < 3)
00258       {
00259          if((CompClassV3 >= EntityV3)&&(CompClassV3 <= SystemV3))
00260          {
00261             CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00262             CnvtInfo.CnvtPacketID = CIGI_SHORT_COMP_CTRL_PACKET_ID_V3;
00263          }
00264       }
00265       else
00266       {
00267          CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00268          CnvtInfo.CnvtPacketID = CIGI_SHORT_COMP_CTRL_PACKET_ID_V3;
00269       }
00270    }
00271    else if(CnvtVersion.CigiMajorVersion == 2)
00272    {
00273       if((CompClassV2 >= EntityV2)&&(CompClassV2 <= SystemV2))
00274       {
00275          CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00276          CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V2;
00277       }
00278    }
00279    else if(CnvtVersion.CigiMajorVersion == 1)
00280    {
00281       if((CompAssoc >= Entity)&&(CompAssoc <= View))
00282       {
00283          CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00284          CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V1;
00285       }
00286    }
00287    else
00288    {
00289       // All Component control packets from version 3 and above
00290       //  use the same packet id number
00291       CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00292       CnvtInfo.CnvtPacketID = CIGI_SHORT_COMP_CTRL_PACKET_ID_V3;
00293    }
00294 
00295    return(CIGI_SUCCESS);
00296 
00297 }

CompClassV3Grp CigiShortCompCtrlV3::GetCompClassV3 ( void   )  const [inline]

Gets the CompClassV3 value.

Returns:
the current CompClassV3.

Definition at line 206 of file CigiShortCompCtrlV3.h.

00206 { return(CompClassV3); }

Cigi_uint8 CigiShortCompCtrlV3::GetCompState ( void   )  [inline]

Gets the CompState value.

Returns:
the current CompState.

Definition at line 169 of file CigiShortCompCtrlV3.h.

00170    {
00171       Cigi_uint8 tState = (Cigi_uint8)((CompState > 0x00ff) ?
00172                           0x00ff : CompState);
00173 
00174       return(tState);
00175    }

double CigiShortCompCtrlV3::GetDoubleCompData ( const unsigned int  Pos  ) 

Gets the specified CompData

Parameters:
Pos - The double word position
Returns:
This returns the specified double value.

Definition at line 945 of file CigiShortCompCtrlV3.cpp.

References _I64_CONST_, and CigiBaseCompCtrl::CompData.

00946 {
00947 
00948    union DtaXfer {
00949       Cigi_uint64 i;
00950       double d;
00951    } XDta;
00952 
00953    if(Pos > 0)
00954    {
00955 #ifndef CIGI_NO_EXCEPT
00956       throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00957 #endif
00958 
00959       XDta.d = 0.0;
00960    }
00961    else
00962    {
00963 
00964       int Word = Pos * 2;
00965       Cigi_uint64 tDtah = (Cigi_uint64)(CompData[Word++]);
00966       tDtah = (tDtah << 32) & _I64_CONST_(0xffffffff00000000);
00967 
00968       Cigi_uint64 tDtal = (Cigi_uint64)(CompData[Word]);
00969       tDtal &= _I64_CONST_(0x00000000ffffffff);
00970 
00971       XDta.i = tDtah | tDtal;
00972 
00973    }
00974 
00975    return(XDta.d);
00976 }

float CigiShortCompCtrlV3::GetFloatCompData ( const unsigned int  Word  ) 

Gets the specified CompData

Parameters:
Word - The word position
Returns:
This returns the specified float value.

Definition at line 884 of file CigiShortCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00885 {
00886 
00887    union {
00888       Cigi_uint32 u32;
00889       float f32;
00890    } tDta;
00891 
00892    if(Word > 1)
00893    {
00894 #ifndef CIGI_NO_EXCEPT
00895       throw CigiValueOutOfRangeException("Word",Word,0,1);
00896 #endif
00897 
00898       tDta.u32 = 0;
00899    }
00900    else
00901       tDta.u32 = (Cigi_uint32)(CompData[Word]);
00902 
00903    return(tDta.f32);
00904 }

Cigi_uint64 CigiShortCompCtrlV3::GetI64CompData ( const unsigned int  Pos  ) 

Gets the specified CompData

Parameters:
Pos - The double word position
Returns:
This returns the specified Int64 value.

Definition at line 911 of file CigiShortCompCtrlV3.cpp.

References _I64_CONST_, and CigiBaseCompCtrl::CompData.

00912 {
00913 
00914    Cigi_uint64 tDta;
00915 
00916    if(Pos > 0)
00917    {
00918 #ifndef CIGI_NO_EXCEPT
00919       throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00920 #endif
00921 
00922       tDta = 0;
00923    }
00924    else
00925    {
00926       int Word = Pos * 2;
00927       Cigi_uint64 tDtah = (Cigi_uint64)(CompData[Word++]);
00928       tDtah = (tDtah << 32) & _I64_CONST_(0xffffffff00000000);
00929 
00930       Cigi_uint64 tDtal = (Cigi_uint64)(CompData[Word]);
00931       tDtal &= _I64_CONST_(0x00000000ffffffff);
00932 
00933       tDta = tDtah | tDtal;
00934    }
00935 
00936 
00937    return(tDta);
00938 }

Cigi_uint16 CigiShortCompCtrlV3::GetInstanceID ( void   )  const [inline]

Gets the InstanceID value.

Returns:
the current InstanceID.

Definition at line 148 of file CigiShortCompCtrlV3.h.

00148 { return(InstanceID); }

Cigi_int32 CigiShortCompCtrlV3::GetLongCompData ( const unsigned int  Word  ) 

Gets the specified CompData

Parameters:
Word - The word position
Returns:
This returns the specified Long value.

Definition at line 857 of file CigiShortCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00858 {
00859 
00860    union {
00861       Cigi_int32 s32;
00862       Cigi_uint32 u32;
00863    } tDta;
00864 
00865    if(Word > 1)
00866    {
00867 #ifndef CIGI_NO_EXCEPT
00868       throw CigiValueOutOfRangeException("Word",Word,0,1);
00869 #endif
00870 
00871       tDta.u32 = 0;
00872    }
00873    else
00874       tDta.u32 = (Cigi_uint32)(CompData[Word]);
00875 
00876    return(tDta.s32);
00877 }

Cigi_int16 CigiShortCompCtrlV3::GetShortCompData ( const unsigned int  Word,
const HalfWordPos  Pos 
)

Gets the specified CompData

Parameters:
Word - The word position
Pos - The half word position
Returns:
This returns the specified Cigi_int16 value.

Definition at line 796 of file CigiShortCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00798 {
00799    union {
00800       Cigi_int16 s16;
00801       Cigi_uint16 u16;
00802    } tDta;
00803 
00804    int Err = 0;
00805 
00806    if(Word > 1)
00807       Err = 1;
00808    else if((Pos < 0) || (Pos > 1))
00809       Err = 2;
00810 
00811    if(Err != 0)
00812    {
00813 #ifndef CIGI_NO_EXCEPT
00814       if(Err == 1)
00815          throw CigiValueOutOfRangeException("Word",Word,0,1);
00816       else
00817          throw CigiValueOutOfRangeException("Pos",Pos,0,1);
00818 #endif
00819 
00820       tDta.u16 = 0;
00821    }
00822    else
00823       tDta.u16 = (Cigi_uint16)((CompData[Word] >> (Pos * 16)) & 0x0000ffff);
00824 
00825    return(tDta.s16);
00826 }

Cigi_uint8 CigiShortCompCtrlV3::GetUCharCompData ( const unsigned int  Word,
const BytePos  Pos 
)

Gets the specified CompData

Parameters:
Word - The word position
Pos - The byte position
Returns:
This returns the specified Cigi_uint8 value.

Definition at line 693 of file CigiShortCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00695 {
00696 
00697    Cigi_uint8 tDta;
00698 
00699    int Err = 0;
00700 
00701    if(Word > 1)
00702       Err = 1;
00703    else if((Pos < 0) || (Pos > 3))
00704       Err = 2;
00705 
00706    if(Err != 0)
00707    {
00708 #ifndef CIGI_NO_EXCEPT
00709       if(Err == 1)
00710          throw CigiValueOutOfRangeException("Word",Word,0,1);
00711       else
00712          throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00713 #endif
00714 
00715       tDta = 0;
00716    }
00717    else
00718       tDta = (Cigi_uint8)((CompData[Word] >> (Pos * 8)) & 0x000000ff);
00719 
00720    return(tDta);
00721 }

Cigi_uint32 CigiShortCompCtrlV3::GetULongCompData ( const unsigned int  Word  ) 

Gets the specified CompData

Parameters:
Word - The word position
Returns:
This returns the specified unsigned Long value.

Definition at line 832 of file CigiShortCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00833 {
00834 
00835    Cigi_uint32 tDta;
00836 
00837 
00838    if(Word > 1)
00839    {
00840 #ifndef CIGI_NO_EXCEPT
00841       throw CigiValueOutOfRangeException("Word",Word,0,1);
00842 #endif
00843 
00844       tDta = 0;
00845    }
00846    else
00847       tDta = CompData[Word];
00848 
00849    return(tDta);
00850 }

Cigi_uint16 CigiShortCompCtrlV3::GetUShortCompData ( const unsigned int  Word,
const HalfWordPos  Pos 
)

Gets the specified CompData

Parameters:
Word - The word position
Pos - The half word position
Returns:
This returns the specified Cigi_uint16 value.

Definition at line 763 of file CigiShortCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00765 {
00766    Cigi_uint16 tDta;
00767 
00768    int Err = 0;
00769 
00770    if(Word > 1)
00771       Err = 1;
00772    else if((Pos < 0) || (Pos > 1))
00773       Err = 2;
00774 
00775    if(Err != 0)
00776    {
00777 #ifndef CIGI_NO_EXCEPT
00778       if(Err == 1)
00779          throw CigiValueOutOfRangeException("Word",Word,0,1);
00780       else
00781          throw CigiValueOutOfRangeException("Pos",Pos,0,1);
00782 #endif
00783 
00784       tDta = 0;
00785    }
00786    else
00787       tDta = (Cigi_uint16)((CompData[Word] >> (Pos * 16)) & 0x0000ffff);
00788 
00789    return(tDta);
00790 }

int CigiShortCompCtrlV3::Pack ( CigiBasePacket Base,
Cigi_uint8 Buff,
void *  Spec 
) const [virtual]

The virtual Pack function for CIGI 3

Parameters:
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.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Implements CigiBaseCompCtrl.

Definition at line 162 of file CigiShortCompCtrlV3.cpp.

References PackPointerUnion::c, CigiBaseCompCtrl::CompClassV3, CigiBaseCompCtrl::CompData, CigiBaseCompCtrl::CompID, CigiBaseCompCtrl::CompState, CigiBaseCompCtrl::InstanceID, PackPointerUnion::l, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, and PackPointerUnion::s.

00163 {
00164    PackPointer CDta;
00165 
00166    CigiBaseCompCtrl * Data = ( CigiBaseCompCtrl *)Base;
00167 
00168    CDta.c = Buff;
00169 
00170    *CDta.c++ = PacketID;
00171    *CDta.c++ = PacketSize;
00172 
00173    *CDta.s++ = Data->CompID;
00174    *CDta.s++ = Data->InstanceID;
00175 
00176    *CDta.c++ = Data->CompClassV3 & 0x0f;
00177 
00178    *CDta.c++ = (Cigi_uint8)((Data->CompState > 0x00ff) ?
00179                                  0x00ff : Data->CompState);
00180 
00181    *CDta.l++ = Data->CompData[0];
00182    *CDta.l++ = Data->CompData[1];
00183 
00184    return(PacketSize);
00185 
00186 }

int CigiShortCompCtrlV3::SetCompClassV3 ( const CompClassV3Grp  CompClassV3In,
bool  bndchk = true 
)

Sets the CompClassV3 with bound checking control

Parameters:
CompClassV3In -
EntityV3=0
ViewV3=1
ViewGrpV3=2
SensorV3=3
RegionalSeaSurfaceV3=4
RegionalTerrainSurfaceV3=5
RegionalLayeredWeatherV3=6
GlobalSeaSurfaceV3=7
GlobalTerrainSurfaceV3=8
GlobalLayeredWeatherV3=9
AtmosphereV3=10
CelestialSphereV3=11
EventV3=12
SystemV3=13
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 309 of file CigiShortCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, CigiBaseCompCtrl::CompAssoc, CigiBaseCompCtrl::CompClassV2, CigiBaseCompCtrl::CompClassV3, CompClassV3xV1, and CompClassV3xV2.

00310 {
00311 
00312 #ifndef CIGI_NO_BND_CHK
00313    if(bndchk && ((CompClassV3In < 0)||(CompClassV3In > 13)))
00314    {
00315 #ifndef CIGI_NO_EXCEPT
00316       throw CigiValueOutOfRangeException("CompClassV3",(CompClassV3Grp)CompClassV3In,0,13);
00317 #endif
00318       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00319    }
00320 #endif
00321 
00322    CompClassV3 = CompClassV3In;
00323 
00324    CompAssoc = CompClassV3xV1[CompClassV3];
00325    CompClassV2 = CompClassV3xV2[CompClassV3];
00326 
00327    return(CIGI_SUCCESS);
00328 
00329 }

int CigiShortCompCtrlV3::SetCompData ( const double  CompDataIn,
const unsigned int  Pos,
bool  bndchk = true 
)

Sets the specified CompData with bound checking control

Parameters:
CompDataIn - The byte data
Pos - The double word position
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 650 of file CigiShortCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00653 {
00654 
00655    if(Pos > 0)
00656    {
00657 #ifndef CIGI_NO_BND_CHK
00658       if(bndchk)
00659       {
00660 #ifndef CIGI_NO_EXCEPT
00661          throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00662 #endif
00663       }
00664 #endif
00665       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00666    }
00667 
00668    union DtaXfer {
00669       Cigi_uint64 i;
00670       double d;
00671    } XDta;
00672 
00673    XDta.d = CompDataIn;
00674 
00675    int Word = Pos * 2;
00676 
00677    CompData[Word++] = (Cigi_uint32)((XDta.i >> 32) & 0x00000000ffffffff);
00678    CompData[Word] = (Cigi_uint32)(XDta.i & 0x00000000ffffffff);
00679 
00680 
00681    return(CIGI_SUCCESS);
00682 }

int CigiShortCompCtrlV3::SetCompData ( const Cigi_uint64  CompDataIn,
const unsigned int  Pos,
bool  bndchk = true 
)

Sets the specified CompData with bound checking control

Parameters:
CompDataIn - The byte data
Pos - The double word position
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 619 of file CigiShortCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00622 {
00623 
00624    if(Pos > 0)
00625    {
00626 #ifndef CIGI_NO_BND_CHK
00627       if(bndchk)
00628       {
00629 #ifndef CIGI_NO_EXCEPT
00630          throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00631 #endif
00632       }
00633 #endif
00634       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00635    }
00636 
00637 
00638    int Word = Pos * 2;
00639 
00640    CompData[Word++] = (Cigi_uint32)((CompDataIn >> 32) & 0x00000000ffffffff);
00641    CompData[Word] = (Cigi_uint32)(CompDataIn & 0x00000000ffffffff);
00642 
00643    return(CIGI_SUCCESS);
00644 }

int CigiShortCompCtrlV3::SetCompData ( const float  CompDataIn,
const unsigned int  Word,
bool  bndchk = true 
)

Sets the specified CompData with bound checking control

Parameters:
CompDataIn - The byte data
Word - The word position
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 586 of file CigiShortCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00589 {
00590 
00591    union {
00592       Cigi_uint32 u32;
00593       float f32;
00594    } tDta;
00595 
00596    if(Word > 1)
00597    {
00598 #ifndef CIGI_NO_BND_CHK
00599       if(bndchk)
00600       {
00601 #ifndef CIGI_NO_EXCEPT
00602          throw CigiValueOutOfRangeException("Word",Word,0,1);
00603 #endif
00604       }
00605 #endif
00606       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00607    }
00608 
00609    tDta.f32 = CompDataIn;
00610    CompData[Word] = tDta.u32;
00611 
00612    return(CIGI_SUCCESS);
00613 }

int CigiShortCompCtrlV3::SetCompData ( const Cigi_int32  CompDataIn,
const unsigned int  Word,
bool  bndchk = true 
)

Sets the specified CompData with bound checking control

Parameters:
CompDataIn - The byte data
Word - The word position
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 552 of file CigiShortCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00555 {
00556 
00557    union {
00558       Cigi_uint32 u32;
00559       Cigi_int32 s32;
00560    } tDta;
00561 
00562    if(Word > 1)
00563    {
00564 #ifndef CIGI_NO_BND_CHK
00565       if(bndchk)
00566       {
00567 #ifndef CIGI_NO_EXCEPT
00568          throw CigiValueOutOfRangeException("Word",Word,0,1);
00569 #endif
00570       }
00571 #endif
00572       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00573    }
00574 
00575    tDta.s32 = CompDataIn;
00576    CompData[Word] = tDta.u32;
00577 
00578 
00579    return(CIGI_SUCCESS);
00580 }

int CigiShortCompCtrlV3::SetCompData ( const Cigi_uint32  CompDataIn,
const unsigned int  Word,
bool  bndchk = true 
)

Sets the specified CompData with bound checking control

Parameters:
CompDataIn - The byte data
Word - The word position
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 524 of file CigiShortCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00527 {
00528 
00529    if(Word > 1)
00530    {
00531 #ifndef CIGI_NO_BND_CHK
00532       if(bndchk)
00533       {
00534 #ifndef CIGI_NO_EXCEPT
00535          throw CigiValueOutOfRangeException("Word",Word,0,1);
00536 #endif
00537       }
00538 #endif
00539       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00540    }
00541 
00542 
00543    CompData[Word] = CompDataIn;
00544 
00545    return(CIGI_SUCCESS);
00546 }

int CigiShortCompCtrlV3::SetCompData ( const Cigi_int16  CompDataIn,
const unsigned int  Word,
const HalfWordPos  Pos,
bool  bndchk = true 
)

Sets the specified CompData with bound checking control

Parameters:
CompDataIn - The byte data
Word - The word position
Pos - The half word position
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 474 of file CigiShortCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00478 {
00479 
00480    union {
00481       Cigi_int16 s16;
00482       Cigi_uint16 u16;
00483    } sxfer;
00484 
00485    int Err = 0;
00486 
00487    if(Word > 1)
00488       Err = 1;
00489    else if((Pos < 0) || (Pos > 1))
00490       Err = 2;
00491 
00492    if(Err != 0)
00493    {
00494 #ifndef CIGI_NO_BND_CHK
00495       if(bndchk)
00496       {
00497 #ifndef CIGI_NO_EXCEPT
00498          if(Err == 1)
00499             throw CigiValueOutOfRangeException("Word",Word,0,1);
00500          else
00501             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00502 #endif
00503       }
00504 #endif
00505       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00506    }
00507 
00508 
00509    int bitPos = Pos * 16;
00510 
00511    sxfer.s16 = CompDataIn;
00512    Cigi_uint32 tDta = (Cigi_uint32)sxfer.u16;
00513 
00514    CompData[Word] &= ~(0x0000ffff << bitPos);
00515    CompData[Word] |= ((tDta & 0x0000ffff) << bitPos);
00516 
00517    return(CIGI_SUCCESS);
00518 }

int CigiShortCompCtrlV3::SetCompData ( const Cigi_uint16  CompDataIn,
const unsigned int  Word,
const HalfWordPos  Pos,
bool  bndchk = true 
)

Sets the specified CompData with bound checking control

Parameters:
CompDataIn - The byte data
Word - The word position
Pos - The half word position
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 430 of file CigiShortCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00434 {
00435 
00436    int Err = 0;
00437 
00438    if(Word > 1)
00439       Err = 1;
00440    else if((Pos < 0) || (Pos > 1))
00441       Err = 2;
00442 
00443    if(Err != 0)
00444    {
00445 #ifndef CIGI_NO_BND_CHK
00446       if(bndchk)
00447       {
00448 #ifndef CIGI_NO_EXCEPT
00449          if(Err == 1)
00450             throw CigiValueOutOfRangeException("Word",Word,0,1);
00451          else
00452             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00453 #endif
00454       }
00455 #endif
00456       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00457    }
00458 
00459 
00460    int bitPos = Pos * 16;
00461 
00462    Cigi_uint32 tDta = (Cigi_uint32)CompDataIn;
00463 
00464    CompData[Word] &= ~(0x0000ffff << bitPos);
00465    CompData[Word] |= ((tDta & 0x0000ffff) << bitPos);
00466 
00467    return(CIGI_SUCCESS);
00468 }

int CigiShortCompCtrlV3::SetCompData ( const Cigi_int8  CompDataIn,
const unsigned int  Word,
const BytePos  Pos,
bool  bndchk = true 
)

Sets the specified CompData with bound checking control

Parameters:
CompDataIn - The byte data
Word - The word position
Pos - The byte position
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 380 of file CigiShortCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00384 {
00385 
00386    union {
00387       Cigi_int8 sc;
00388       Cigi_uint8 uc;
00389    } bxfer;
00390 
00391    int Err = 0;
00392 
00393    if(Word > 1)
00394       Err = 1;
00395    else if((Pos < 0) || (Pos > 3))
00396       Err = 2;
00397 
00398    if(Err != 0)
00399    {
00400 #ifndef CIGI_NO_BND_CHK
00401       if(bndchk)
00402       {
00403 #ifndef CIGI_NO_EXCEPT
00404          if(Err == 1)
00405             throw CigiValueOutOfRangeException("Word",Word,0,1);
00406          else
00407             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00408 #endif
00409       }
00410 #endif
00411       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00412    }
00413 
00414 
00415    int bitPos = Pos * 8;
00416 
00417    bxfer.sc = CompDataIn;
00418    Cigi_uint32 tDta = (Cigi_uint32)bxfer.uc;
00419 
00420    CompData[Word] &= ~(0x000000ff << bitPos);
00421    CompData[Word] |= ((tDta & 0x000000ff) << bitPos);
00422 
00423    return(CIGI_SUCCESS);
00424 }

int CigiShortCompCtrlV3::SetCompData ( const Cigi_uint8  CompDataIn,
const unsigned int  Word,
const BytePos  Pos,
bool  bndchk = true 
)

Sets the specified CompData with bound checking control

Parameters:
CompDataIn - The byte data
Word - The word position
Pos - The byte position
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 336 of file CigiShortCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00340 {
00341 
00342    int Err = 0;
00343 
00344    if(Word > 1)
00345       Err = 1;
00346    else if((Pos < 0) || (Pos > 3))
00347       Err = 2;
00348 
00349    if(Err != 0)
00350    {
00351 #ifndef CIGI_NO_BND_CHK
00352       if(bndchk)
00353       {
00354 #ifndef CIGI_NO_EXCEPT
00355          if(Err == 1)
00356             throw CigiValueOutOfRangeException("Word",Word,0,1);
00357          else
00358             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00359 #endif
00360       }
00361 #endif
00362       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00363    }
00364 
00365 
00366    int bitPos = Pos * 8;
00367 
00368    Cigi_uint32 tDta = (Cigi_uint32)CompDataIn;
00369 
00370    CompData[Word] &= ~(0x000000ff << bitPos);
00371    CompData[Word] |= ((tDta & 0x000000ff) << bitPos);
00372 
00373    return(CIGI_SUCCESS);
00374 }

int CigiShortCompCtrlV3::SetCompState ( const Cigi_uint8  CompStateIn,
bool  bndchk = true 
) [inline]

Sets the CompState with bound checking control

Parameters:
CompStateIn - The state value
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 160 of file CigiShortCompCtrlV3.h.

References CIGI_SUCCESS.

00161    {
00162       CompState = (Cigi_uint16)CompStateIn;
00163       return(CIGI_SUCCESS);
00164    }

int CigiShortCompCtrlV3::SetInstanceID ( const Cigi_uint16  InstanceIDIn,
bool  bndchk = true 
) [inline]

Sets the InstanceID with bound checking control

Parameters:
InstanceIDIn -
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 139 of file CigiShortCompCtrlV3.h.

References CIGI_SUCCESS.

00140    {
00141       InstanceID = InstanceIDIn;
00142       return(CIGI_SUCCESS);
00143    }

int CigiShortCompCtrlV3::Unpack ( Cigi_uint8 Buff,
bool  Swap,
void *  Spec 
) [virtual]

The virtual Unpack function for CIGI 3

Parameters:
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.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Implements CigiBaseCompCtrl.

Definition at line 191 of file CigiShortCompCtrlV3.cpp.

References PackPointerUnion::c, CigiSwap2(), CigiSwap4(), CigiBaseCompCtrl::CompAssoc, CigiBaseCompCtrl::CompClassV2, CigiBaseCompCtrl::CompClassV3, CompClassV3xV1, CompClassV3xV2, CigiBaseCompCtrl::CompData, CigiBaseCompCtrl::CompID, CigiBaseCompCtrl::CompState, CigiBaseCompCtrl::EntityV3, CigiBaseCompCtrl::InstanceID, PackPointerUnion::l, CigiBaseCompCtrl::NoCnvtV1, CigiBaseCompCtrl::NoCnvtV2, CigiBasePacket::PacketSize, PackPointerUnion::s, and CigiBaseCompCtrl::SystemV3.

00192 {
00193    PackPointer CDta;
00194 
00195    CDta.c = Buff;
00196 
00197    CDta.c += 2;  // Step over packet id and size
00198 
00199    if(!Swap)
00200    {
00201       CompID = *CDta.s++;
00202       InstanceID = *CDta.s++;
00203 
00204       CompClassV3 = (CompClassV3Grp)(*CDta.c++ & 0x0f);
00205 
00206       CompState = (Cigi_uint16)*CDta.c++;
00207 
00208       CompData[0] = *CDta.l++;
00209       CompData[1] = *CDta.l++;
00210    }
00211    else
00212    {
00213       CigiSwap2(&CompID, CDta.s++);
00214       CigiSwap2(&InstanceID, CDta.s++);
00215 
00216       CompClassV3 = (CompClassV3Grp)(*CDta.c++ & 0x0f);
00217 
00218       CompState = (Cigi_uint16)*CDta.c++;
00219 
00220       CigiSwap4(&CompData[0], CDta.l++);
00221       CigiSwap4(&CompData[1], CDta.l++);
00222    }
00223 
00224 
00225    if((CompClassV3 >= CigiBaseCompCtrl::EntityV3) &&
00226       (CompClassV3 <= CigiBaseCompCtrl::SystemV3))
00227    {
00228       CompAssoc = CompClassV3xV1[CompClassV3];
00229       CompClassV2 = CompClassV3xV2[CompClassV3];
00230    }
00231    else
00232    {
00233       CompAssoc = CigiBaseCompCtrl::NoCnvtV1;
00234       CompClassV2 = CigiBaseCompCtrl::NoCnvtV2;
00235    }
00236 
00237    return(PacketSize);
00238 
00239 }


Member Data Documentation

const int CigiShortCompCtrlV3::CompClassCnvtSz = 14 [static, protected]

Definition at line 405 of file CigiShortCompCtrlV3.h.

const CigiBaseCompCtrl::CompAssocGrp CigiShortCompCtrlV3::CompClassV3xV1 [static, protected]

Initial value:

{
   Entity,  
   View,    
   NoCnvtV1, 
   NoCnvtV1,  
   NoCnvtV1,  
   NoCnvtV1,  
   NoCnvtV1,  
   NoCnvtV1,  
   NoCnvtV1,  
   NoCnvtV1,  
   Environment,  
   Environment,  
   NoCnvtV1,  
   NoCnvtV1   
}

Definition at line 406 of file CigiShortCompCtrlV3.h.

Referenced by SetCompClassV3(), and Unpack().

const CigiBaseCompCtrl::CompClassV2Grp CigiShortCompCtrlV3::CompClassV3xV2 [static, protected]

Initial value:

{
   EntityV2,  
   ViewV2,    
   ViewGrpV2, 
   SensorV2,  
   NoCnvtV2,  
   NoCnvtV2,  
   NoCnvtV2,  
   NoCnvtV2,  
   NoCnvtV2,  
   NoCnvtV2,  
   EnvironmentV2,  
   EnvironmentV2,  
   NoCnvtV2,  
   SystemV2   
}

Definition at line 407 of file CigiShortCompCtrlV3.h.

Referenced by SetCompClassV3(), and Unpack().


The documentation for this class was generated from the following files:
Generated on Wed Apr 29 09:00:10 2009 for CCL by  doxygen 1.4.7