CigiRateCtrlV3 Class Reference

#include <CigiRateCtrlV3.h>

Inheritance diagram for CigiRateCtrlV3:

CigiBaseRateCtrl CigiBasePacket List of all members.

Public Member Functions

 CigiRateCtrlV3 ()
virtual ~CigiRateCtrlV3 ()
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

Detailed Description

Definition at line 63 of file CigiRateCtrlV3.h.


Constructor & Destructor Documentation

CigiRateCtrlV3::CigiRateCtrlV3 (  ) 

General Constructor

Definition at line 73 of file CigiRateCtrlV3.cpp.

References CigiBaseRateCtrl::ApplyToArtPart, CigiBaseRateCtrl::ArtPartIDV1, CigiBaseRateCtrl::ArtPartIDV3, CIGI_RATE_CTRL_PACKET_ID_V3, CIGI_RATE_CTRL_PACKET_SIZE_V3, 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.

00074 {
00075 
00076    PacketID = CIGI_RATE_CTRL_PACKET_ID_V3;
00077    PacketSize = CIGI_RATE_CTRL_PACKET_SIZE_V3;
00078    Version = 3;
00079    MinorVersion = 0;
00080 
00081    EntityID = 0;
00082    ArtPartIDV1 = 0;
00083    ArtPartIDV3 = 0;
00084    ApplyToArtPart = false;
00085    CoordSys = Local;
00086    XRate = 0.0;
00087    YRate = 0.0;
00088    ZRate = 0.0;
00089    RollRate = 0.0;
00090    PitchRate = 0.0;
00091    YawRate = 0.0;
00092 
00093 }

CigiRateCtrlV3::~CigiRateCtrlV3 (  )  [virtual]

General Destructor

Definition at line 98 of file CigiRateCtrlV3.cpp.

00099 {
00100 
00101 }


Member Function Documentation

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

Gets the ApplyToArtPart value.

Returns:
the current ApplyToArtPart.

Definition at line 145 of file CigiRateCtrlV3.h.

00145 { return(ApplyToArtPart); }

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

Gets the ArtPartIDV3 value.

Returns:
the current ArtPartIDV3.

Definition at line 127 of file CigiRateCtrlV3.h.

00127 { return(ArtPartIDV3); }

int CigiRateCtrlV3::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 110 of file CigiRateCtrlV3.cpp.

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

00111 {
00112    PackPointer CDta;
00113 
00114    CigiBaseRateCtrl * Data = ( CigiBaseRateCtrl *)Base;
00115 
00116    CDta.c = Buff;
00117 
00118    *CDta.c++ = PacketID;
00119    *CDta.c++ = PacketSize;
00120 
00121    *CDta.s++ = Data->EntityID;
00122    *CDta.c++ = Data->ArtPartIDV3;
00123 
00124    Cigi_uint8 HDta = 0;
00125 
00126    if(Data->ApplyToArtPart)
00127       HDta = 0x01;
00128 
00129    *CDta.c++ = HDta;
00130    *CDta.s++ = 0;
00131 
00132    *CDta.f++ = Data->XRate;
00133    *CDta.f++ = Data->YRate;
00134    *CDta.f++ = Data->ZRate;
00135    *CDta.f++ = Data->RollRate;
00136    *CDta.f++ = Data->PitchRate;
00137    *CDta.f++ = Data->YawRate;
00138 
00139    return(PacketSize);
00140 
00141 }

int CigiRateCtrlV3::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 250 of file CigiRateCtrlV3.cpp.

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

00251 {
00252    union ArtPartConv
00253    {
00254       Cigi_uint8 uc;
00255       Cigi_int8 c;
00256    } ArtC;
00257 
00258    ApplyToArtPart = ApplyToArtPartIn;
00259 
00260    if(ApplyToArtPart)
00261    {
00262 
00263       ArtC.uc = ArtPartIDV3;
00264       ArtPartIDV1 = ArtC.c;
00265 
00266    }
00267    else
00268       ArtPartIDV1 = -1;
00269 
00270       return(CIGI_SUCCESS);
00271    }

int CigiRateCtrlV3::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 223 of file CigiRateCtrlV3.cpp.

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

00224 {
00225    union ArtPartConv
00226    {
00227       Cigi_uint8 uc;
00228       Cigi_int8 c;
00229    } ArtC;
00230 
00231    ArtPartIDV3 = ArtPartIDIn;
00232 
00233    if(ApplyToArtPart)
00234    {
00235 
00236       ArtC.uc = ArtPartIDV3;
00237       ArtPartIDV1 = ArtC.c;
00238 
00239    }
00240    else
00241       ArtPartIDV1 = -1;
00242 
00243 
00244    return(CIGI_SUCCESS);
00245 }

int CigiRateCtrlV3::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 146 of file CigiRateCtrlV3.cpp.

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

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


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