CigiSwapping.h File Reference

#include "CigiTypes.h"

Go to the source code of this file.

Defines

#define _CIGI_SWAPPING_INCLUDE_
#define CigiCopy1(_dest_, _src_)   ( *( ( Cigi_int8*)( _dest_)) = *( ( Cigi_int8*)( _src_)) )
#define CigiCopy2(_dest_, _src_)   ( *( ( Cigi_int16*)( _dest_)) = *( ( Cigi_int16*)( _src_)) )
#define CigiCopy4(_dest_, _src_)   ( *( ( Cigi_int32*)( _dest_)) = *( ( Cigi_int32*)( _src_)) )
#define CIGI_FLOAT_TO_B6(_fval)   ( (Cigi_int16)( ( _fval) * 64.0))
#define CIGI_B6_TO_FLOAT(_b6val)   ( ( (double) _b6val) / 64.0)
#define CIGI_FLOAT_TO_BA(_fval)   ( (Cigi_int32)( ( _fval) * 182.0444))
#define CIGI_BA_TO_FLOAT(_baval)   ( ( (double) _baval) / 182.0444)

Functions

void CIGI_SPEC CigiSwap2 (void *dest, const void *src)
void CIGI_SPEC CigiSwap4 (void *dest, const void *src)
void CIGI_SPEC CigiSwap8 (void *dest, const void *src)
void CIGI_SPEC CigiCopy8 (void *dest, const void *src)


Define Documentation

#define _CIGI_SWAPPING_INCLUDE_

  The SDK is used to create and format CIGI compliant messages.
  Copyright (c) 2001-2005 The Boeing Company

  This library is free software; you can redistribute it and/or modify it 
  under the terms of the GNU Lesser General Public License as published by 
  the Free Software Foundation; either version 2.1 of the License, or (at 
  your option) any later version.

  This library is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Public License for more 
  details.

  You should have received a copy of the GNU Lesser General Public License 
  along with this library; if not, write to the Free Software Foundation, 
  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

  FILENAME:   CigiEntityCtrlV1.h
  LANGUAGE:   C++
  CLASS:      UNCLASSIFIED
  PROJECT:    Common Image Generator Interface (CIGI) SDK

  PROGRAM DESCRIPTION: 
  ...

  MODIFICATION NOTES:
  DATE     NAME                                SCR NUMBER
  DESCRIPTION OF CHANGE........................

  09/17/2003 Greg Basler                       CIGI_CR_DR_1
  Initial Release.

  01/21/2005 Greg Basler                       Version 1.5
  Added function modifiers to export the CigiSwap2, CigiSwap4, and CigiSwap8 
  functions when built as a Windows DLL.

  01/21/2005 Greg Basler                       Version 1.5
  Changed the implementations of the CigiCopy2, CigiCopy4, CIGI_FLOAT_TO_B6, 
  and CIGI_FLOAT_TO_BA to use CIGI-defined types instead of native C++ types.

  04/06/2005 Greg Basler                       Version 1.5.2
  Included the CigiTypes.h header file. Modified the CigiCopy2 and CigiCopy4 
  macros to use the cigi-defined data types instead of native types.

  06/23/2006 Greg Basler                       Version 1.7.1
  Changed native char and unsigned char types to CIGI types Cigi_int8 and 
  Cigi_uint8.

  11/20/2007 Greg Basler                       Version 2.0.0
  Changed CigiCopy8 to make sure that it works for big endian and non-intel
  machines.

 
Author: The Boeing Company

Definition at line 61 of file CigiSwapping.h.

#define CIGI_B6_TO_FLOAT ( _b6val   )     ( ( (double) _b6val) / 64.0)

Formats a type B6 number as a double floating-point number (double).

Parameters:
_b6val - Specifies the B6 format number to convert.
Returns:
the double converted number.

Definition at line 148 of file CigiSwapping.h.

Referenced by CigiArtPartCtrlV1::Unpack().

#define CIGI_BA_TO_FLOAT ( _baval   )     ( ( (double) _baval) / 182.0444)

Formats a type B-angle number as a double floating-point number (double).

Parameters:
_baval - Specifies the B-angle format number to convert.
Returns:
the double converted number.

