43 template<
typename T >
55 template<
typename T >
62 template<
typename T , u
int32_t WIDTH >
65 uint32_t lSize (
sizeof ( T ) << 3 );
66 aStr.write (
"0b" , 2 );
67 int32_t i ( WIDTH-lSize );
79 lMask <<= ( lSize-1 );
81 for ( uint32_t i=0 ; i!=lSize ; ++i )
83 aStr.put ( ( lValue & lMask ) ?
'1':
'0' );
89 template<
typename T , u
int32_t WIDTH >
92 static const char* lCharacterMapping (
"9876543210123456789" );
93 static const char* lCharacterMappingCenter ( lCharacterMapping + 9 );
104 *lPtr++ = * ( lCharacterMappingCenter + tmp_value - ( value * 10 ) );
108 int32_t i ( WIDTH- ( lPtr-lBuffer ) );
120 aStr.put ( * ( --lPtr ) );
122 while ( lPtr!=lBuffer );
126 template<
typename T , u
int32_t WIDTH >
129 uint32_t lSize (
sizeof ( T ) << 1 );
130 static const char* lCharacterMapping (
"0123456789ABCDEF" );
131 aStr.write (
"0x" , 2 );
132 int32_t i ( WIDTH-lSize );
143 uint8_t* lPtr ( lStart +
sizeof ( T ) );
148 aStr.put ( * ( lCharacterMapping + ( ( ( *lPtr ) &0xF0 ) >>4 ) ) );
149 aStr.put ( * ( lCharacterMapping + ( ( ( *lPtr ) &0x0F ) ) ) );
151 while ( lPtr!=lStart );
157 template<
typename T , u
int32_t WIDTH >
162 aStr.write (
"0b0" , 3 );
166 uint32_t lSize (
sizeof ( T ) <<3 );
167 aStr.write (
"0b" , 2 );
170 lMask <<= ( lSize-1 );
171 bool lPrint (
false );
172 bool lCurrent (
false );
174 for ( uint32_t i=0 ; i!=lSize ; ++i )
176 lCurrent = lValue & lMask;
178 if ( (lPrint |= lCurrent) )
180 aStr.put ( lCurrent?
'1':
'0' );
190 template<
typename T , u
int32_t WIDTH >
193 static const char* lCharacterMapping (
"9876543210123456789" );
194 static const char* lCharacterMappingCenter ( lCharacterMapping + 9 );
196 char* lPtr = lBuffer;
205 *lPtr++ = * ( lCharacterMappingCenter + tmp_value - ( value * 10 ) );
211 aStr.put ( * ( --lPtr ) );
213 while ( lPtr!=lBuffer );
218 template<
typename T , u
int32_t WIDTH >
221 static const char* lCharacterMapping (
"0123456789ABCDEF" );
225 aStr.write (
"0x0" , 3 );
229 uint32_t lSize (
sizeof ( T ) );
230 aStr.write (
"0x" , 2 );
231 bool lPrint (
false );
234 uint8_t* lPtr ( lStart + lSize );
239 lPos = ( ( ( *lPtr ) &0xF0 ) >>4 );
241 if ( (lPrint |= (
bool ) ( lPos )) )
243 aStr.put ( * ( lCharacterMapping + lPos ) );
246 lPos = ( ( *lPtr ) &0x0F );
248 if ( (lPrint |= (
bool ) ( lPos )) )
250 aStr.put ( * ( lCharacterMapping + lPos ) );
253 while ( lPtr!=lStart );
259 template<
typename FORMAT >
260 std::ostream& operator<< ( std::ostream& aStr , const uhal::_Integer< uint8_t , FORMAT >& aInt )
266 template<
typename FORMAT >
267 std::ostream& operator<< ( std::ostream& aStr , const uhal::_Integer< int8_t , FORMAT >& aInt )
273 template<
typename FORMAT >
274 std::ostream& operator<< ( std::ostream& aStr , const uhal::_Integer< uint16_t , FORMAT >& aInt )
280 template<
typename FORMAT >
281 std::ostream& operator<< ( std::ostream& aStr , const uhal::_Integer< int16_t , FORMAT >& aInt )
287 template<
typename FORMAT >
288 std::ostream& operator<< ( std::ostream& aStr , const uhal::_Integer< uint32_t , FORMAT >& aInt )
294 template<
typename FORMAT >
295 std::ostream& operator<< ( std::ostream& aStr , const uhal::_Integer< int32_t , FORMAT >& aInt )
301 template<
typename FORMAT >
302 std::ostream& operator<< ( std::ostream& aStr , const uhal::_Integer< uint64_t , FORMAT >& aInt )
308 template<
typename FORMAT >
309 std::ostream& operator<< ( std::ostream& aStr , const uhal::_Integer< int64_t , FORMAT >& aInt )
316 template<
typename FORMAT >
317 std::ostream& operator<< ( std::ostream& aStr , const uhal::_Integer< size_t , FORMAT >& aInt )
Forward declare an ultra-lightweight wrapper which does formatting of numbers only on demand...
Empty struct which acts as a dummy variable for passing the formatting information around...
void print(std::ostream &aStr, const tm *aTm, const uint32_t &aUsec)
Format a time element for for sending to the log.
void sign_helper(std::ostream &aStr, const T &aInt)
Helper function for adding the '+'/'-' sign.
_Integer< T, IntFmt<> > Integer(const T &aT)
Forward declare a function which creates an instance of the ultra-lightweight wrapper from an integer...