CigiRateCtrlV3_2 Class Reference

#include <CigiRateCtrlV3_2.h>

Inheritance diagram for CigiRateCtrlV3_2:

CigiBaseRateCtrl CigiBasePacket List of all members.

Public Member Functions

 CigiRateCtrlV3_2 ()
virtual ~CigiRateCtrlV3_2 ()
virtual int Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const
virtual int Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec)
int SetArtPartID (const Cigi_uint8 ArtPartIDIn, bool bndchk=true)
Cigi_uint8 GetArtPartID (void) const
int SetApplyToArtPart (const bool ApplyToArtPartIn, bool bndchk=true)
bool GetApplyToArtPart (void) const
int SetCoordSys (const CoordSysGrp CoordSysIn, bool bndchk=true)
CoordSysGrp GetCoordSys (void) const

Detailed Description

Definition at line 56 of file CigiRateCtrlV3_2.h.


Constructor & Destructor Documentation

CigiRateCtrlV3_2::CigiRateCtrlV3_2 (  ) 

General Constructor

Definition at line 61 of file CigiRateCtrlV3_2.cpp.

References CigiBaseRateCtrl::ApplyToArtPart, CigiBaseRateCtrl::ArtPartIDV1, CigiBaseRateCtrl::ArtPartIDV3, CIGI_RATE_CTRL_PACKET_ID_V3_2, CIGI_RATE_CTRL_PACKET_SIZE_V3_2, CigiBaseRateCtrl::CoordSys, CigiBaseRateCtrl::EntityID, CigiBaseRateCtrl::Local, CigiBasePacket::MinorVersion, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseRateCtrl::PitchRate, CigiBaseRateCtrl::RollRate, CigiBasePacket::Version, CigiBaseRateCtrl::XRate, CigiBaseRateCtrl::YawRate, CigiBaseRateCtrl::YRate, and CigiBaseRateCtrl::ZRate.

00062 {
00063 
00064    PacketID = CIGI_RATE_CTRL_PACKET_ID_V3_2;
00065    PacketSize = CIGI_RATE_CTRL_PACKET_SIZE_V3_2;
00066    Version = 3;
00067    MinorVersion = 2;
00068 
00069    EntityID = 0;
00070    ArtPartIDV1 = 0;
00071    ArtPartIDV3 = 0;
00072    ApplyToArtPart = false;
00073    CoordSys = Local;
00074    XRate = 0.0;
00075    YRate = 0.0;
00076    ZRate = 0.0;
00077    RollRate = 0.0;
00078    PitchRate = 0.0;
00079    YawRate = 0.0;
00080 
00081 }

CigiRateCtrlV3_2::~CigiRateCtrlV3_2 (  )  [virtual]

General Destructor

Definition at line 86 of file CigiRateCtrlV3_2.cpp.

00087 {
00088 
00089 }


Member Function Documentation

bool CigiRateCtrlV3_2::GetApplyToArtPart ( void   )  const [inline]

Gets the ApplyToArtPart value.

Returns:
the current ApplyToArtPart.

Definition at line 138 of file CigiRateCtrlV3_2.h.

00138 { return(ApplyToArtPart); }

Cigi_uint8 CigiRateCtrlV3_2::GetArtPartID ( void   )  const [inline]

Gets the ArtPartIDV3 value.

Returns:
the current ArtPartIDV3.

Definition at line 120 of file CigiRateCtrlV3_2.h.

00120 { return(ArtPartIDV3); }

CoordSysGrp CigiRateCtrlV3_2::GetCoordSys ( void   )  const [inline]

Gets the Coordinate System value.

Returns:
the current Coordinate System being used for rates.

Definition at line 156 of file CigiRateCtrlV3_2.h.

00156 { return(CoordSys); }

int CigiRateCtrlV3_2::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 CigiBaseRateCtrl.

Definition at line 98 of file CigiRateCtrlV3_2.cpp.

