CigiHatHotRespV3 Class Reference

#include <CigiHatHotRespV3.h>

Inheritance diagram for CigiHatHotRespV3:

CigiBaseHatHotResp CigiBasePacket List of all members.

Public Member Functions

 CigiHatHotRespV3 ()
virtual ~CigiHatHotRespV3 ()
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 SetReqType (const ReqTypeGrp ReqTypeIn, bool bndchk=true)
ReqTypeGrp GetReqType (void) const
int SetHat (const double HatIn, bool bndchk=true)
double GetHat (void) const
int SetHot (const double HotIn, bool bndchk=true)
double GetHot (void) const

Detailed Description

Definition at line 59 of file CigiHatHotRespV3.h.


Constructor & Destructor Documentation

CigiHatHotRespV3::CigiHatHotRespV3 (  ) 

General Constructor

Definition at line 78 of file CigiHatHotRespV3.cpp.

References CIGI_HAT_HOT_RESP_PACKET_ID_V3, CIGI_HAT_HOT_RESP_PACKET_SIZE_V3, CigiBaseHatHotResp::Hat, CigiBaseHatHotResp::HAT, CigiBaseHatHotResp::HatHotID, CigiBaseHatHotResp::HostFrame, CigiBaseHatHotResp::Hot, CigiBaseHatHotResp::Material, CigiBasePacket::MinorVersion, CigiBaseHatHotResp::NormAz, CigiBaseHatHotResp::NormEl, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseHatHotResp::ReqType, CigiBaseHatHotResp::Valid, CigiBasePacket::Version, CigiBaseHatHotResp::VldHat, and CigiBaseHatHotResp::VldHot.

00079 {
00080 
00081    PacketID = CIGI_HAT_HOT_RESP_PACKET_ID_V3;
00082    PacketSize = CIGI_HAT_HOT_RESP_PACKET_SIZE_V3;
00083    Version = 3;
00084    MinorVersion = 0;
00085 
00086    HatHotID = 0;
00087    Valid = false;
00088    ReqType = HAT;
00089    HostFrame = 0;
00090    Hat = 0.0;
00091    Hot = 0.0;
00092    Material = 0;
00093    NormAz = 0.0;
00094    NormEl = 0.0;
00095    VldHat = false;
00096    VldHot = false;
00097 
00098 }

CigiHatHotRespV3::~CigiHatHotRespV3 (  )  [virtual]

General Destructor

Definition at line 103 of file CigiHatHotRespV3.cpp.

00104 {
00105 
00106 }


Member Function Documentation

int CigiHatHotRespV3::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

Reimplemented from CigiBasePacket.

Definition at line 265 of file CigiHatHotRespV3.cpp.

References CIGI_HAT_HOT_RESP_PACKET_ID_V3, CIGI_HAT_RESP_PACKET_ID_V1, CIGI_HAT_RESP_PACKET_ID_V2, CIGI_HOT_RESP_PACKET_ID_V2, CIGI_SUCCESS, CigiVersionID::CigiMajorVersion, CigiCnvtInfoType::CigiCnvtInfoStruct::CnvtPacketID, CigiBaseHatHotReq::HAT, CigiCnvtInfoType::CigiCnvtInfoStruct::ProcID, CigiBaseHatHotResp::ReqType, and CigiProcessType::TwoPassCnvtProcStd.

00267 {
00268    CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00269 
00270    switch(CnvtVersion.CigiMajorVersion)
00271    {
00272    case 1:
00273       // Note: This will result in an incorrect value
00274       // if the V3 response is a HOT value.
00275       CnvtInfo.CnvtPacketID = CIGI_HAT_RESP_PACKET_ID_V1;
00276       break;
00277    case 2:
00278       if(ReqType == CigiBaseHatHotReq::HAT)
00279          CnvtInfo.CnvtPacketID = CIGI_HAT_RESP_PACKET_ID_V2;
00280       else
00281          CnvtInfo.CnvtPacketID = CIGI_HOT_RESP_PACKET_ID_V2;
00282       break;
00283    default:
00284       // The Packet ID for all V3 HatHotResp are the same ID
00285       CnvtInfo.CnvtPacketID = CIGI_HAT_HOT_RESP_PACKET_ID_V3;
00286       break;
00287    }
00288 
00289    return(CIGI_SUCCESS);
00290 }