Definition at line 167 of file CigiSwapping.h.

Referenced by CigiSensorRespV1::Unpack(), and CigiArtPartCtrlV1::Unpack().

#define CIGI_FLOAT_TO_B6 ( _fval   )     ( (Cigi_int16)( ( _fval) * 64.0))

Formats a double floating-point number (double) as a type B6 number.
note: Percision of up to 0.015625 may be lost in this conversion.

Parameters:
_fval - Specifies the double floating-point number to convert.
Returns:
the B6 converted number.

Definition at line 138 of file CigiSwapping.h.

Referenced by CigiArtPartCtrlV1::Pack().

#define CIGI_FLOAT_TO_BA ( _fval   )     ( (Cigi_int32)( ( _fval) * 182.0444))

Formats a double floating-point number (double) as a type B-angle number.
note: Percision of up to 0.0054931640625 may be lost in this conversion.

Parameters:
_fval - Specifies the double floating-point number to convert.
Returns:
the B6 converted number.

Definition at line 157 of file CigiSwapping.h.

Referenced by CigiSensorRespV1::Pack(), and CigiArtPartCtrlV1::Pack().

#define CigiCopy1 ( _dest_,
_src_   )     ( *( ( Cigi_int8*)( _dest_)) = *( ( Cigi_int8*)( _src_)) )

Copies the byte pointed to by src into the byte
pointed to by dest.

Parameters:
_dest_ - Specifies where the byte should be placed
_src_ - Specifies the source byte to copy.

Definition at line 110 of file CigiSwapping.h.

#define CigiCopy2 ( _dest_,
_src_   )     ( *( ( Cigi_int16*)( _dest_)) = *( ( Cigi_int16*)( _src_)) )

Copies the Cigi_int16 pointed to by src into the short
pointed to by dest.

Parameters:
_dest_ - Specifies where the Cigi_int16 should be placed
_src_ - Specifies the source Cigi_int16 to copy.

Definition at line 119 of file CigiSwapping.h.

#define CigiCopy4 ( _dest_,
_src_   )     ( *( ( Cigi_int32*)( _dest_)) = *( ( Cigi_int32*)( _src_)) )

Copies the word pointed to by src into the word
pointed to by dest.

Parameters:
_dest_ - Specifies where the word should be placed
_src_ - Specifies the source word to copy.

Definition at line 128 of file CigiSwapping.h.


Function Documentation

void CIGI_SPEC CigiCopy8 ( void *  dest,
const void *  src 
) [inline]

Copies the double word pointed to by src into the
double word pointed to by dest.

Parameters:
_dest_ - Specifies where the double word should be placed
_src_ - Specifies the source double word to copy.

Definition at line 137 of file CigiSwapping.cpp.

00138 {
00139    Cigi_uint32 *tDest = (Cigi_uint32 *)dest;
00140    Cigi_uint32 *tSrc = (Cigi_uint32 *)src;
00141 
00142    *tDest++ = *tSrc++;
00143    *tDest = *tSrc;
00144 }

void CIGI_SPEC CigiSwap2 ( void *  dest,
const void *  src 
)

Byte swaps the Cigi_int16 pointed to by src and places the result into the Cigi_int16 pointed to by dest.

Parameters:
dest - Specifies where the byte swapped Cigi_int16 should be placed
src - Specifies the source Cigi_int16 to byte swap.

Definition at line 76 of file CigiSwapping.cpp.

