CigiCompCtrlV3 Class Reference

#include <CigiCompCtrlV3.h>

Inheritance diagram for CigiCompCtrlV3:

CigiBaseCompCtrl CigiBasePacket List of all members.

Public Member Functions

 CigiCompCtrlV3 ()
virtual ~CigiCompCtrlV3 ()
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 74 of file CigiCompCtrlV3.h.


Constructor & Destructor Documentation

CigiCompCtrlV3::CigiCompCtrlV3 (  ) 

General Constructor

Definition at line 125 of file CigiCompCtrlV3.cpp.

References CIGI_COMP_CTRL_PACKET_ID_V3, CIGI_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.

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

CigiCompCtrlV3::~CigiCompCtrlV3 (  )  [virtual]

General Destructor

Definition at line 153 of file CigiCompCtrlV3.cpp.

00154 {
00155 
00156 }


Member Function Documentation

Cigi_int8 CigiCompCtrlV3::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 744 of file CigiCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00746 {
00747    union {
00748       Cigi_int8 sc;
00749       Cigi_uint8 uc;
00750    } tDta;
00751 
00752    int Err = 0;
00753 
00754    if(Word > 5)
00755       Err = 1;
00756    else if((Pos < 0) || (Pos > 3))
00757       Err = 2;
00758 
00759    if(Err != 0)
00760    {
00761 #ifndef CIGI_NO_EXCEPT
00762       if(Err == 1)
00763          throw CigiValueOutOfRangeException("Word",Word,0,1);
00764       else
00765          throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00766 #endif
00767 
00768       tDta.uc = 0;
00769    }
00770    else
00771       tDta.uc = (Cigi_uint8)((CompData[Word] >> (Pos * 8)) & 0x000000ff);
00772 
00773    return(tDta.sc);
00774 }

int CigiCompCtrlV3::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 261 of file CigiCompCtrlV3.cpp.

References CIGI_COMP_CTRL_PACKET_ID_V1, CIGI_COMP_CTRL_PACKET_ID_V2, CIGI_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.

00263 {
00264    // Do not convert unless a conversion is found
00265    CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcNone;
00266    CnvtInfo.CnvtPacketID = 0;
00267 
00268    if(CnvtVersion.CigiMajorVersion == 3)
00269    {
00270       // All Component control packets from version 3 and above
00271       //  use the same packet id number
00272 
00273       if(CnvtVersion.CigiMinorVersion < 3)
00274       {
00275          if((CompClassV3 >= EntityV3)&&(CompClassV3 <= SystemV3))
00276          {
00277             CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00278             CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V3;
00279          }
00280       }
00281       else
00282       {
00283          CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00284          CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V3;
00285       }
00286    }
00287    else if(CnvtVersion.CigiMajorVersion == 2)
00288    {
00289       if((CompClassV2 >= EntityV2)&&(CompClassV2 <= SystemV2))
00290       {
00291          CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00292          CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V2;
00293       }
00294    }
00295    else if(CnvtVersion.CigiMajorVersion == 1)
00296    {
00297       if((CompAssoc >= Entity)&&(CompAssoc <= View))
00298       {
00299          CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00300          CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V1;
00301       }
00302    }
00303    else
00304    {
00305       // All Component control packets from version 3 and above
00306       //  use the same packet id number
00307       CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00308       CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V3;
00309    }
00310 
00311    return(CIGI_SUCCESS);
00312 }

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

Gets the CompClassV3 value.

Returns:
the current CompClassV3.

Definition at line 212 of file CigiCompCtrlV3.h.

00212 { return(CompClassV3); }

Cigi_uint8 CigiCompCtrlV3::GetCompState ( void   )  [inline]

Gets the CompState value.

Returns:
the current CompState.

Definition at line 177 of file CigiCompCtrlV3.h.

00178    {
00179       Cigi_uint8 V3State = (Cigi_uint8)((CompState > 0x00ff) ? 0xff : CompState);
00180       return(V3State);
00181    }

