#include "CigiTypes.h"
Go to the source code of this file.
Classes | |
union | _SWAP_UNION |
Defines | |
#define | _EXPORT_CCL_ |
Typedefs | |
typedef _SWAP_UNION | SWAP_UNION |
Functions | |
CIGI_SPEC void | CigiSwap2 (void *dest, const void *src) |
CIGI_SPEC void | CigiSwap4 (void *dest, const void *src) |
CIGI_SPEC void | CigiSwap8 (void *dest, const void *src) |
CIGI_SPEC void | CigiCopy8 (void *dest, const void *src) |
#define _EXPORT_CCL_ |
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: CigiSwapping.cpp 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 Defined _EXPORT_CCL_ for exporting the class in a Windows DLL.
01/21/2005 Greg Basler Version 1.5 Removed the inline defnitions for the PackedPointer union and included the CigiTypes.h header.
01/21/2005 Greg Basler Version 1.5 Added modifiers to export the CigiSwap2, CigiSwap4, and CigiSwap8 functions when built as a Windows DLL.
01/21/2005 Greg Basler Version 1.5 Changed native C++ types to use CCL-defined types instead where appropriate.
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.cpp.
typedef union _SWAP_UNION SWAP_UNION |
Definition at line 70 of file CigiSwapping.cpp.
CIGI_SPEC void CigiCopy8 | ( | void * | dest, | |
const void * | src | |||
) | [inline] |
Copies the double word pointed to by src into the
double word pointed to by dest.
_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 }
CIGI_SPEC void 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.
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 CigiAnimationStopV3::Unpack(), CigiArtPartCtrlV3::Unpack(), CigiCollDetSegDefV3::Unpack(), CigiCollDetSegRespV3::Unpack(), CigiCollDetVolDefV3::Unpack(), CigiCollDetVolRespV3::Unpack(), CigiCompCtrlV3::Unpack(), CigiCompCtrlV3_3::Unpack(), CigiConfClampEntityCtrlV3::Unpack(), CigiEntityCtrlV3::Unpack(), CigiEntityCtrlV3_3::Unpack(), CigiEnvRgnCtrlV3::Unpack(), CigiEventNotificationV3::Unpack(), CigiHatHotReqV3::Unpack(), CigiHatHotReqV3_2::Unpack(), CigiHatHotRespV3::Unpack(), CigiHatHotRespV3_2::Unpack(), CigiHatHotXRespV3::Unpack(), CigiHatHotXRespV3_2::Unpack(), CigiIGMsgV3::Unpack(), CigiLosRespV3::Unpack(), CigiLosRespV3_2::Unpack(), CigiLosSegReqV3::Unpack(), CigiLosSegReqV3_2::Unpack(), CigiLosVectReqV3::Unpack(), CigiLosVectReqV3_2::Unpack(), CigiLosXRespV3::Unpack(), CigiLosXRespV3_2::Unpack(), CigiMaritimeSurfaceCtrlV3::Unpack(), CigiMotionTrackCtrlV3::Unpack(), CigiPositionReqV3::Unpack(), CigiPositionRespV3::Unpack(), CigiRateCtrlV3::Unpack(), CigiRateCtrlV3_2::Unpack(), CigiSensorCtrlV3::Unpack(), CigiSensorRespV3::Unpack(), CigiSensorXRespV3::Unpack(), CigiShortArtPartCtrlV3::Unpack(), CigiShortCompCtrlV3::Unpack(), CigiShortCompCtrlV3_3::Unpack(), CigiShortSymbolCtrlV3_3::Unpack(), CigiSymbolCircleDefV3_3::Unpack(), CigiSymbolCloneV3_3::Unpack(), CigiSymbolCtrlV3_3::Unpack(), CigiSymbolLineDefV3_3::Unpack(), CigiSymbolSurfaceDefV3_3::Unpack(), CigiSymbolTextDefV3_3::Unpack(), CigiTerrestrialSurfaceCtrlV3::Unpack(), CigiTrajectoryDefV3::Unpack(), CigiViewCtrlV3::Unpack(), CigiViewDefV3::Unpack(), CigiWaveCtrlV3::Unpack(), and CigiWeatherCtrlV3::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 }
CIGI_SPEC void 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.
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 CigiAerosolRespV3::Unpack(), CigiArtPartCtrlV3::Unpack(), CigiAtmosCtrlV3::Unpack(), CigiCelestialCtrlV3::Unpack(), CigiCircleSymbolDataV3_3::Unpack(), CigiCollDetSegDefV3::Unpack(), CigiCollDetSegRespV3::Unpack(), CigiCollDetVolDefV3::Unpack(), CigiCompCtrlV3::Unpack(), CigiCompCtrlV3_3::Unpack(), CigiConfClampEntityCtrlV3::Unpack(), CigiEntityCtrlV3::Unpack(), CigiEntityCtrlV3_3::Unpack(), CigiEnvRgnCtrlV3::Unpack(), CigiEventNotificationV3::Unpack(), CigiHatHotXRespV3::Unpack(), CigiHatHotXRespV3_2::Unpack(), CigiIGCtrlV3::Unpack(), CigiIGCtrlV3_2::Unpack(), CigiIGCtrlV3_3::Unpack(), CigiLosSegReqV3::Unpack(), CigiLosSegReqV3_2::Unpack(), CigiLosVectReqV3::Unpack(), CigiLosVectReqV3_2::Unpack(), CigiLosXRespV3::Unpack(), CigiLosXRespV3_2::Unpack(), CigiMaritimeSurfaceCtrlV3::Unpack(), CigiMaritimeSurfaceRespV3::Unpack(), CigiPositionRespV3::Unpack(), CigiRateCtrlV3::Unpack(), CigiRateCtrlV3_2::Unpack(), CigiSensorCtrlV3::Unpack(), CigiSensorRespV3::Unpack(), CigiSensorXRespV3::Unpack(), CigiShortArtPartCtrlV3::Unpack(), CigiShortCompCtrlV3::Unpack(), CigiShortCompCtrlV3_3::Unpack(), CigiShortSymbolCtrlV3_3::Unpack(), CigiSOFV3::Unpack(), CigiSOFV3_2::Unpack(), CigiSymbolCircleDefV3_3::Unpack(), CigiSymbolCtrlV3_3::Unpack(), CigiSymbolLineDefV3_3::Unpack(), CigiSymbolSurfaceDefV3_3::Unpack(), CigiSymbolTextDefV3_3::Unpack(), CigiTerrestrialSurfaceRespV3::Unpack(), CigiTrajectoryDefV3::Unpack(), CigiVertexSymbolDataV3_3::Unpack(), CigiViewCtrlV3::Unpack(), CigiViewDefV3::Unpack(), CigiWaveCtrlV3::Unpack(), CigiWeatherCondRespV3::Unpack(), CigiWeatherCtrlV3::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 }
CIGI_SPEC void 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.
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 CigiConfClampEntityCtrlV3::Unpack(), CigiEarthModelDefV3::Unpack(), CigiEntityCtrlV3::Unpack(), CigiEntityCtrlV3_3::Unpack(), CigiEnvCondReqV3::Unpack(), CigiEnvRgnCtrlV3::Unpack(), CigiHatHotReqV3::Unpack(), CigiHatHotReqV3_2::Unpack(), CigiHatHotRespV3::Unpack(), CigiHatHotRespV3_2::Unpack(), CigiHatHotXRespV3::Unpack(), CigiHatHotXRespV3_2::Unpack(), CigiLosRespV3::Unpack(), CigiLosRespV3_2::Unpack(), CigiLosSegReqV3::Unpack(), CigiLosSegReqV3_2::Unpack(), CigiLosVectReqV3::Unpack(), CigiLosVectReqV3_2::Unpack(), CigiLosXRespV3::Unpack(), CigiLosXRespV3_2::Unpack(), CigiPositionRespV3::Unpack(), and CigiSensorXRespV3::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 }