Referenced by CigiWeatherCtrlV3::Unpack(), CigiWaveCtrlV3::Unpack(), CigiViewDefV3::Unpack(), CigiViewCtrlV3::Unpack(), CigiTrajectoryDefV3::Unpack(), CigiTerrestrialSurfaceCtrlV3::Unpack(), CigiSymbolTextDefV3_3::Unpack(), CigiSymbolSurfaceDefV3_3::Unpack(), CigiSymbolLineDefV3_3::Unpack(), CigiSymbolCtrlV3_3::Unpack(), CigiSymbolCloneV3_3::Unpack(), CigiSymbolCircleDefV3_3::Unpack(), CigiShortSymbolCtrlV3_3::Unpack(), CigiShortCompCtrlV3_3::Unpack(), CigiShortCompCtrlV3::Unpack(), CigiShortArtPartCtrlV3::Unpack(), CigiSensorXRespV3::Unpack(), CigiSensorRespV3::Unpack(), CigiSensorCtrlV3::Unpack(), CigiRateCtrlV3_2::Unpack(), CigiRateCtrlV3::Unpack(), CigiPositionRespV3::Unpack(), CigiPositionReqV3::Unpack(), CigiMotionTrackCtrlV3::Unpack(), CigiMaritimeSurfaceCtrlV3::Unpack(), CigiLosXRespV3_2::Unpack(), CigiLosXRespV3::Unpack(), CigiLosVectReqV3_2::Unpack(), CigiLosVectReqV3::Unpack(), CigiLosSegReqV3_2::Unpack(), CigiLosSegReqV3::Unpack(), CigiLosRespV3_2::Unpack(), CigiLosRespV3::Unpack(), CigiIGMsgV3::Unpack(), CigiHatHotXRespV3_2::Unpack(), CigiHatHotXRespV3::Unpack(), CigiHatHotRespV3_2::Unpack(), CigiHatHotRespV3::Unpack(), CigiHatHotReqV3_2::Unpack(), CigiHatHotReqV3::Unpack(), CigiEventNotificationV3::Unpack(), CigiEnvRgnCtrlV3::Unpack(), CigiEntityCtrlV3_3::Unpack(), CigiEntityCtrlV3::Unpack(), CigiConfClampEntityCtrlV3::Unpack(), CigiCompCtrlV3_3::Unpack(), CigiCompCtrlV3::Unpack(), CigiCollDetVolRespV3::Unpack(), CigiCollDetVolDefV3::Unpack(), CigiCollDetSegRespV3::Unpack(), CigiCollDetSegDefV3::Unpack(), CigiArtPartCtrlV3::Unpack(), and CigiAnimationStopV3::Unpack().

00077 {
00078     static Cigi_uint16 d, s;
00079     
00080     s = *( ( Cigi_uint16 *)src);
00081     
00082     d = s << 8;
00083     d |= s >> 8;
00084     
00085     *( ( Cigi_uint16 *)dest) = d;
00086 }

void CIGI_SPEC CigiSwap4 ( void *  dest,
const void *  src 
)

Byte swaps the word pointed to by src and places the result into the word pointed to by dest.

Parameters:
dest - Specifies where the byte swapped word should be placed
src - Specifies the source word to byte swap.

Definition at line 91 of file CigiSwapping.cpp.

References _SWAP_UNION::b, and _SWAP_UNION::i.

Referenced by CigiWeatherCtrlV3::Unpack(), CigiWeatherCondRespV3::Unpack(), CigiWaveCtrlV3::Unpack(), CigiViewDefV3::Unpack(), CigiViewCtrlV3::Unpack(), CigiVertexSymbolDataV3_3::Unpack(), CigiTrajectoryDefV3::Unpack(), CigiTerrestrialSurfaceRespV3::Unpack(), CigiSymbolTextDefV3_3::Unpack(), CigiSymbolSurfaceDefV3_3::Unpack(), CigiSymbolLineDefV3_3::Unpack(), CigiSymbolCtrlV3_3::Unpack(), CigiSymbolCircleDefV3_3::Unpack(), CigiSOFV3_2::Unpack(), CigiSOFV3::Unpack(), CigiShortSymbolCtrlV3_3::Unpack(), CigiShortCompCtrlV3_3::Unpack(), CigiShortCompCtrlV3::Unpack(), CigiShortArtPartCtrlV3::Unpack(), CigiSensorXRespV3::Unpack(), CigiSensorRespV3::Unpack(), CigiSensorCtrlV3::Unpack(), CigiRateCtrlV3_2::Unpack(), CigiRateCtrlV3::Unpack(), CigiPositionRespV3::Unpack(), CigiMaritimeSurfaceRespV3::Unpack(), CigiMaritimeSurfaceCtrlV3::Unpack(), CigiLosXRespV3_2::Unpack(), CigiLosXRespV3::Unpack(), CigiLosVectReqV3_2::Unpack(), CigiLosVectReqV3::Unpack(), CigiLosSegReqV3_2::Unpack(), CigiLosSegReqV3::Unpack(), CigiIGCtrlV3_3::Unpack(), CigiIGCtrlV3_2::Unpack(), CigiIGCtrlV3::Unpack(), CigiHatHotXRespV3_2::Unpack(), CigiHatHotXRespV3::Unpack(), CigiEventNotificationV3::Unpack(), CigiEnvRgnCtrlV3::Unpack(), CigiEntityCtrlV3_3::Unpack(), CigiEntityCtrlV3::Unpack(), CigiConfClampEntityCtrlV3::Unpack(), CigiCompCtrlV3_3::Unpack(), CigiCompCtrlV3::Unpack(), CigiCollDetVolDefV3::Unpack(), CigiCollDetSegRespV3::Unpack(), CigiCollDetSegDefV3::Unpack(), CigiCircleSymbolDataV3_3::Unpack(), CigiCelestialCtrlV3::Unpack(), CigiAtmosCtrlV3::Unpack(), CigiArtPartCtrlV3::Unpack(), CigiAerosolRespV3::Unpack(), and CigiOutgoingMsg::UpdateFrameCntr().