double CigiCompCtrlV3::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 962 of file CigiCompCtrlV3.cpp.

References _I64_CONST_, and CigiBaseCompCtrl::CompData.

00963 {
00964 
00965    Cigi_uint64 tDta;
00966 
00967    union DtaXfer {
00968       Cigi_uint64 i;
00969       double d;
00970    } XDta;
00971 
00972    if(Pos > 2)
00973    {
00974 #ifndef CIGI_NO_EXCEPT
00975       throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00976 #endif
00977 
00978       tDta = 0;
00979    }
00980    else
00981    {
00982 
00983       int Word = Pos * 2;
00984       Cigi_uint64 tDtah = (Cigi_uint64)(CompData[Word++]);
00985       tDtah = (tDtah << 32) & _I64_CONST_(0xffffffff00000000);
00986 
00987       Cigi_uint64 tDtal = (Cigi_uint64)(CompData[Word]);
00988       tDtal &= _I64_CONST_(0x00000000ffffffff);
00989 
00990       tDta = tDtah | tDtal;
00991 
00992       XDta.i = tDta;
00993    }
00994 
00995    return(XDta.d);
00996 }

float CigiCompCtrlV3::GetFloatCompData ( const unsigned int  Word  ) 

Gets the specified CompData

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

Definition at line 901 of file CigiCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00902 {
00903 
00904    union {
00905       float f32;
00906       Cigi_uint32 u32;
00907    } tDta;
00908 
00909    if(Word > 5)
00910    {
00911 #ifndef CIGI_NO_EXCEPT
00912       throw CigiValueOutOfRangeException("Word",Word,0,1);
00913 #endif
00914 
00915       tDta.u32 = 0;
00916    }
00917    else
00918       tDta.u32 = (Cigi_uint32)(CompData[Word]);
00919 
00920    return(tDta.f32);
00921 }

Cigi_uint64 CigiCompCtrlV3::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 928 of file CigiCompCtrlV3.cpp.

References _I64_CONST_, and CigiBaseCompCtrl::CompData.

00929 {
00930 
00931    Cigi_uint64 tDta;
00932 
00933    if(Pos > 2)
00934    {
00935 #ifndef CIGI_NO_EXCEPT
00936       throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00937 #endif
00938 
00939       tDta = 0;
00940    }
00941    else
00942    {
00943       int Word = Pos * 2;
00944       Cigi_uint64 tDtah = (Cigi_uint64)(CompData[Word++]);
00945       tDtah = (tDtah << 32) & _I64_CONST_(0xffffffff00000000);
00946 
00947       Cigi_uint64 tDtal = (Cigi_uint64)(CompData[Word]);
00948       tDtal &= _I64_CONST_(0x00000000ffffffff);
00949 
00950       tDta = tDtah | tDtal;
00951    }
00952 
00953 
00954    return(tDta);
00955 }

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

Gets the InstanceID value.

Returns:
the current InstanceID.

Definition at line 156 of file CigiCompCtrlV3.h.

00156 { return(InstanceID); }

Cigi_int32 CigiCompCtrlV3::GetLongCompData ( const unsigned int  Word  ) 

Gets the specified CompData

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

Definition at line 874 of file CigiCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00875 {
00876 
00877    union {
00878       Cigi_int32 s32;
00879       Cigi_uint32 u32;
00880    } tDta;
00881 
00882    if(Word > 5)
00883    {
00884 #ifndef CIGI_NO_EXCEPT
00885       throw CigiValueOutOfRangeException("Word",Word,0,1);
00886 #endif
00887 
00888       tDta.u32 = 0;
00889    }
00890    else
00891       tDta.u32 = (Cigi_uint32)(CompData[Word]);
00892 
00893    return(tDta.s32);
00894 }

