11 #ifndef encodingImplHelpers_H_
12 #define encodingImplHelpers_H_
16 #include <vlutil/vlUtil.h>
22 #define is_bigendian() ( (*(char*)&endianChecker) == 0 )
28 for(
int i = 0; i < ( theSize >> 1 ); ++i )
30 theEnd = ( theSize - 1 ) - i;
31 byteArray[ i ] ^= byteArray[ theEnd ];
32 byteArray[ theEnd ] ^= byteArray[ i ];
33 byteArray[ i ] ^= byteArray[ theEnd ];
40 unsigned short msbyte = rhs & 0x00ff;
41 unsigned short lsbyte = ( rhs & 0xff00 ) >> 8;
42 return ( msbyte << 8 ) | lsbyte;
50 return ( msword << 16 ) | lsword;
57 unsigned int mspart =
endianSwap32Bit( static_cast<unsigned int>(rhs & 0xffffffff) );
58 unsigned int lspart =
endianSwap32Bit(static_cast<unsigned int>(( rhs >> 32 ) & 0xffffffff) );
59 return ( Integer64( mspart ) << 32 ) | lspart;
93 inline void appendBytes( std::vector<Octet>& wrapper,
const char* bytes,
size_t length )
97 unsigned int currentBufferSize = wrapper.size();
98 wrapper.resize( currentBufferSize + length );
99 memcpy( &wrapper[ currentBufferSize ], bytes, length );
103 inline unsigned int paddingSizeInBytes(
unsigned int bufferLength,
unsigned int elementOctetBoundary )
105 return MAKRti::alignedPadding(bufferLength, elementOctetBoundary);
109 inline void insertBytes( std::vector<Octet>& wrapper,
size_t length )
113 unsigned int currentBufferSize = wrapper.size();
114 wrapper.resize( currentBufferSize + length );
void appendBytes(std::vector< Octet > &wrapper, const char *bytes, size_t length)
append to a octet vector
Definition: encodingImplHelpers.h:93
const int endianChecker
This checks whether the machine is Big Endian or Little Endian.
Definition: encodingImplHelpers.h:21
float endianSwap32BitFloat(float rhs)
swap 32 bit float
Definition: encodingImplHelpers.h:63
unsigned int paddingSizeInBytes(unsigned int bufferLength, unsigned int elementOctetBoundary)
Get the padding for this element.
Definition: encodingImplHelpers.h:103
unsigned short endianSwap16Bit(unsigned short rhs)
swap 16 bits
Definition: encodingImplHelpers.h:38
void swapByteArray(char *byteArray, int theSize)
Swap the byte array in memory.
Definition: encodingImplHelpers.h:25
double endianSwap64BitDouble(double rhs)
Definition: encodingImplHelpers.h:78
void insertBytes(std::vector< Octet > &wrapper, size_t length)
Insert bytes into the octet buffer.
Definition: encodingImplHelpers.h:109
Integer64 endianSwap64Bit(Integer64 rhs)
swap 64 bits
Definition: encodingImplHelpers.h:54
unsigned int endianSwap32Bit(unsigned int rhs)
swap 32 bits
Definition: encodingImplHelpers.h:46