References CigiBaseRateCtrl::ApplyToArtPart, CigiBaseRateCtrl::ArtPartIDV3, PackPointerUnion::c, CigiBaseRateCtrl::CoordSys, CigiBaseRateCtrl::EntityID, PackPointerUnion::f, CigiBaseRateCtrl::Local, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseRateCtrl::PitchRate, CigiBaseRateCtrl::RollRate, PackPointerUnion::s, CigiBaseRateCtrl::XRate, CigiBaseRateCtrl::YawRate, CigiBaseRateCtrl::YRate, and CigiBaseRateCtrl::ZRate.

00099 {
00100    PackPointer CDta;
00101 
00102    CigiBaseRateCtrl * Data = ( CigiBaseRateCtrl *)Base;
00103 
00104    CDta.c = Buff;
00105 
00106    *CDta.c++ = PacketID;
00107    *CDta.c++ = PacketSize;
00108 
00109    *CDta.s++ = Data->EntityID;
00110    *CDta.c++ = Data->ArtPartIDV3;
00111 
00112    Cigi_uint8 HDta = 0;
00113 
00114    if(Data->ApplyToArtPart)
00115       HDta = 0x01;
00116    
00117    if(Data->CoordSys == Local)
00118       HDta |= 0x02;
00119 
00120    *CDta.c++ = HDta;
00121    *CDta.s++ = 0;
00122 
00123    *CDta.f++ = Data->XRate;
00124    *CDta.f++ = Data->YRate;
00125    *CDta.f++ = Data->ZRate;
00126    *CDta.f++ = Data->RollRate;
00127    *CDta.f++ = Data->PitchRate;
00128    *CDta.f++ = Data->YawRate;
00129 
00130    return(PacketSize);
00131 
00132 }

int CigiRateCtrlV3_2::SetApplyToArtPart ( const bool  ApplyToArtPartIn,
bool  bndchk = true 
)

Sets the ApplyToArtPart with bound checking control

Parameters:
ApplyToArtPartIn - Specifies whether this data is to be applied to an articulated part or an entity.
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 242 of file CigiRateCtrlV3_2.cpp.

References CigiBaseRateCtrl::ApplyToArtPart, CigiBaseRateCtrl::ArtPartIDV1, CigiBaseRateCtrl::ArtPartIDV3, and CIGI_SUCCESS.

00243 {
00244    union ArtPartConv
00245    {
00246       Cigi_uint8 uc;
00247       Cigi_int8 c;
00248    } ArtC;
00249 
00250    ApplyToArtPart = ApplyToArtPartIn;
00251 
00252    if(ApplyToArtPart)
00253    {
00254 
00255       ArtC.uc = ArtPartIDV3;
00256       ArtPartIDV1 = ArtC.c;
00257 
00258    }
00259    else
00260       ArtPartIDV1 = -1;
00261 
00262       return(CIGI_SUCCESS);
00263    }

int CigiRateCtrlV3_2::SetArtPartID ( const Cigi_uint8  ArtPartIDIn,
bool  bndchk = true 
)

Sets the ArtPartIDV3 with bound checking control

Parameters:
ArtPartIDIn - Specifies the art part to which this packet's data is applied.
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 215 of file CigiRateCtrlV3_2.cpp.

References CigiBaseRateCtrl::ApplyToArtPart, CigiBaseRateCtrl::ArtPartIDV1, CigiBaseRateCtrl::ArtPartIDV3, and CIGI_SUCCESS.

00216 {
00217    union ArtPartConv
00218    {
00219       Cigi_uint8 uc;
00220       Cigi_int8 c;
00221    } ArtC;
00222 
00223    ArtPartIDV3 = ArtPartIDIn;
00224 
00225    if(ApplyToArtPart)
00226    {
00227 
00228       ArtC.uc = ArtPartIDV3;
00229       ArtPartIDV1 = ArtC.c;
00230 
00231    }
00232    else
00233       ArtPartIDV1 = -1;
00234 
00235 
00236    return(CIGI_SUCCESS);
00237 }