Cigi_int16 CigiCompCtrlV3::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 813 of file CigiCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00815 {
00816    union {
00817       Cigi_int16 s16;
00818       Cigi_uint16 u16;
00819    } tDta;
00820 
00821    int Err = 0;
00822 
00823    if(Word > 5)
00824       Err = 1;
00825    else if((Pos < 0) || (Pos > 1))
00826       Err = 2;
00827 
00828    if(Err != 0)
00829    {
00830 #ifndef CIGI_NO_EXCEPT
00831       if(Err == 1)
00832          throw CigiValueOutOfRangeException("Word",Word,0,1);
00833       else
00834          throw CigiValueOutOfRangeException("Pos",Pos,0,1);
00835 #endif
00836 
00837       tDta.u16 = 0;
00838    }
00839    else
00840       tDta.u16 = (Cigi_uint16)((CompData[Word] >> (Pos * 16)) & 0x0000ffff);
00841 
00842    return(tDta.s16);
00843 }

Cigi_uint8 CigiCompCtrlV3::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 710 of file CigiCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00712 {
00713 
00714    Cigi_uint8 tDta;
00715 
00716    int Err = 0;
00717 
00718    if(Word > 5)
00719       Err = 1;
00720    else if((Pos < 0) || (Pos > 3))
00721       Err = 2;
00722 
00723    if(Err != 0)
00724    {
00725 #ifndef CIGI_NO_EXCEPT
00726       if(Err == 1)
00727          throw CigiValueOutOfRangeException("Word",Word,0,1);
00728       else
00729          throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00730 #endif
00731 
00732       tDta = 0;
00733    }
00734    else
00735       tDta = (Cigi_uint8)((CompData[Word] >> (Pos * 8)) & 0x000000ff);
00736 
00737    return(tDta);
00738 }

Cigi_uint32 CigiCompCtrlV3::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 849 of file CigiCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00850 {
00851 
00852    Cigi_uint32 tDta;
00853 
00854 
00855    if(Word > 5)
00856    {
00857 #ifndef CIGI_NO_EXCEPT
00858       throw CigiValueOutOfRangeException("Word",Word,0,1);
00859 #endif
00860 
00861       tDta = 0;
00862    }
00863    else
00864       tDta = CompData[Word];
00865 
00866    return(tDta);
00867 }

Cigi_uint16 CigiCompCtrlV3::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 780 of file CigiCompCtrlV3.cpp.

References CigiBaseCompCtrl::CompData.

00782 {
00783    Cigi_uint16 tDta;
00784 
00785    int Err = 0;
00786 
00787    if(Word > 5)
00788       Err = 1;
00789    else if((Pos < 0) || (Pos > 1))
00790       Err = 2;
00791 
00792    if(Err != 0)
00793    {
00794 #ifndef CIGI_NO_EXCEPT
00795       if(Err == 1)
00796          throw CigiValueOutOfRangeException("Word",Word,0,1);
00797       else
00798          throw CigiValueOutOfRangeException("Pos",Pos,0,1);
00799 #endif
00800 
00801       tDta = 0;
00802    }
00803    else
00804       tDta = (Cigi_uint16)((CompData[Word] >> (Pos * 16)) & 0x0000ffff);
00805 
00806    return(tDta);
00807 }

int CigiCompCtrlV3::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 165 of file CigiCompCtrlV3.cpp.

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

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

int CigiCompCtrlV3::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 324 of file CigiCompCtrlV3.cpp.

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

00325 {
00326 
00327 #ifndef CIGI_NO_BND_CHK
00328    if(bndchk && ((CompClassV3In < 0)||(CompClassV3In > 13)))
00329    {
00330 #ifndef CIGI_NO_EXCEPT
00331       throw CigiValueOutOfRangeException("CompClassV3",(CompClassV3Grp)CompClassV3In,0,13);
00332 #endif
00333       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00334    }
00335 #endif
00336 
00337    CompClassV3 = CompClassV3In;
00338 
00339    CompAssoc = CompClassV3xV1[CompClassV3];
00340    CompClassV2 = CompClassV3xV2[CompClassV3];
00341 
00342    return(CIGI_SUCCESS);
00343 
00344 }

