1 #ifndef CARMA_UTIL_BYTE_STRINGIFIER_H
2 #define CARMA_UTIL_BYTE_STRINGIFIER_H
12 class ByteStringifier {
16 MAX_CHARS_PER_VALUE = 3
19 explicit ByteStringifier( );
21 virtual ~ByteStringifier( );
23 ::size_t stringifyByte(
unsigned char v,
25 ::
size_t bufferMaxCount )
const;
29 ByteStringifier(
const ByteStringifier & rhs );
30 ByteStringifier & operator=(
const ByteStringifier & rhs );
32 const char *
const table_;
41 carma::util::ByteStringifier::stringifyByte(
42 const unsigned char v,
44 const ::size_t bufferMaxCount )
const
46 if ( (bufferMaxCount < MAX_CHARS_PER_VALUE) || (MAX_CHARS_PER_VALUE < 3) )
49 const unsigned int i =
static_cast< unsigned int >( v ) * 4U;
51 buffer[ 0 ] = table_[ i + 0 ];
52 buffer[ 1 ] = table_[ i + 1 ];
53 buffer[ 2 ] = table_[ i + 2 ];
Exception class for errors.
#define CARMA_ERROR(y)
Trick to get the file name and line number passed to the exception handler.