int CigiRateCtrlV3_2::SetCoordSys ( const CoordSysGrp  CoordSysIn,
bool  bndchk = true 
)

Sets the Coordinate System with bound checking control

Parameters:
CoordSysIn - Specifies the coordinate system in which the rates are applied.
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 269 of file CigiRateCtrlV3_2.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseRateCtrl::CoordSys.

00270 {
00271 
00272 #ifndef CIGI_NO_BND_CHK
00273    if(bndchk && ((CoordSysIn < 0)||(CoordSysIn > 1)))
00274    {
00275 #ifndef CIGI_NO_EXCEPT
00276       throw CigiValueOutOfRangeException("CoordSys",(CoordSysGrp)CoordSysIn,0,1);
00277 #endif
00278       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00279    }
00280 #endif
00281 
00282    CoordSys = CoordSysIn;
00283 
00284    return(CIGI_SUCCESS);
00285 
00286 }

int CigiRateCtrlV3_2::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 CigiBaseRateCtrl.

Definition at line 137 of file CigiRateCtrlV3_2.cpp.

References CigiBaseRateCtrl::ApplyToArtPart, CigiBaseRateCtrl::ArtPartIDV1, CigiBaseRateCtrl::ArtPartIDV3, PackPointerUnion::c, CigiSwap2(), CigiSwap4(), CigiBaseRateCtrl::CoordSys, CigiBaseRateCtrl::EntityID, PackPointerUnion::f, CigiBasePacket::PacketSize, CigiBaseRateCtrl::PitchRate, CigiBaseRateCtrl::RollRate, PackPointerUnion::s, CigiBaseRateCtrl::XRate, CigiBaseRateCtrl::YawRate, CigiBaseRateCtrl::YRate, and CigiBaseRateCtrl::ZRate.

00138 {
00139    union ArtPartConv
00140    {
00141       Cigi_uint8 uc;
00142       Cigi_int8 c;
00143    } ArtC;
00144 
00145    PackPointer CDta;
00146 
00147    CDta.c = Buff;
00148 
00149    CDta.c += 2;  // Step over packet id and size
00150 
00151    if(!Swap)
00152    {
00153       EntityID = *CDta.s++;
00154       ArtPartIDV3 = *CDta.c++;
00155 
00156       Cigi_uint16 HDta = *CDta.c++;
00157 
00158       ApplyToArtPart = ((HDta & 0x01) != 0);
00159       CoordSys = (CoordSysGrp)((HDta >> 1) & 0x01);
00160 
00161       CDta.s++;
00162 
00163       XRate = *CDta.f++;
00164       YRate = *CDta.f++;
00165       ZRate = *CDta.f++;
00166       RollRate = *CDta.f++;
00167       PitchRate = *CDta.f++;
00168       YawRate = *CDta.f++;
00169    }
00170    else
00171    {
00172       CigiSwap2(&EntityID, CDta.s++);
00173       ArtPartIDV3 = *CDta.c++;
00174 
00175       Cigi_uint16 HDta = *CDta.c++;
00176 
00177       ApplyToArtPart = ((HDta & 0x01) != 0);
00178       CoordSys = (CoordSysGrp)((HDta >> 1) & 0x01);
00179 
00180       CDta.s++;
00181 
00182       CigiSwap4(&XRate, CDta.f++);
00183       CigiSwap4(&YRate, CDta.f++);
00184       CigiSwap4(&ZRate, CDta.f++);
00185       CigiSwap4(&RollRate, CDta.f++);
00186       CigiSwap4(&PitchRate, CDta.f++);
00187       CigiSwap4(&YawRate, CDta.f++);
00188    }
00189 
00190    if(ApplyToArtPart)
00191    {
00192 
00193       ArtC.uc = ArtPartIDV3;
00194       ArtPartIDV1 = ArtC.c;
00195 
00196    }
00197    else
00198       ArtPartIDV1 = -1;
00199 
00200 
00201    return(PacketSize);
00202 
00203 }


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