int CigiCompCtrlV3::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 667 of file CigiCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00670 {
00671 
00672    if(Pos > 2)
00673    {
00674 #ifndef CIGI_NO_BND_CHK
00675       if(bndchk)
00676       {
00677 #ifndef CIGI_NO_EXCEPT
00678          throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00679 #endif
00680       }
00681 #endif
00682       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00683    }
00684 
00685    union DtaXfer {
00686       Cigi_uint64 i;
00687       double d;
00688    } XDta;
00689 
00690    XDta.d = CompDataIn;
00691 
00692    int Word = Pos * 2;
00693 
00694    CompData[Word++] = (Cigi_uint32)((XDta.i >> 32) & 0x00000000ffffffff);
00695    CompData[Word] = (Cigi_uint32)(XDta.i & 0x00000000ffffffff);
00696 
00697 
00698    return(CIGI_SUCCESS);
00699 }

int CigiCompCtrlV3::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 636 of file CigiCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00639 {
00640 
00641    if(Pos > 2)
00642    {
00643 #ifndef CIGI_NO_BND_CHK
00644       if(bndchk)
00645       {
00646 #ifndef CIGI_NO_EXCEPT
00647          throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00648 #endif
00649       }
00650 #endif
00651       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00652    }
00653 
00654 
00655    int Word = Pos * 2;
00656 
00657    CompData[Word++] = (Cigi_uint32)((CompDataIn >> 32) & 0x00000000ffffffff);
00658    CompData[Word] = (Cigi_uint32)(CompDataIn & 0x00000000ffffffff);
00659 
00660    return(CIGI_SUCCESS);
00661 }

int CigiCompCtrlV3::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 602 of file CigiCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00605 {
00606 
00607    if(Word > 5)
00608    {
00609 #ifndef CIGI_NO_BND_CHK
00610       if(bndchk)
00611       {
00612 #ifndef CIGI_NO_EXCEPT
00613          throw CigiValueOutOfRangeException("Word",Word,0,1);
00614 #endif
00615       }
00616 #endif
00617       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00618    }
00619 
00620 
00621    union DtaXfer {
00622       Cigi_uint32 lDta;
00623       float fDta;
00624    } XDta;
00625 
00626    XDta.fDta = CompDataIn;
00627    CompData[Word] = XDta.lDta;
00628 
00629    return(CIGI_SUCCESS);
00630 }

int CigiCompCtrlV3::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 568 of file CigiCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00571 {
00572 
00573    union {
00574       Cigi_int32 s32;
00575       Cigi_uint32 u32;
00576    } tDta;
00577 
00578    if(Word > 5)
00579    {
00580 #ifndef CIGI_NO_BND_CHK
00581       if(bndchk)
00582       {
00583 #ifndef CIGI_NO_EXCEPT
00584          throw CigiValueOutOfRangeException("Word",Word,0,1);
00585 #endif
00586       }
00587 #endif
00588       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00589    }
00590 
00591 
00592    tDta.s32 = CompDataIn;
00593    CompData[Word] = (Cigi_uint32)tDta.u32;
00594 
00595    return(CIGI_SUCCESS);
00596 }

int CigiCompCtrlV3::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 540 of file CigiCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00543 {
00544 
00545    if(Word > 5)
00546    {
00547 #ifndef CIGI_NO_BND_CHK
00548       if(bndchk)
00549       {
00550 #ifndef CIGI_NO_EXCEPT
00551          throw CigiValueOutOfRangeException("Word",Word,0,1);
00552 #endif
00553       }
00554 #endif
00555       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00556    }
00557 
00558 
00559    CompData[Word] = CompDataIn;
00560 
00561    return(CIGI_SUCCESS);
00562 }

