CigiCompCtrlV3_3.cpp

Go to the documentation of this file.
00001 
00049 #define _EXPORT_CCL_
00050 
00051 #include "CigiCompCtrlV3_3.h"
00052 #include "CigiSwapping.h"
00053 #include "CigiExceptions.h"
00054 
00055 
00056 
00057 
00058 // Component Class conversion Table
00059 const CigiBaseCompCtrl::CompAssocGrp CigiCompCtrlV3_3::CompClassV3xV1[CigiCompCtrlV3_3::CompClassCnvtSz] =
00060 {
00061    Entity,  // EntityV3
00062    View,    // ViewV3
00063    NoCnvtV1, // ViewGrpV3
00064    NoCnvtV1,  // SensorV3
00065    NoCnvtV1,  // RegionalSeaSurfaceV3
00066    NoCnvtV1,  // RegionalTerrainSurfaceV3
00067    NoCnvtV1,  // RegionalLayeredWeatherV3
00068    NoCnvtV1,  // GlobalSeaSurfaceV3
00069    NoCnvtV1,  // GlobalTerrainSurfaceV3
00070    NoCnvtV1,  // GlobalLayeredWeatherV3
00071    Environment,  // AtmosphereV3
00072    Environment,  // CelestialSphereV3
00073    NoCnvtV1,  // EventV3
00074    NoCnvtV1,  // SystemV3
00075    NoCnvtV1,  // SymbolSurfaceV3_3
00076    NoCnvtV1   // SymbolV3_3
00077 };
00078 
00079 const CigiBaseCompCtrl::CompClassV2Grp CigiCompCtrlV3_3::CompClassV3xV2[CigiCompCtrlV3_3::CompClassCnvtSz] =
00080 {
00081    EntityV2,  // EntityV3
00082    ViewV2,    // ViewV3
00083    ViewGrpV2, // ViewGrpV3
00084    SensorV2,  // SensorV3
00085    NoCnvtV2,  // RegionalSeaSurfaceV3
00086    NoCnvtV2,  // RegionalTerrainSurfaceV3
00087    NoCnvtV2,  // RegionalLayeredWeatherV3
00088    NoCnvtV2,  // GlobalSeaSurfaceV3
00089    NoCnvtV2,  // GlobalTerrainSurfaceV3
00090    NoCnvtV2,  // GlobalLayeredWeatherV3
00091    EnvironmentV2,  // AtmosphereV3
00092    EnvironmentV2,  // CelestialSphereV3
00093    NoCnvtV2,  // EventV3
00094    SystemV2,  // SystemV3
00095    NoCnvtV2,  // SymbolSurfaceV3_3
00096    NoCnvtV2   // SymbolV3_3
00097 };
00098 
00099 
00100 
00101 // ====================================================================
00102 // Construction/Destruction
00103 // ====================================================================
00104 
00105 
00106 // ================================================
00107 // CigiCompCtrlV3_3
00108 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00109 CigiCompCtrlV3_3::CigiCompCtrlV3_3()
00110 {
00111 
00112    PacketID = CIGI_COMP_CTRL_PACKET_ID_V3_3;
00113    PacketSize = CIGI_COMP_CTRL_PACKET_SIZE_V3_3;
00114    Version = 3;
00115    MinorVersion = 3;
00116 
00117    CompID = 0;
00118    InstanceID = 0;
00119    EntityID = 0;
00120    ViewID = 0;
00121    CompState = 0;
00122    CompAssoc = CigiBaseCompCtrl::Entity;
00123    CompClassV2 = CigiBaseCompCtrl::EntityV2;
00124    CompClassV3 = CigiBaseCompCtrl::EntityV3;
00125    CompData[0] = 0;
00126    CompData[1] = 0;
00127    CompData[2] = 0;
00128    CompData[3] = 0;
00129    CompData[4] = 0;
00130    CompData[5] = 0;
00131 
00132 }
00133 
00134 // ================================================
00135 // ~CigiCompCtrlV3_3
00136 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00137 CigiCompCtrlV3_3::~CigiCompCtrlV3_3()
00138 {
00139 
00140 }
00141 
00142 // ====================================================================
00143 // Pack and Unpack
00144 // ====================================================================
00145 
00146 // ================================================
00147 // Pack
00148 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00149 int CigiCompCtrlV3_3::Pack(CigiBasePacket * Base, Cigi_uint8 * Buff, void *Spec) const
00150 {
00151    PackPointer CDta;
00152 
00153    CigiBaseCompCtrl * Data = ( CigiBaseCompCtrl *)Base;
00154 
00155    CDta.c = Buff;
00156 
00157    *CDta.c++ = PacketID;
00158    *CDta.c++ = PacketSize;
00159 
00160    *CDta.s++ = Data->CompID;
00161    *CDta.s++ = Data->InstanceID;
00162 
00163    *CDta.c++ = Data->CompClassV3 & 0x3f;
00164 
00165    *CDta.c++ = (Cigi_uint8)((Data->CompState > 0x00ff) ?
00166       0x00ff : Data->CompState);
00167 
00168    *CDta.l++ = Data->CompData[0];
00169    *CDta.l++ = Data->CompData[1];
00170    *CDta.l++ = Data->CompData[2];
00171    *CDta.l++ = Data->CompData[3];
00172    *CDta.l++ = Data->CompData[4];
00173    *CDta.l++ = Data->CompData[5];
00174 
00175    return(PacketSize);
00176 
00177 }
00178 
00179 // ================================================
00180 // Unpack
00181 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00182 int CigiCompCtrlV3_3::Unpack(Cigi_uint8 * Buff, bool Swap, void *Spec)
00183 {
00184    PackPointer CDta;
00185 
00186    CDta.c = Buff;
00187 
00188    CDta.c += 2;  // Step over packet id and size
00189 
00190    if(!Swap)
00191    {
00192       CompID = *CDta.s++;
00193       InstanceID = *CDta.s++;
00194 
00195       CompClassV3 = (CompClassV3Grp)(*CDta.c++ & 0x3f);
00196 
00197       CompState = (Cigi_uint16)*CDta.c++;
00198 
00199       CompData[0] = *CDta.l++;
00200       CompData[1] = *CDta.l++;
00201       CompData[2] = *CDta.l++;
00202       CompData[3] = *CDta.l++;
00203       CompData[4] = *CDta.l++;
00204       CompData[5] = *CDta.l++;
00205    }
00206    else
00207    {
00208       CigiSwap2(&CompID, CDta.s++);
00209       CigiSwap2(&InstanceID, CDta.s++);
00210 
00211       CompClassV3 = (CompClassV3Grp)(*CDta.c++ & 0x0f);
00212 
00213       CompState = (Cigi_uint16)*CDta.c++;
00214 
00215       CigiSwap4(&CompData[0], CDta.l++);
00216       CigiSwap4(&CompData[1], CDta.l++);
00217       CigiSwap4(&CompData[2], CDta.l++);
00218       CigiSwap4(&CompData[3], CDta.l++);
00219       CigiSwap4(&CompData[4], CDta.l++);
00220       CigiSwap4(&CompData[5], CDta.l++);
00221    }
00222 
00223 
00224    if((CompClassV3 >= CigiBaseCompCtrl::EntityV3) &&
00225       (CompClassV3 <= CigiBaseCompCtrl::SymbolV3_3))
00226    {
00227       CompAssoc = CompClassV3xV1[CompClassV3];
00228       CompClassV2 = CompClassV3xV2[CompClassV3];
00229    }
00230    else
00231    {
00232       CompAssoc = NoCnvtV1;
00233       CompClassV2 = NoCnvtV2;
00234    }
00235 
00236 
00237    return(PacketSize);
00238 
00239 }
00240 
00241 
00242 // ================================================
00243 // GetCnvt
00244 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00245 int CigiCompCtrlV3_3::GetCnvt(CigiVersionID &CnvtVersion,
00246                             CigiCnvtInfoType::Type &CnvtInfo)
00247 {
00248    // Do not convert unless a conversion is found
00249    CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcNone;
00250    CnvtInfo.CnvtPacketID = 0;
00251 
00252    if(CnvtVersion.CigiMajorVersion == 3)
00253    {
00254       // All Component control packets from version 3 and above
00255       //  use the same packet id number
00256 
00257       if(CnvtVersion.CigiMinorVersion < 3)
00258       {
00259          if((CompClassV3 >= EntityV3)&&(CompClassV3 <= SystemV3))
00260          {
00261             CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00262             CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V3;
00263          }
00264       }
00265       else
00266       {
00267          CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00268          CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V3_3;
00269       }
00270    }
00271    else if(CnvtVersion.CigiMajorVersion == 2)
00272    {
00273       if((CompClassV2 >= EntityV2)&&(CompClassV2 <= SystemV2))
00274       {
00275          CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00276          CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V2;
00277       }
00278    }
00279    else if(CnvtVersion.CigiMajorVersion == 1)
00280    {
00281       if((CompAssoc >= Entity)&&(CompAssoc <= View))
00282       {
00283          CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00284          CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V1;
00285       }
00286    }
00287    else
00288    {
00289       // All Component control packets from version 3 and above
00290       //  use the same packet id number
00291       CnvtInfo.ProcID = CigiProcessType::TwoPassCnvtProcStd;
00292       CnvtInfo.CnvtPacketID = CIGI_COMP_CTRL_PACKET_ID_V3_3;
00293    }
00294 
00295    return(CIGI_SUCCESS);
00296 }
00297 
00298 
00299 
00300 // ====================================================================
00301 // Accessors
00302 // ====================================================================
00303 
00304 
00305 // ================================================
00306 // CompClassV3
00307 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00308 int CigiCompCtrlV3_3::SetCompClassV3(const CompClassV3Grp CompClassV3In, bool bndchk)
00309 {
00310 
00311 #ifndef CIGI_NO_BND_CHK
00312    if(bndchk && ((CompClassV3In < 0)||(CompClassV3In > 15)))
00313    {
00314 #ifndef CIGI_NO_EXCEPT
00315       throw CigiValueOutOfRangeException("CompClassV3",(CompClassV3Grp)CompClassV3In,0,15);
00316 #endif
00317       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00318    }
00319 #endif
00320 
00321    CompClassV3 = CompClassV3In;
00322 
00323    CompAssoc = CompClassV3xV1[CompClassV3];
00324    CompClassV2 = CompClassV3xV2[CompClassV3];
00325 
00326    return(CIGI_SUCCESS);
00327 
00328 }
00329 
00330 
00331 
00332 
00333 // ================================================
00334 // SetCompData - Cigi_uint8
00335 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00336 int CigiCompCtrlV3_3::SetCompData(const Cigi_uint8 CompDataIn,
00337                     const unsigned int Word,
00338                     const BytePos Pos,
00339                     bool bndchk)
00340 {
00341 
00342    int Err = 0;
00343 
00344    if(Word > 5)
00345       Err = 1;
00346    else if((Pos < 0) || (Pos > 3))
00347       Err = 2;
00348 
00349    if(Err != 0)
00350    {
00351 #ifndef CIGI_NO_BND_CHK
00352       if(bndchk)
00353       {
00354 #ifndef CIGI_NO_EXCEPT
00355          if(Err == 1)
00356             throw CigiValueOutOfRangeException("Word",Word,0,1);
00357          else
00358             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00359 #endif
00360       }
00361 #endif
00362       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00363    }
00364 
00365 
00366    int bitPos = Pos * 8;
00367 
00368    Cigi_uint32 tDta = (Cigi_uint32)CompDataIn;
00369 
00370    CompData[Word] &= ~(0x000000ff << bitPos);
00371    CompData[Word] |= ((tDta & 0x000000ff) << bitPos);
00372 
00373    return(CIGI_SUCCESS);
00374 }
00375 
00376 
00377 // ================================================
00378 // SetCompData - Cigi_int8
00379 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00380 int CigiCompCtrlV3_3::SetCompData(const Cigi_int8 CompDataIn,
00381                     const unsigned int Word,
00382                     const BytePos Pos,
00383                     bool bndchk)
00384 {
00385 
00386    union {
00387       Cigi_int8 sc;
00388       Cigi_uint8 uc;
00389    } cxfer;
00390 
00391    int Err = 0;
00392 
00393    if(Word > 5)
00394       Err = 1;
00395    else if((Pos < 0) || (Pos > 3))
00396       Err = 2;
00397 
00398    if(Err != 0)
00399    {
00400 #ifndef CIGI_NO_BND_CHK
00401       if(bndchk)
00402       {
00403 #ifndef CIGI_NO_EXCEPT
00404          if(Err == 1)
00405             throw CigiValueOutOfRangeException("Word",Word,0,1);
00406          else
00407             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00408 #endif
00409       }
00410 #endif
00411       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00412    }
00413 
00414 
00415    int bitPos = Pos * 8;
00416 
00417    cxfer.sc = CompDataIn;
00418    Cigi_uint32 tDta = (Cigi_uint32)cxfer.uc;
00419 
00420    CompData[Word] &= ~(0x000000ff << bitPos);
00421    CompData[Word] |= ((tDta & 0x000000ff) << bitPos);
00422 
00423    return(CIGI_SUCCESS);
00424 }
00425 
00426 
00427 // ================================================
00428 // SetCompData - Cigi_uint16
00429 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00430 int CigiCompCtrlV3_3::SetCompData(const Cigi_uint16 CompDataIn,
00431                     const unsigned int Word,
00432                     const HalfWordPos Pos,
00433                     bool bndchk)
00434 {
00435 
00436    int Err = 0;
00437 
00438    if(Word > 5)
00439       Err = 1;
00440    else if((Pos < 0) || (Pos > 1))
00441       Err = 2;
00442 
00443    if(Err != 0)
00444    {
00445 #ifndef CIGI_NO_BND_CHK
00446       if(bndchk)
00447       {
00448 #ifndef CIGI_NO_EXCEPT
00449          if(Err == 1)
00450             throw CigiValueOutOfRangeException("Word",Word,0,1);
00451          else
00452             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00453 #endif
00454       }
00455 #endif
00456       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00457    }
00458 
00459 
00460    int bitPos = Pos * 16;
00461 
00462    Cigi_uint32 tDta = (Cigi_uint32)CompDataIn;
00463 
00464    CompData[Word] &= ~(0x0000ffff << bitPos);
00465    CompData[Word] |= ((tDta & 0x0000ffff) << bitPos);
00466 
00467    return(CIGI_SUCCESS);
00468 }
00469 
00470 
00471 // ================================================
00472 // SetCompData - short
00473 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00474 int CigiCompCtrlV3_3::SetCompData(const Cigi_int16 CompDataIn,
00475                     const unsigned int Word,
00476                     const HalfWordPos Pos,
00477                     bool bndchk)
00478 {
00479 
00480    union {
00481       Cigi_int16 s16;
00482       Cigi_uint16 u16;
00483    } sxfer;
00484 
00485    int Err = 0;
00486 
00487    if(Word > 5)
00488       Err = 1;
00489    else if((Pos < 0) || (Pos > 1))
00490       Err = 2;
00491 
00492    if(Err != 0)
00493    {
00494 #ifndef CIGI_NO_BND_CHK
00495       if(bndchk)
00496       {
00497 #ifndef CIGI_NO_EXCEPT
00498          if(Err == 1)
00499             throw CigiValueOutOfRangeException("Word",Word,0,1);
00500          else
00501             throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00502 #endif
00503       }
00504 #endif
00505       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00506    }
00507 
00508 
00509    int bitPos = Pos * 16;
00510 
00511    sxfer.s16 = CompDataIn;
00512    Cigi_uint32 tDta = (Cigi_uint32)sxfer.u16;
00513 
00514    CompData[Word] &= ~(0x0000ffff << bitPos);
00515    CompData[Word] |= ((tDta & 0x0000ffff) << bitPos);
00516 
00517    return(CIGI_SUCCESS);
00518 }
00519 
00520 
00521 // ================================================
00522 // SetCompData - Cigi_uint32
00523 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00524 int CigiCompCtrlV3_3::SetCompData(const Cigi_uint32 CompDataIn,
00525                 const unsigned int Word,
00526                 bool bndchk)
00527 {
00528 
00529    if(Word > 5)
00530    {
00531 #ifndef CIGI_NO_BND_CHK
00532       if(bndchk)
00533       {
00534 #ifndef CIGI_NO_EXCEPT
00535          throw CigiValueOutOfRangeException("Word",Word,0,1);
00536 #endif
00537       }
00538 #endif
00539       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00540    }
00541 
00542 
00543    CompData[Word] = CompDataIn;
00544 
00545    return(CIGI_SUCCESS);
00546 }
00547 
00548 
00549 // ================================================
00550 // SetCompData - long
00551 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00552 int CigiCompCtrlV3_3::SetCompData(const Cigi_int32 CompDataIn,
00553                 const unsigned int Word,
00554                 bool bndchk)
00555 {
00556 
00557    union {
00558       Cigi_int32 s32;
00559       Cigi_uint32 u32;
00560    } tDta;
00561 
00562    if(Word > 5)
00563    {
00564 #ifndef CIGI_NO_BND_CHK
00565       if(bndchk)
00566       {
00567 #ifndef CIGI_NO_EXCEPT
00568          throw CigiValueOutOfRangeException("Word",Word,0,1);
00569 #endif
00570       }
00571 #endif
00572       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00573    }
00574 
00575 
00576    tDta.s32 = CompDataIn;
00577    CompData[Word] = (Cigi_uint32)tDta.u32;
00578 
00579    return(CIGI_SUCCESS);
00580 }
00581 
00582 
00583 // ================================================
00584 // SetCompData - float
00585 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00586 int CigiCompCtrlV3_3::SetCompData(const float CompDataIn,
00587                 const unsigned int Word,
00588                 bool bndchk)
00589 {
00590 
00591    if(Word > 5)
00592    {
00593 #ifndef CIGI_NO_BND_CHK
00594       if(bndchk)
00595       {
00596 #ifndef CIGI_NO_EXCEPT
00597          throw CigiValueOutOfRangeException("Word",Word,0,1);
00598 #endif
00599       }
00600 #endif
00601       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00602    }
00603 
00604 
00605    union DtaXfer {
00606       Cigi_uint32 lDta;
00607       float fDta;
00608    } XDta;
00609 
00610    XDta.fDta = CompDataIn;
00611    CompData[Word] = XDta.lDta;
00612 
00613    return(CIGI_SUCCESS);
00614 }
00615 
00616 
00617 // ================================================
00618 // SetCompData  - Cigi_uint64
00619 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00620 int CigiCompCtrlV3_3::SetCompData(const Cigi_uint64 CompDataIn,
00621                 const unsigned int Pos,
00622                 bool bndchk)
00623 {
00624 
00625    if(Pos > 2)
00626    {
00627 #ifndef CIGI_NO_BND_CHK
00628       if(bndchk)
00629       {
00630 #ifndef CIGI_NO_EXCEPT
00631          throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00632 #endif
00633       }
00634 #endif
00635       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00636    }
00637 
00638 
00639    int Word = Pos * 2;
00640 
00641    CompData[Word++] = (Cigi_uint32)((CompDataIn >> 32) & 0x00000000ffffffff);
00642    CompData[Word] = (Cigi_uint32)(CompDataIn & 0x00000000ffffffff);
00643 
00644    return(CIGI_SUCCESS);
00645 }
00646 
00647 
00648 // ================================================
00649 // SetCompData - double
00650 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00651 int CigiCompCtrlV3_3::SetCompData(const double CompDataIn,
00652                 const unsigned int Pos,
00653                 bool bndchk)
00654 {
00655 
00656    if(Pos > 2)
00657    {
00658 #ifndef CIGI_NO_BND_CHK
00659       if(bndchk)
00660       {
00661 #ifndef CIGI_NO_EXCEPT
00662          throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00663 #endif
00664       }
00665 #endif
00666       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00667    }
00668 
00669    union DtaXfer {
00670       Cigi_uint64 i;
00671       double d;
00672    } XDta;
00673 
00674    XDta.d = CompDataIn;
00675 
00676    int Word = Pos * 2;
00677 
00678    CompData[Word++] = (Cigi_uint32)((XDta.i >> 32) & 0x00000000ffffffff);
00679    CompData[Word] = (Cigi_uint32)(XDta.i & 0x00000000ffffffff);
00680 
00681 
00682    return(CIGI_SUCCESS);
00683 }
00684 
00685 
00686 
00687 
00688 
00689 
00690 
00691 // ================================================
00692 // GetUCharCompData
00693 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00694 Cigi_uint8 CigiCompCtrlV3_3::GetUCharCompData(const unsigned int Word,
00695                                const BytePos Pos)
00696 {
00697 
00698    Cigi_uint8 tDta;
00699 
00700    int Err = 0;
00701 
00702    if(Word > 5)
00703       Err = 1;
00704    else if((Pos < 0) || (Pos > 3))
00705       Err = 2;
00706 
00707    if(Err != 0)
00708    {
00709 #ifndef CIGI_NO_EXCEPT
00710       if(Err == 1)
00711          throw CigiValueOutOfRangeException("Word",Word,0,1);
00712       else
00713          throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00714 #endif
00715 
00716       tDta = 0;
00717    }
00718    else
00719       tDta = (Cigi_uint8)((CompData[Word] >> (Pos * 8)) & 0x000000ff);
00720 
00721    return(tDta);
00722 }
00723 
00724 
00725 // ================================================
00726 // GetCharCompData
00727 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00728 Cigi_int8 CigiCompCtrlV3_3::GetCharCompData(const unsigned int Word,
00729                      const BytePos Pos)
00730 {
00731    union {
00732       Cigi_int8 sc;
00733       Cigi_uint8 uc;
00734    } tDta;
00735 
00736    int Err = 0;
00737 
00738    if(Word > 5)
00739       Err = 1;
00740    else if((Pos < 0) || (Pos > 3))
00741       Err = 2;
00742 
00743    if(Err != 0)
00744    {
00745 #ifndef CIGI_NO_EXCEPT
00746       if(Err == 1)
00747          throw CigiValueOutOfRangeException("Word",Word,0,1);
00748       else
00749          throw CigiValueOutOfRangeException("Pos",Pos,0,3);
00750 #endif
00751 
00752       tDta.uc = 0;
00753    }
00754    else
00755       tDta.uc = (Cigi_uint8)((CompData[Word] >> (Pos * 8)) & 0x000000ff);
00756 
00757    return(tDta.sc);
00758 }
00759 
00760 
00761 // ================================================
00762 // GetUShortCompData
00763 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00764 Cigi_uint16 CigiCompCtrlV3_3::GetUShortCompData(const unsigned int Word,
00765                                  const HalfWordPos Pos)
00766 {
00767    Cigi_uint16 tDta;
00768 
00769    int Err = 0;
00770 
00771    if(Word > 5)
00772       Err = 1;
00773    else if((Pos < 0) || (Pos > 1))
00774       Err = 2;
00775 
00776    if(Err != 0)
00777    {
00778 #ifndef CIGI_NO_EXCEPT
00779       if(Err == 1)
00780          throw CigiValueOutOfRangeException("Word",Word,0,1);
00781       else
00782          throw CigiValueOutOfRangeException("Pos",Pos,0,1);
00783 #endif
00784 
00785       tDta = 0;
00786    }
00787    else
00788       tDta = (Cigi_uint16)((CompData[Word] >> (Pos * 16)) & 0x0000ffff);
00789 
00790    return(tDta);
00791 }
00792 
00793 
00794 // ================================================
00795 // GetShortCompData
00796 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00797 Cigi_int16 CigiCompCtrlV3_3::GetShortCompData(const unsigned int Word,
00798                        const HalfWordPos Pos)
00799 {
00800    union {
00801       Cigi_int16 s16;
00802       Cigi_uint16 u16;
00803    } tDta;
00804 
00805    int Err = 0;
00806 
00807    if(Word > 5)
00808       Err = 1;
00809    else if((Pos < 0) || (Pos > 1))
00810       Err = 2;
00811 
00812    if(Err != 0)
00813    {
00814 #ifndef CIGI_NO_EXCEPT
00815       if(Err == 1)
00816          throw CigiValueOutOfRangeException("Word",Word,0,1);
00817       else
00818          throw CigiValueOutOfRangeException("Pos",Pos,0,1);
00819 #endif
00820 
00821       tDta.u16 = 0;
00822    }
00823    else
00824       tDta.u16 = (Cigi_uint16)((CompData[Word] >> (Pos * 16)) & 0x0000ffff);
00825 
00826    return(tDta.s16);
00827 }
00828 
00829 
00830 // ================================================
00831 // GetULongCompData
00832 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00833 Cigi_uint32 CigiCompCtrlV3_3::GetULongCompData(const unsigned int Word)
00834 {
00835 
00836    Cigi_uint32 tDta;
00837 
00838 
00839    if(Word > 5)
00840    {
00841 #ifndef CIGI_NO_EXCEPT
00842       throw CigiValueOutOfRangeException("Word",Word,0,1);
00843 #endif
00844 
00845       tDta = 0;
00846    }
00847    else
00848       tDta = CompData[Word];
00849 
00850    return(tDta);
00851 }
00852 
00853 
00854 
00855 // ================================================
00856 // GetLongCompData
00857 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00858 Cigi_int32 CigiCompCtrlV3_3::GetLongCompData(const unsigned int Word)
00859 {
00860 
00861    union {
00862       Cigi_int32 s32;
00863       Cigi_uint32 u32;
00864    } tDta;
00865 
00866    if(Word > 5)
00867    {
00868 #ifndef CIGI_NO_EXCEPT
00869       throw CigiValueOutOfRangeException("Word",Word,0,1);
00870 #endif
00871 
00872       tDta.u32 = 0;
00873    }
00874    else
00875       tDta.u32 = (Cigi_uint32)(CompData[Word]);
00876 
00877    return(tDta.s32);
00878 }
00879 
00880 
00881 
00882 // ================================================
00883 // GetFloatCompData
00884 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00885 float CigiCompCtrlV3_3::GetFloatCompData(const unsigned int Word)
00886 {
00887 
00888    union {
00889       float f32;
00890       Cigi_uint32 u32;
00891    } tDta;
00892 
00893    if(Word > 5)
00894    {
00895 #ifndef CIGI_NO_EXCEPT
00896       throw CigiValueOutOfRangeException("Word",Word,0,1);
00897 #endif
00898 
00899       tDta.u32 = 0;
00900    }
00901    else
00902       tDta.u32 = (Cigi_uint32)(CompData[Word]);
00903 
00904    return(tDta.f32);
00905 }
00906 
00907 
00908 
00909 // ================================================
00910 // GetI64CompData
00911 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00912 Cigi_uint64 CigiCompCtrlV3_3::GetI64CompData(const unsigned int Pos)
00913 {
00914 
00915    Cigi_uint64 tDta;
00916 
00917    if(Pos > 2)
00918    {
00919 #ifndef CIGI_NO_EXCEPT
00920       throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00921 #endif
00922 
00923       tDta = 0;
00924    }
00925    else
00926    {
00927       int Word = Pos * 2;
00928       Cigi_uint64 tDtah = (Cigi_uint64)(CompData[Word++]);
00929       tDtah = (tDtah << 32) & _I64_CONST_(0xffffffff00000000);
00930 
00931       Cigi_uint64 tDtal = (Cigi_uint64)(CompData[Word]);
00932       tDtal &= _I64_CONST_(0x00000000ffffffff);
00933 
00934       tDta = tDtah | tDtal;
00935    }
00936 
00937 
00938    return(tDta);
00939 }
00940 
00941 
00942 
00943 // ================================================
00944 // GetDoubleCompData
00945 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00946 double CigiCompCtrlV3_3::GetDoubleCompData(const unsigned int Pos)
00947 {
00948 
00949    Cigi_uint64 tDta;
00950 
00951    union DtaXfer {
00952       Cigi_uint64 i;
00953       double d;
00954    } XDta;
00955 
00956    if(Pos > 2)
00957    {
00958 #ifndef CIGI_NO_EXCEPT
00959       throw CigiValueOutOfRangeException("Pos",Pos,0,0);
00960 #endif
00961 
00962       tDta = 0;
00963    }
00964    else
00965    {
00966 
00967       int Word = Pos * 2;
00968       Cigi_uint64 tDtah = (Cigi_uint64)(CompData[Word++]);
00969       tDtah = (tDtah << 32) & _I64_CONST_(0xffffffff00000000);
00970 
00971       Cigi_uint64 tDtal = (Cigi_uint64)(CompData[Word]);
00972       tDtal &= _I64_CONST_(0x00000000ffffffff);
00973 
00974       tDta = tDtah | tDtal;
00975 
00976       XDta.i = tDta;
00977    }
00978 
00979    return(XDta.d);
00980 }
00981 
00982 
00983 

Generated on Wed Apr 29 08:59:58 2009 for CCL by  doxygen 1.4.7