CigiViewDefV1 Class Reference

#include <CigiViewDefV1.h>

Inheritance diagram for CigiViewDefV1:

CigiBaseViewDef CigiBasePacket List of all members.

Public Member Functions

 CigiViewDefV1 ()
virtual ~CigiViewDefV1 ()
virtual int Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const
virtual int Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec)
int SetViewID (const Cigi_uint8 ViewIDIn, bool bndchk=true)
Cigi_uint8 GetViewID (void) const
int SetGroupID (const Cigi_uint8 GroupIDIn, bool bndchk=true)
Cigi_uint8 GetGroupID (void) const
int SetTrackerAssigned (const bool TrackerAssignedIn, bool bndchk=true)
bool GetTrackerAssigned (void) const

Detailed Description

Definition at line 67 of file CigiViewDefV1.h.


Constructor & Destructor Documentation

CigiViewDefV1::CigiViewDefV1 (  ) 

General Constructor

Definition at line 84 of file CigiViewDefV1.cpp.

References CIGI_VIEW_DEF_PACKET_ID_V1, CIGI_VIEW_DEF_PACKET_SIZE_V1, CigiBaseViewDef::FOVBottom, CigiBaseViewDef::FOVBottomEn, CigiBaseViewDef::FOVFar, CigiBaseViewDef::FOVFarEn, CigiBaseViewDef::FOVLeft, CigiBaseViewDef::FOVLeftEn, CigiBaseViewDef::FOVNear, CigiBaseViewDef::FOVNearEn, CigiBaseViewDef::FOVRight, CigiBaseViewDef::FOVRightEn, CigiBaseViewDef::FOVTop, CigiBaseViewDef::FOVTopEn, CigiBaseViewDef::GroupID, CigiBasePacket::MinorVersion, CigiBaseViewDef::MirrorMode, CigiBaseViewDef::MirrorNone, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseViewDef::Perspective, CigiBaseViewDef::PixelReplicateMode, CigiBaseViewDef::ProjectionType, CigiBaseViewDef::Reorder, CigiBaseViewDef::ReplicateNone, CigiBaseViewDef::TrackerAssigned, CigiBasePacket::Version, CigiBaseViewDef::ViewID, and CigiBaseViewDef::ViewType.

00085 {
00086 
00087    PacketID = CIGI_VIEW_DEF_PACKET_ID_V1;
00088    PacketSize = CIGI_VIEW_DEF_PACKET_SIZE_V1;
00089    Version = 1;
00090    MinorVersion = 0;
00091 
00092    ViewID = 0;
00093    GroupID = 0;
00094    FOVNearEn = true;
00095    FOVFarEn = true;
00096    FOVLeftEn = true;
00097    FOVRightEn = true;
00098    FOVTopEn = true;
00099    FOVBottomEn = true;
00100    MirrorMode = MirrorNone;
00101    PixelReplicateMode = ReplicateNone;
00102    ProjectionType = Perspective;
00103    Reorder = false;
00104    ViewType = 0;
00105    TrackerAssigned = false;
00106    FOVNear = 0.0;
00107    FOVFar = 0.0;
00108    FOVLeft = 0.0;
00109    FOVRight = 0.0;
00110    FOVTop = 0.0;
00111    FOVBottom = 0.0;
00112 
00113 }

CigiViewDefV1::~CigiViewDefV1 (  )  [virtual]

General Destructor

Definition at line 118 of file CigiViewDefV1.cpp.

00119 {
00120 
00121 }


Member Function Documentation

Cigi_uint8 CigiViewDefV1::GetGroupID ( void   )  const [inline]

Gets the GroupID value.

Returns:
the current GroupID.

Definition at line 153 of file CigiViewDefV1.h.

00153 { return(GroupID); }

bool CigiViewDefV1::GetTrackerAssigned ( void   )  const [inline]

Gets the TrackerAssigned value.

Returns:
the current TrackerAssigned.

Definition at line 175 of file CigiViewDefV1.h.

00175 { return(TrackerAssigned); }