double CigiHatHotRespV3::GetHat ( void   )  const [inline]

Gets the Hat value.

Returns:
the current Hat.

Definition at line 161 of file CigiHatHotRespV3.h.

00161 { return(Hat); }

double CigiHatHotRespV3::GetHot ( void   )  const [inline]

Gets the Hot value.

Returns:
the current Hot.

Definition at line 183 of file CigiHatHotRespV3.h.

00183 { return(Hot); }

ReqTypeGrp CigiHatHotRespV3::GetReqType ( void   )  const [inline]

Gets the ReqType value.

Returns:
the current ReqType.

Definition at line 139 of file CigiHatHotRespV3.h.

00139 { return(ReqType); }

int CigiHatHotRespV3::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 CigiBaseHatHotResp.

Definition at line 115 of file CigiHatHotRespV3.cpp.

References PackPointerUnion::c, PackPointerUnion::d, CigiBaseHatHotResp::Hat, CigiBaseHatHotResp::HAT, CigiBaseHatHotResp::HatHotID, CigiBaseHatHotResp::Hot, CigiBaseHatHotResp::HOT, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseHatHotResp::ReqType, PackPointerUnion::s, CigiBaseHatHotResp::Valid, CigiBaseHatHotResp::VldHat, and CigiBaseHatHotResp::VldHot.

00116 {
00117    PackPointer CDta;
00118 
00119    CigiBaseHatHotResp * Data = ( CigiBaseHatHotResp *)Base;
00120 
00121    CDta.c = Buff;
00122 
00123    *CDta.c++ = PacketID;
00124    *CDta.c++ = PacketSize;
00125 
00126    *CDta.s++ = Data->HatHotID;
00127 
00128    bool tValid = Data->Valid;
00129    ReqTypeGrp tReqType = Data->ReqType;
00130 
00131    if(tValid)
00132    {
00133       if(!((Data->VldHat && (tReqType == HAT)) ||
00134            (Data->VldHot && (tReqType == HOT))))
00135       {
00136          if(Data->VldHat)
00137             tReqType = HAT;
00138          else if(Data->VldHot)
00139             tReqType = HOT;
00140          else
00141             tValid = false;
00142       }
00143    }
00144 
00145 
00146    Cigi_uint8 HDta = (tValid) ? 0x01 : 0;
00147    HDta |= (Cigi_uint8)((tReqType << 1) & 0x02);
00148    *CDta.c++ = HDta;
00149    *CDta.c++ = 0;
00150    *CDta.s++ = 0;
00151 
00152    if(tValid)
00153    {
00154       if(tReqType == HAT)
00155          *CDta.d++ = Data->Hat;
00156       else
00157          *CDta.d++ = Data->Hot;
00158    }
00159    else
00160       *CDta.d++ = 0.0;
00161 
00162 
00163    return(PacketSize);
00164 
00165 }

int CigiHatHotRespV3::SetHat ( const double  HatIn,
bool  bndchk = true 
) [inline]

Sets the Hat with bound checking control

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

Definition at line 151 of file CigiHatHotRespV3.h.

References CIGI_SUCCESS.

00152    {
00153       Hat = HatIn;
00154       VldHat = true;
00155       return(CIGI_SUCCESS);
00156    }

int CigiHatHotRespV3::SetHot ( const double  HotIn,
bool  bndchk = true 
) [inline]

Sets the Hot with bound checking control

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

Definition at line 173 of file CigiHatHotRespV3.h.

References CIGI_SUCCESS.

00174    {
00175       Hot = HotIn;
00176       VldHot = true;
00177       return(CIGI_SUCCESS);
00178    }

int CigiHatHotRespV3::SetReqType ( const ReqTypeGrp  ReqTypeIn,
bool  bndchk = true 
)

