11 #ifndef encodingImplHelpers_H_
12 #define encodingImplHelpers_H_
16 #include <vlutil/vlUtil.h>
18 #include <RTI/encoding/EncodingConfig.h>
27 #define IS_MACHINE_BIG_ENDIAN() ( (*(char*)&endianChecker) == 0 )
33 for(
int i = 0; i < ( theSize >> 1 ); ++i )
35 theEnd = ( theSize - 1 ) - i;
36 byteArray[ i ] ^= byteArray[ theEnd ];
37 byteArray[ theEnd ] ^= byteArray[ i ];
38 byteArray[ i ] ^= byteArray[ theEnd ];
45 unsigned short msbyte = rhs & 0x00ff;
46 unsigned short lsbyte = ( rhs & 0xff00 ) >> 8;
47 return ( msbyte << 8 ) | lsbyte;
53 return static_cast<Integer64
>(value);
58 return (static_cast<Integer64>(value.first) << 8) + value.second;
66 return ( msword << 16 ) | lsword;
73 unsigned int mspart =
endianSwap32Bit( static_cast<unsigned int>(rhs & 0xffffffff) );
74 unsigned int lspart =
endianSwap32Bit(static_cast<unsigned int>(( rhs >> 32 ) & 0xffffffff) );
75 return ( Integer64( mspart ) << 32 ) | lspart;
109 inline void appendBytes( std::vector<Octet>& wrapper,
const char* bytes,
size_t length )
113 unsigned int currentBufferSize = wrapper.size();
114 wrapper.resize( currentBufferSize + length );
115 memcpy( &wrapper[ currentBufferSize ], bytes, length );
119 inline unsigned int paddingSizeInBytes(
unsigned int bufferLength,
unsigned int elementOctetBoundary )
121 return MAKRti::alignedPadding(bufferLength, elementOctetBoundary);
125 inline void insertBytes( std::vector<Octet>& wrapper,
size_t length )
129 unsigned int currentBufferSize = wrapper.size();
130 wrapper.resize( currentBufferSize + length );
void swapByteArray(char *byteArray, int theSize)
Swap the byte array in memory.
Definition: encodingImplHelpers.h:30
unsigned int paddingSizeInBytes(unsigned int bufferLength, unsigned int elementOctetBoundary)
Get the padding for this element.
Definition: encodingImplHelpers.h:119
const int endianChecker
This checks whether the machine is Big Endian or Little Endian.
Definition: encodingImplHelpers.h:26
void appendBytes(std::vector< Octet > &wrapper, const char *bytes, size_t length)
append to a octet vector
Definition: encodingImplHelpers.h:109
Integer64 endianSwap64Bit(Integer64 rhs)
swap 64 bits
Definition: encodingImplHelpers.h:70
unsigned short endianSwap16Bit(unsigned short rhs)
swap 16 bits
Definition: encodingImplHelpers.h:43
unsigned int endianSwap32Bit(unsigned int rhs)
swap 32 bits
Definition: encodingImplHelpers.h:62
double endianSwap64BitDouble(double rhs)
Definition: encodingImplHelpers.h:94
void insertBytes(std::vector< Octet > &wrapper, size_t length)
Insert bytes into the octet buffer.
Definition: encodingImplHelpers.h:125
float endianSwap32BitFloat(float rhs)
swap 32 bit float
Definition: encodingImplHelpers.h:79
Integer64 valueHash(T value)
Definition: encodingImplHelpers.h:51