00092 {
00093     static SWAP_UNION d, s;
00094     
00095     s.i = *( ( Cigi_uint32 *)src);
00096     
00097     d.b[0] = s.b[3];
00098     d.b[1] = s.b[2];
00099     d.b[2] = s.b[1];
00100     d.b[3] = s.b[0];
00101     
00102     *( ( Cigi_uint32 *)dest) = d.i;
00103 }

void CIGI_SPEC CigiSwap8 ( void *  dest,
const void *  src 
)

Byte swaps the double word pointed to by src
and places the result into the double word pointed to by dest.

Parameters:
dest - Specifies where the byte swapped double word should be placed
src - Specifies the source double word to byte swap.

Definition at line 108 of file CigiSwapping.cpp.

References _SWAP_UNION::b, and _SWAP_UNION::i.

Referenced by CigiSensorXRespV3::Unpack(), CigiPositionRespV3::Unpack(), CigiLosXRespV3_2::Unpack(), CigiLosXRespV3::Unpack(), CigiLosVectReqV3_2::Unpack(), CigiLosVectReqV3::Unpack(), CigiLosSegReqV3_2::Unpack(), CigiLosSegReqV3::Unpack(), CigiLosRespV3_2::Unpack(), CigiLosRespV3::Unpack(), CigiHatHotXRespV3_2::Unpack(), CigiHatHotXRespV3::Unpack(), CigiHatHotRespV3_2::Unpack(), CigiHatHotRespV3::Unpack(), CigiHatHotReqV3_2::Unpack(), CigiHatHotReqV3::Unpack(), CigiEnvRgnCtrlV3::Unpack(), CigiEnvCondReqV3::Unpack(), CigiEntityCtrlV3_3::Unpack(), CigiEntityCtrlV3::Unpack(), CigiEarthModelDefV3::Unpack(), and CigiConfClampEntityCtrlV3::Unpack().

00109 {
00110     static SWAP_UNION d1, s1;
00111     static SWAP_UNION d2, s2;
00112     
00113     /* Do each word separately.  Each pair of variables should be enclosed within 
00114      * braces to minimize the number of variables declared as "register."
00115      */    
00116     
00117     s1.i = *( ( Cigi_uint32 *)src);
00118     s2.i = *( ( Cigi_uint32 *)src + 1);
00119     
00120     d1.b[0] = s1.b[3];
00121     d1.b[1] = s1.b[2];
00122     d1.b[2] = s1.b[1];
00123     d1.b[3] = s1.b[0];     
00124     
00125     d2.b[0] = s2.b[3];
00126     d2.b[1] = s2.b[2];
00127     d2.b[2] = s2.b[1];
00128     d2.b[3] = s2.b[0];
00129     
00130     *( ( Cigi_uint32 *)dest) = d2.i;
00131     *( ( Cigi_uint32 *)dest + 1) = d1.i;
00132 }


Generated on Wed Apr 29 09:00:01 2009 for CCL by  doxygen 1.4.7