Sets the ReqType with bound checking control

Parameters:
ReqTypeIn - Request/Response type
HAT=0
HOT=1
bndchk - Enables (true) or disables (false) bounds checking.
Returns:
This returns CIGI_SUCCESS or an error code defined in CigiErrorCodes.h

Definition at line 302 of file CigiHatHotRespV3.cpp.

References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseHatHotResp::ReqType.

00303 {
00304 
00305 #ifndef CIGI_NO_BND_CHK
00306    if(bndchk && ((ReqTypeIn < 0)||(ReqTypeIn > 1)))
00307    {
00308 #ifndef CIGI_NO_EXCEPT
00309       throw CigiValueOutOfRangeException("ReqType",(ReqTypeGrp)ReqTypeIn,0,1);
00310 #endif
00311       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00312    }
00313 #endif
00314 
00315    ReqType = ReqTypeIn;
00316    return(CIGI_SUCCESS);
00317 
00318 }

int CigiHatHotRespV3::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 CigiBaseHatHotResp.

Definition at line 170 of file CigiHatHotRespV3.cpp.

References PackPointerUnion::c, CigiSwap2(), CigiSwap8(), PackPointerUnion::d, CigiBaseHatHotResp::Hat, CigiBaseHatHotResp::HAT, CigiBaseHatHotResp::HatHotID, CigiBaseHatHotResp::HostFrame, CigiBaseHatHotResp::Hot, CigiBaseHatHotResp::Material, CigiBasePacket::PacketSize, CigiBaseHatHotResp::ReqType, PackPointerUnion::s, CigiBaseHatHotResp::Valid, CigiBaseHatHotResp::VldHat, and CigiBaseHatHotResp::VldHot.

00171 {
00172    PackPointer CDta;
00173 
00174    CDta.c = Buff;
00175 
00176    CDta.c += 2;  // Step over packet id and size
00177 
00178    if(!Swap)
00179    {
00180       HatHotID = *CDta.s++;
00181 
00182       Cigi_uint8 HDta = *CDta.c++;
00183       Valid = ((HDta & 0x01) != 0);
00184       ReqType = (ReqTypeGrp)((HDta >> 1) & 0x01);
00185 
00186       CDta.c += 3;
00187 
00188       if(Valid)
00189       {
00190          if(ReqType == HAT)
00191          {
00192             Hat = *CDta.d++;
00193             Hot = 0.0;
00194             VldHat = true;
00195             VldHot = false;
00196          }
00197          else
00198          {
00199             Hat = 0.0;
00200             Hot = *CDta.d++;
00201             VldHat = false;
00202             VldHot = true;
00203          }
00204 
00205       }
00206       else
00207       {
00208          Hat = 0.0;
00209          Hot = 0.0;
00210          VldHat = false;
00211          VldHot = false;
00212       }
00213 
00214    }
00215    else
00216    {
00217       CigiSwap2(&HatHotID, CDta.s++);
00218 
00219       Cigi_uint8 HDta = *CDta.c++;
00220       Valid = ((HDta & 0x01) != 0);
00221       ReqType = (ReqTypeGrp)((HDta >> 1) & 0x01);
00222 
00223       CDta.c += 3;
00224 
00225       if(Valid)
00226       {
00227          if(ReqType == HAT)
00228          {
00229             CigiSwap8(&Hat, CDta.d++);
00230             Hot = 0.0;
00231             VldHat = true;
00232             VldHot = false;
00233          }
00234          else
00235          {
00236             Hat = 0.0;
00237             CigiSwap8(&Hot, CDta.d++);
00238             VldHat = false;
00239             VldHot = true;
00240          }
00241 
00242       }
00243       else
00244       {
00245          Hat = 0.0;
00246          Hot = 0.0;
00247          VldHat = false;
00248          VldHot = false;
00249       }
00250 
00251    }
00252 
00253    HostFrame = 0;
00254 
00255    Material = 0;
00256 
00257    return(PacketSize);
00258 
00259 }


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