15 #ifndef OM_FORMAT_EXT_HXX
16 #define OM_FORMAT_EXT_HXX
31 template<
typename T >
size_t store( mds::mod::CChannel& _os,
const T& _val, OMFormat::Chunk::Integer_Size _b,
bool _swap, t_signed)
33 assert( OMFormat::is_integer( _val ) );
37 case OMFormat::Chunk::Integer_8:
39 OMFormat::int8 v =
static_cast<OMFormat::int8
>(_val);
40 return store( _os, v, _swap );
42 case OMFormat::Chunk::Integer_16:
44 OMFormat::int16 v =
static_cast<OMFormat::int16
>(_val);
45 return store( _os, v, _swap );
47 case OMFormat::Chunk::Integer_32:
49 OMFormat::int32 v =
static_cast<OMFormat::int32
>(_val);
50 return store( _os, v, _swap );
52 case OMFormat::Chunk::Integer_64:
54 OMFormat::int64 v =
static_cast<OMFormat::int64
>(_val);
55 return store( _os, v, _swap );
70 template<
typename T >
size_t store( mds::mod::CChannel& _os,
const T& _val, OMFormat::Chunk::Integer_Size _b,
bool _swap, t_unsigned)
72 assert( OMFormat::is_integer( _val ) );
76 case OMFormat::Chunk::Integer_8:
78 OMFormat::uint8 v =
static_cast<OMFormat::uint8
>(_val);
79 return store( _os, v, _swap );
81 case OMFormat::Chunk::Integer_16:
83 OMFormat::uint16 v =
static_cast<OMFormat::uint16
>(_val);
84 return store( _os, v, _swap );
86 case OMFormat::Chunk::Integer_32:
88 OMFormat::uint32 v =
static_cast<OMFormat::uint32
>(_val);
89 return store( _os, v, _swap );
91 case OMFormat::Chunk::Integer_64:
93 OMFormat::uint64 v =
static_cast<OMFormat::uint64
>(_val);
94 return store( _os, v, _swap );
109 template<
typename T >
size_t restore( mds::mod::CChannel& _is, T& _val, OMFormat::Chunk::Integer_Size _b,
bool _swap, t_signed)
111 assert( OMFormat::is_integer( _val ) );
116 case OMFormat::Chunk::Integer_8:
119 bytes =
restore( _is, v, _swap );
120 _val =
static_cast<T
>(v);
123 case OMFormat::Chunk::Integer_16:
126 bytes =
restore( _is, v, _swap );
127 _val =
static_cast<T
>(v);
129 case OMFormat::Chunk::Integer_32:
132 bytes =
restore( _is, v, _swap );
133 _val =
static_cast<T
>(v);
135 case OMFormat::Chunk::Integer_64:
138 bytes =
restore( _is, v, _swap );
139 _val =
static_cast<T
>(v);
154 template<
typename T >
size_t restore( mds::mod::CChannel& _is, T& _val, OMFormat::Chunk::Integer_Size _b,
bool _swap, t_unsigned)
156 assert( OMFormat::is_integer( _val ) );
161 case OMFormat::Chunk::Integer_8:
164 bytes =
restore( _is, v, _swap );
165 _val =
static_cast<T
>(v);
168 case OMFormat::Chunk::Integer_16:
171 bytes =
restore( _is, v, _swap );
172 _val =
static_cast<T
>(v);
175 case OMFormat::Chunk::Integer_32:
178 bytes =
restore( _is, v, _swap );
179 _val =
static_cast<T
>(v);
182 case OMFormat::Chunk::Integer_64:
185 bytes =
restore( _is, v, _swap );
186 _val =
static_cast<T
>(v);