int CigiCompCtrlV3::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 490 of file CigiCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00494 {
00495 
00496    union {
00497       Cigi_int16 s16;
00498       Cigi_uint16 u16;
00499    } sxfer;
00500 
00501    int Err = 0;
00502 
00503    if(Word > 5)
00504       Err = 1;
00505    else if((Pos < 0) || (Pos > 1))
00506       Err = 2;
00507 
00508    if(Err != 0)
00509    {
00510 #ifndef CIGI_NO_BND_CHK
00511       if(bndchk)
00512       {
00513 #ifndef CIGI_NO_EXCEPT
00514          if(Err == 1)
00515             throw CigiValueOutOfRangeException("Word",Word,0,1);
00516          else
00517             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00518 #endif
00519       }
00520 #endif
00521       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00522    }
00523 
00524 
00525    int bitPos = Pos * 16;
00526 
00527    sxfer.s16 = CompDataIn;
00528    Cigi_uint32 tDta = (Cigi_uint32)sxfer.u16;
00529 
00530    CompData[Word] &= ~(0x0000ffff << bitPos);
00531    CompData[Word] |= ((tDta & 0x0000ffff) << bitPos);
00532 
00533    return(CIGI_SUCCESS);
00534 }

int CigiCompCtrlV3::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 446 of file CigiCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00450 {
00451 
00452    int Err = 0;
00453 
00454    if(Word > 5)
00455       Err = 1;
00456    else if((Pos < 0) || (Pos > 1))
00457       Err = 2;
00458 
00459    if(Err != 0)
00460    {
00461 #ifndef CIGI_NO_BND_CHK
00462       if(bndchk)
00463       {
00464 #ifndef CIGI_NO_EXCEPT
00465          if(Err == 1)
00466             throw CigiValueOutOfRangeException("Word",Word,0,1);
00467          else
00468             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00469 #endif
00470       }
00471 #endif
00472       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00473    }
00474 
00475 
00476    int bitPos = Pos * 16;
00477 
00478    Cigi_uint32 tDta = (Cigi_uint32)CompDataIn;
00479 
00480    CompData[Word] &= ~(0x0000ffff << bitPos);
00481    CompData[Word] |= ((tDta & 0x0000ffff) << bitPos);
00482 
00483    return(CIGI_SUCCESS);
00484 }

int CigiCompCtrlV3::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 396 of file CigiCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00400 {
00401 
00402    union {
00403       Cigi_int8 sc;
00404       Cigi_uint8 uc;
00405    } cxfer;
00406 
00407    int Err = 0;
00408 
00409    if(Word > 5)
00410       Err = 1;
00411    else if((Pos < 0) || (Pos > 3))
00412       Err = 2;
00413 
00414    if(Err != 0)
00415    {
00416 #ifndef CIGI_NO_BND_CHK
00417       if(bndchk)
00418       {
00419 #ifndef CIGI_NO_EXCEPT
00420          if(Err == 1)
00421             throw CigiValueOutOfRangeException("Word",Word,0,1);
00422          else
00423             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00424 #endif
00425       }
00426 #endif
00427       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00428    }
00429 
00430 
00431    int bitPos = Pos * 8;
00432 
00433    cxfer.sc = CompDataIn;
00434    Cigi_uint32 tDta = (Cigi_uint32)cxfer.uc;
00435 
00436    CompData[Word] &= ~(0x000000ff << bitPos);
00437    CompData[Word] |= ((tDta & 0x000000ff) << bitPos);
00438 
00439    return(CIGI_SUCCESS);
00440 }

int CigiCompCtrlV3::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 352 of file CigiCompCtrlV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseCompCtrl::CompData.

