#include <CigiHatHotRespV3_2.h>
Inheritance diagram for CigiHatHotRespV3_2:
Public Member Functions | |
CigiHatHotRespV3_2 () | |
virtual | ~CigiHatHotRespV3_2 () |
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 | SetHostFrame (const Cigi_uint8 HostFrameIn, bool bndchk=true) |
Cigi_uint8 | GetHostFrame (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 |
Definition at line 56 of file CigiHatHotRespV3_2.h.
CigiHatHotRespV3_2::CigiHatHotRespV3_2 | ( | ) |
General Constructor
Definition at line 69 of file CigiHatHotRespV3_2.cpp.
References CIGI_HAT_HOT_RESP_PACKET_ID_V3_2, CIGI_HAT_HOT_RESP_PACKET_SIZE_V3_2, 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.
00070 { 00071 00072 PacketID = CIGI_HAT_HOT_RESP_PACKET_ID_V3_2; 00073 PacketSize = CIGI_HAT_HOT_RESP_PACKET_SIZE_V3_2; 00074 Version = 3; 00075 MinorVersion = 2; 00076 00077 HatHotID = 0; 00078 Valid = false; 00079 ReqType = HAT; 00080 HostFrame = 0; 00081 Hat = 0.0; 00082 Hot = 0.0; 00083 Material = 0; 00084 NormAz = 0.0; 00085 NormEl = 0.0; 00086 VldHat = false; 00087 VldHot = false; 00088 00089 }
CigiHatHotRespV3_2::~CigiHatHotRespV3_2 | ( | ) | [virtual] |
int CigiHatHotRespV3_2::GetCnvt | ( | CigiVersionID & | CnvtVersion, | |
CigiCnvtInfoType::Type & | CnvtInfo | |||
) | [virtual] |
A virtual Conversion Information function. This function provides conversion information for this packet.
CnvtVersion | - The CIGI version to which this packet is being converted. | |
CnvtInfo | - The information needed for conversion |
Reimplemented from CigiBasePacket.
Definition at line 257 of file CigiHatHotRespV3_2.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.
00259 { 00260 CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd; 00261 00262 switch(CnvtVersion.CigiMajorVersion) 00263 { 00264 case 1: 00265 // Note: This will result in an incorrect value 00266 // if the V3_2 response is a HOT value. 00267 CnvtInfo.CnvtPacketID = CIGI_HAT_RESP_PACKET_ID_V1; 00268 break; 00269 case 2: 00270 if(ReqType == CigiBaseHatHotReq::HAT) 00271 CnvtInfo.CnvtPacketID = CIGI_HAT_RESP_PACKET_ID_V2; 00272 else 00273 CnvtInfo.CnvtPacketID = CIGI_HOT_RESP_PACKET_ID_V2; 00274 break; 00275 default: 00276 // The Packet ID for all V3 HatHotReq are the same ID 00277 CnvtInfo.CnvtPacketID = CIGI_HAT_HOT_RESP_PACKET_ID_V3; 00278 break; 00279 } 00280 00281 return(CIGI_SUCCESS); 00282 }
double CigiHatHotRespV3_2::GetHat | ( | void | ) | const [inline] |
Gets the Hat value.
Definition at line 180 of file CigiHatHotRespV3_2.h.
00180 { return(Hat); }
Cigi_uint8 CigiHatHotRespV3_2::GetHostFrame | ( | void | ) | const [inline] |
Gets the host frame value.
Definition at line 158 of file CigiHatHotRespV3_2.h.
00158 { return(HostFrame); }
double CigiHatHotRespV3_2::GetHot | ( | void | ) | const [inline] |
Gets the Hot value.
Definition at line 202 of file CigiHatHotRespV3_2.h.
00202 { return(Hot); }
ReqTypeGrp CigiHatHotRespV3_2::GetReqType | ( | void | ) | const [inline] |
Gets the ReqType value.
Definition at line 136 of file CigiHatHotRespV3_2.h.
00136 { return(ReqType); }
int CigiHatHotRespV3_2::Pack | ( | CigiBasePacket * | Base, | |
Cigi_uint8 * | Buff, | |||
void * | Spec | |||
) | const [virtual] |
The virtual Pack function for CIGI 3
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. |
Implements CigiBaseHatHotResp.
Definition at line 106 of file CigiHatHotRespV3_2.cpp.
References PackPointerUnion::c, PackPointerUnion::d, CigiBaseHatHotResp::Hat, CigiBaseHatHotResp::HAT, CigiBaseHatHotResp::HatHotID, CigiBaseHatHotResp::HostFrame, CigiBaseHatHotResp::Hot, CigiBaseHatHotResp::HOT, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseHatHotResp::ReqType, PackPointerUnion::s, CigiBaseHatHotResp::Valid, CigiBaseHatHotResp::VldHat, and CigiBaseHatHotResp::VldHot.
00107 { 00108 PackPointer CDta; 00109 00110 CigiBaseHatHotResp * Data = ( CigiBaseHatHotResp *)Base; 00111 00112 CDta.c = Buff; 00113 00114 *CDta.c++ = PacketID; 00115 *CDta.c++ = PacketSize; 00116 00117 *CDta.s++ = Data->HatHotID; 00118 00119 bool tValid = Data->Valid; 00120 ReqTypeGrp tReqType = Data->ReqType; 00121 00122 if(tValid) 00123 { 00124 if(!((Data->VldHat && (tReqType == HAT)) || 00125 (Data->VldHot && (tReqType == HOT)))) 00126 { 00127 if(Data->VldHat) 00128 tReqType = HAT; 00129 else if(Data->VldHot) 00130 tReqType = HOT; 00131 else 00132 tValid = false; 00133 } 00134 } 00135 00136 00137 Cigi_uint8 HDta = (tValid) ? 0x01 : 0; 00138 HDta |= (Cigi_uint8)((tReqType << 1) & 0x02); 00139 HDta |= (Data->HostFrame << 4) & 0xf0; 00140 *CDta.c++ = HDta; 00141 *CDta.c++ = 0; 00142 *CDta.s++ = 0; 00143 00144 if(tValid) 00145 { 00146 if(tReqType == HAT) 00147 *CDta.d++ = Data->Hat; 00148 else 00149 *CDta.d++ = Data->Hot; 00150 } 00151 else 00152 *CDta.d++ = 0.0; 00153 00154 00155 return(PacketSize); 00156 00157 }
int CigiHatHotRespV3_2::SetHat | ( | const double | HatIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the Hat with bound checking control
HatIn | - Height above terrain result | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 170 of file CigiHatHotRespV3_2.h.
References CIGI_SUCCESS.
00171 { 00172 Hat = HatIn; 00173 VldHat = true; 00174 return(CIGI_SUCCESS); 00175 }
int CigiHatHotRespV3_2::SetHostFrame | ( | const Cigi_uint8 | HostFrameIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the HostFrame with bound checking control
HostFrameIn | - The host frame when the hat/hot was calculated. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 149 of file CigiHatHotRespV3_2.h.
References CIGI_SUCCESS.
00150 { 00151 HostFrame = HostFrameIn; 00152 return(CIGI_SUCCESS); 00153 }
int CigiHatHotRespV3_2::SetHot | ( | const double | HotIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the Hot with bound checking control
HotIn | - Height of terrain result | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 192 of file CigiHatHotRespV3_2.h.
References CIGI_SUCCESS.
00193 { 00194 Hot = HotIn; 00195 VldHot = true; 00196 return(CIGI_SUCCESS); 00197 }
int CigiHatHotRespV3_2::SetReqType | ( | const ReqTypeGrp | ReqTypeIn, | |
bool | bndchk = true | |||
) |
Sets the ReqType with bound checking control
ReqTypeIn | - Request/Response type HAT=0 HOT=1 | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 294 of file CigiHatHotRespV3_2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseHatHotResp::ReqType.
00295 { 00296 00297 #ifndef CIGI_NO_BND_CHK 00298 if(bndchk && ((ReqTypeIn < 0)||(ReqTypeIn > 1))) 00299 { 00300 #ifndef CIGI_NO_EXCEPT 00301 throw CigiValueOutOfRangeException("ReqType",(ReqTypeGrp)ReqTypeIn,0,1); 00302 #endif 00303 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00304 } 00305 #endif 00306 00307 ReqType = ReqTypeIn; 00308 return(CIGI_SUCCESS); 00309 00310 }
int CigiHatHotRespV3_2::Unpack | ( | Cigi_uint8 * | Buff, | |
bool | Swap, | |||
void * | Spec | |||
) | [virtual] |
The virtual Unpack function for CIGI 3
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. |
Implements CigiBaseHatHotResp.
Definition at line 162 of file CigiHatHotRespV3_2.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.
00163 { 00164 PackPointer CDta; 00165 00166 CDta.c = Buff; 00167 00168 CDta.c += 2; // Step over packet id and size 00169 00170 if(!Swap) 00171 { 00172 HatHotID = *CDta.s++; 00173 00174 Cigi_uint8 HDta = *CDta.c++; 00175 Valid = ((HDta & 0x01) != 0); 00176 ReqType = (ReqTypeGrp)((HDta >> 1) & 0x01); 00177 HostFrame = (Cigi_uint8)((HDta >> 4) & 0x0f); 00178 00179 CDta.c += 3; 00180 00181 if(Valid) 00182 { 00183 if(ReqType == HAT) 00184 { 00185 Hat = *CDta.d++; 00186 Hot = 0.0; 00187 VldHat = true; 00188 VldHot = false; 00189 } 00190 else 00191 { 00192 Hat = 0.0; 00193 Hot = *CDta.d++; 00194 VldHat = false; 00195 VldHot = true; 00196 } 00197 00198 } 00199 else 00200 { 00201 Hat = 0.0; 00202 Hot = 0.0; 00203 VldHat = false; 00204 VldHot = false; 00205 } 00206 00207 } 00208 else 00209 { 00210 CigiSwap2(&HatHotID, CDta.s++); 00211 00212 Cigi_uint8 HDta = *CDta.c++; 00213 Valid = ((HDta & 0x01) != 0); 00214 ReqType = (ReqTypeGrp)((HDta >> 1) & 0x01); 00215 HostFrame = (Cigi_uint8)((HDta >> 4) & 0x0f); 00216 00217 CDta.c += 3; 00218 00219 if(Valid) 00220 { 00221 if(ReqType == HAT) 00222 { 00223 CigiSwap8(&Hat, CDta.d++); 00224 Hot = 0.0; 00225 VldHat = true; 00226 VldHot = false; 00227 } 00228 else 00229 { 00230 Hat = 0.0; 00231 CigiSwap8(&Hot, CDta.d++); 00232 VldHat = false; 00233 VldHot = true; 00234 } 00235 00236 } 00237 else 00238 { 00239 Hat = 0.0; 00240 Hot = 0.0; 00241 VldHat = false; 00242 VldHot = false; 00243 } 00244 00245 } 00246 00247 Material = 0; 00248 00249 return(PacketSize); 00250 00251 }