Cigi_uint8 CigiViewDefV1::GetViewID ( void   )  const [inline]

Gets the ViewID value.

Returns:
the current ViewID.

Definition at line 130 of file CigiViewDefV1.h.

00131    {
00132       if(ViewID < 31)
00133          return((Cigi_uint8)ViewID);
00134       else
00135          return((Cigi_uint8)0x1f);
00136    }

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

The virtual Pack function for CIGI 1

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 CigiBaseViewDef.

Definition at line 130 of file CigiViewDefV1.cpp.

References PackPointerUnion::c, CIGI_SCOPY4, CIGI_VIEW_DEF_PACKET_SIZE_V1, PackPointerUnion::d, PackPointerUnion::f, CigiBaseViewDef::FOVBottom, CigiBaseViewDef::FOVFar, CigiBaseViewDef::FOVLeft, CigiBaseViewDef::FOVNear, CigiBaseViewDef::FOVRight, CigiBaseViewDef::FOVTop, CigiBaseViewDef::GroupID, CigiBaseViewDef::MirrorMode, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseViewDef::PixelReplicateMode, PackPointerUnion::s, CigiBaseViewDef::TrackerAssigned, CigiBaseViewDef::ViewID, and CigiBaseViewDef::ViewType.

00131 {
00132    double DBuf[6];
00133 
00134    Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf;
00135 
00136    PackPointer CDta;
00137 
00138    CigiBaseViewDef * Data = ( CigiBaseViewDef *)Base;
00139 
00140    CDta.d = DBuf;
00141 
00142    *CDta.c++ = PacketID;
00143    *CDta.c++ = PacketSize;
00144 
00145    Cigi_uint8 HDta = 0;
00146    if(Data->ViewID < 32)
00147       HDta = (Cigi_uint8)(Data->ViewID << 3);
00148    else
00149       HDta = (Cigi_uint8)0xf8;
00150 
00151    if(Data->GroupID < 8)
00152       HDta |= (Cigi_uint8)Data->GroupID;
00153    else
00154       HDta |= 7;
00155 
00156    *CDta.c++ = HDta;
00157 
00158    HDta = (Data->ViewType << 5) & 0xe0;
00159    HDta |= (Cigi_uint8)((Data->PixelReplicateMode << 2) & 0x1c);
00160    HDta |= (Cigi_uint8)(Data->MirrorMode & 0x03);
00161 
00162    *CDta.c++ = HDta;
00163 
00164    HDta = 0;
00165    if(Data->TrackerAssigned)
00166       HDta = 0x80;
00167 
00168    *CDta.c++ = HDta;
00169    *CDta.c++ = 0;
00170    *CDta.s++ = 0;
00171 
00172    CIGI_SCOPY4(CDta.f++, &Data->FOVNear);
00173    CIGI_SCOPY4(CDta.f++, &Data->FOVFar);
00174    CIGI_SCOPY4(CDta.f++, &Data->FOVLeft);
00175    CIGI_SCOPY4(CDta.f++, &Data->FOVRight);
00176    CIGI_SCOPY4(CDta.f++, &Data->FOVTop);
00177    CIGI_SCOPY4(CDta.f++, &Data->FOVBottom);
00178 
00179    memcpy(Buff,tBuf,CIGI_VIEW_DEF_PACKET_SIZE_V1);
00180 
00181    return(PacketSize);
00182 
00183 }

int CigiViewDefV1::SetGroupID ( const Cigi_uint8  GroupIDIn,
bool  bndchk = true 
)

Sets the GroupID with bound checking control

Parameters:
GroupIDIn - The group in which this view is place.
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 261 of file CigiViewDefV1.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseViewDef::GroupID.

00262 {
00263 
00264 #ifndef CIGI_NO_BND_CHK
00265    if(bndchk && ((GroupIDIn < 0)||(GroupIDIn > 7)))
00266    {
00267 #ifndef CIGI_NO_EXCEPT
00268       throw CigiValueOutOfRangeException("GroupID",(Cigi_uint16)GroupIDIn,0,7);
00269 #endif
00270       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00271    }
00272 #endif
00273 
00274    GroupID = GroupIDIn;
00275    return(CIGI_SUCCESS);
00276 
00277 }