00356 {
00357 
00358    int Err = 0;
00359 
00360    if(Word > 5)
00361       Err = 1;
00362    else if((Pos < 0) || (Pos > 3))
00363       Err = 2;
00364 
00365    if(Err != 0)
00366    {
00367 #ifndef CIGI_NO_BND_CHK
00368       if(bndchk)
00369       {
00370 #ifndef CIGI_NO_EXCEPT
00371          if(Err == 1)
00372             throw CigiValueOutOfRangeException("Word",Word,0,1);
00373          else
00374             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00375 #endif
00376       }
00377 #endif
00378       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00379    }
00380 
00381 
00382    int bitPos = Pos * 8;
00383 
00384    Cigi_uint32 tDta = (Cigi_uint32)CompDataIn;
00385 
00386    CompData[Word] &= ~(0x000000ff << bitPos);
00387    CompData[Word] |= ((tDta & 0x000000ff) << bitPos);
00388 
00389    return(CIGI_SUCCESS);
00390 }

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

Sets the CompState with bound checking control

Parameters:
CompStateIn - Component 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 168 of file CigiCompCtrlV3.h.

References CIGI_SUCCESS.

00169    {
00170       CompState = (Cigi_uint16) CompStateIn;
00171       return(CIGI_SUCCESS);
00172    }

int CigiCompCtrlV3::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 147 of file CigiCompCtrlV3.h.

References CIGI_SUCCESS.

00148    {
00149       InstanceID = InstanceIDIn;
00150       return(CIGI_SUCCESS);
00151    }

int CigiCompCtrlV3::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 198 of file CigiCompCtrlV3.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.

00199 {
00200    PackPointer CDta;
00201 
00202    CDta.c = Buff;
00203 
00204    CDta.c += 2;  // Step over packet id and size
00205 
00206    if(!Swap)
00207    {
00208       CompID = *CDta.s++;
00209       InstanceID = *CDta.s++;
00210 
00211       CompClassV3 = (CompClassV3Grp)(*CDta.c++ & 0x0f);
00212 
00213       CompState = (Cigi_uint16)*CDta.c++;
00214 
00215       CompData[0] = *CDta.l++;
00216       CompData[1] = *CDta.l++;
00217       CompData[2] = *CDta.l++;
00218       CompData[3] = *CDta.l++;
00219       CompData[4] = *CDta.l++;
00220       CompData[5] = *CDta.l++;
00221    }
00222    else
00223    {
00224       CigiSwap2(&CompID, CDta.s++);
00225       CigiSwap2(&InstanceID, CDta.s++);
00226 
00227       CompClassV3 = (CompClassV3Grp)(*CDta.c++ & 0x0f);
00228 
00229       CompState = (Cigi_uint16)*CDta.c++;
00230 
00231       CigiSwap4(&CompData[0], CDta.l++);
00232       CigiSwap4(&CompData[1], CDta.l++);
00233       CigiSwap4(&CompData[2], CDta.l++);
00234       CigiSwap4(&CompData[3], CDta.l++);
00235       CigiSwap4(&CompData[4], CDta.l++);
00236       CigiSwap4(&CompData[5], CDta.l++);
00237    }
00238 
00239 
00240    if((CompClassV3 >= CigiBaseCompCtrl::EntityV3) &&
00241       (CompClassV3 <= CigiBaseCompCtrl::SystemV3))
00242    {
00243       CompAssoc = CompClassV3xV1[CompClassV3];
00244       CompClassV2 = CompClassV3xV2[CompClassV3];
00245    }
00246    else
00247    {
00248       CompAssoc = CigiBaseCompCtrl::NoCnvtV1;
00249       CompClassV2 = CigiBaseCompCtrl::NoCnvtV2;
00250    }
00251 
00252 
00253    return(PacketSize);
00254 
00255 }


Member Data Documentation

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

Definition at line 411 of file CigiCompCtrlV3.h.

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

Initial value:

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

Definition at line 412 of file CigiCompCtrlV3.h.

Referenced by SetCompClassV3(), and Unpack().

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

Initial value:

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

Definition at line 413 of file CigiCompCtrlV3.h.

Referenced by SetCompClassV3(), and Unpack().


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