int CigiViewDefV1::SetTrackerAssigned ( const bool  TrackerAssignedIn,
bool  bndchk = true 
) [inline]

Sets the TrackerAssigned with bound checking control

Parameters:
TrackerAssignedIn - Specifies if there is a tracker assigned to this view.
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 166 of file CigiViewDefV1.h.

References CIGI_SUCCESS.

00167    {
00168       TrackerAssigned = TrackerAssignedIn;
00169       return(CIGI_SUCCESS);
00170    }

int CigiViewDefV1::SetViewID ( const Cigi_uint8  ViewIDIn,
bool  bndchk = true 
)

Sets the ViewID with bound checking control

Parameters:
ViewIDIn - The View this packet to which this packet 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 239 of file CigiViewDefV1.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseViewDef::ViewID.

00240 {
00241 
00242 #ifndef CIGI_NO_BND_CHK
00243    if(bndchk && ((ViewIDIn < 0)||(ViewIDIn > 31)))
00244    {
00245 #ifndef CIGI_NO_EXCEPT
00246       throw CigiValueOutOfRangeException("ViewID",(Cigi_uint16)ViewIDIn,0,31);
00247 #endif
00248       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00249    }
00250 #endif
00251 
00252    ViewID = (Cigi_uint16)ViewIDIn;
00253    return(CIGI_SUCCESS);
00254 
00255 }

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

The virtual Unpack function for CIGI 1

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 CigiBaseViewDef.

Definition at line 188 of file CigiViewDefV1.cpp.

References PackPointerUnion::c, CIGI_SCOPY4, CIGI_VIEW_DEF_PACKET_SIZE_V1, PackPointerUnion::d, PackPointerUnion::f, CigiBaseViewDef::FOVBottom, CigiBaseViewDef::FOVFar, CigiBaseViewDef::FOVLeft, CigiBaseViewDef::FOVNear, CigiBaseViewDef::FOVRight, CigiBaseViewDef::FOVTop, CigiBaseViewDef::GroupID, CigiBaseViewDef::MirrorMode, CigiBasePacket::PacketSize, CigiBaseViewDef::PixelReplicateMode, CigiBaseViewDef::TrackerAssigned, CigiBaseViewDef::ViewID, and CigiBaseViewDef::ViewType.

00189 {
00190    double DBuf[6];
00191 
00192    Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf;
00193 
00194    PackPointer CDta;
00195 
00196    memcpy(tBuf,Buff,CIGI_VIEW_DEF_PACKET_SIZE_V1);
00197 
00198    CDta.d = DBuf;
00199 
00200    CDta.c += 2;  // Step over packet id and size
00201 
00202    Cigi_uint8 HDta = *CDta.c++;
00203 
00204    ViewID = (Cigi_uint8)((HDta >> 3) & 0x1f);
00205    GroupID = (Cigi_uint8)(HDta & 0x07);
00206 
00207    HDta = *CDta.c++;
00208 
00209    ViewType = (Cigi_uint8)((HDta >> 5) & 0x07);
00210    PixelReplicateMode = (PixelReplicateModeGrp)((HDta >> 2) & 0x07);
00211    MirrorMode = (MirrorModeGrp)(HDta & 0x03);
00212 
00213    HDta = *CDta.c ++ & 0x80;
00214 
00215    TrackerAssigned = (HDta == 0) ? false : true;
00216 
00217    CDta.c += 3;
00218 
00219    CIGI_SCOPY4(&FOVNear, CDta.f++);
00220    CIGI_SCOPY4(&FOVFar, CDta.f++);
00221    CIGI_SCOPY4(&FOVLeft, CDta.f++);
00222    CIGI_SCOPY4(&FOVRight, CDta.f++);
00223    CIGI_SCOPY4(&FOVTop, CDta.f++);
00224    CIGI_SCOPY4(&FOVBottom, CDta.f++);
00225 
00226    return(PacketSize);
00227 
00228 }


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