57 #define OPENMESH_IO_OMFORMAT_CC
62 #include <OpenMesh/Core/IO/OMFormat.hh>
72 template<
typename T >
74 store( std::ostream& _os,
76 OMFormat::Chunk::Integer_Size _b,
80 assert( OMFormat::is_integer( _val ) );
84 case OMFormat::Chunk::Integer_8:
86 OMFormat::int8 v =
static_cast<OMFormat::int8
>(_val);
87 return store( _os, v, _swap );
89 case OMFormat::Chunk::Integer_16:
91 OMFormat::int16 v =
static_cast<OMFormat::int16
>(_val);
92 return store( _os, v, _swap );
94 case OMFormat::Chunk::Integer_32:
96 OMFormat::int32 v =
static_cast<OMFormat::int32
>(_val);
97 return store( _os, v, _swap );
99 case OMFormat::Chunk::Integer_64:
101 OMFormat::int64 v =
static_cast<OMFormat::int64
>(_val);
102 return store( _os, v, _swap );
110 template<
typename T >
112 store( std::ostream& _os,
114 OMFormat::Chunk::Integer_Size _b,
118 assert( OMFormat::is_integer( _val ) );
122 case OMFormat::Chunk::Integer_8:
124 OMFormat::uint8 v =
static_cast<OMFormat::uint8
>(_val);
125 return store( _os, v, _swap );
127 case OMFormat::Chunk::Integer_16:
129 OMFormat::uint16 v =
static_cast<OMFormat::uint16
>(_val);
130 return store( _os, v, _swap );
132 case OMFormat::Chunk::Integer_32:
134 OMFormat::uint32 v =
static_cast<OMFormat::uint32
>(_val);
135 return store( _os, v, _swap );
138 case OMFormat::Chunk::Integer_64:
140 OMFormat::uint64 v =
static_cast<OMFormat::uint64
>(_val);
141 return store( _os, v, _swap );
149 template<
typename T >
151 restore( std::istream& _is,
153 OMFormat::Chunk::Integer_Size _b,
157 assert( OMFormat::is_integer( _val ) );
162 case OMFormat::Chunk::Integer_8:
165 bytes = restore( _is, v, _swap );
166 _val =
static_cast<T
>(v);
169 case OMFormat::Chunk::Integer_16:
172 bytes = restore( _is, v, _swap );
173 _val =
static_cast<T
>(v);
175 case OMFormat::Chunk::Integer_32:
178 bytes = restore( _is, v, _swap );
179 _val =
static_cast<T
>(v);
181 case OMFormat::Chunk::Integer_64:
184 bytes = restore( _is, v, _swap );
185 _val =
static_cast<T
>(v);
193 template<
typename T >
195 restore( std::istream& _is,
197 OMFormat::Chunk::Integer_Size _b,
201 assert( OMFormat::is_integer( _val ) );
206 case OMFormat::Chunk::Integer_8:
209 bytes = restore( _is, v, _swap );
210 _val =
static_cast<T
>(v);
213 case OMFormat::Chunk::Integer_16:
216 bytes = restore( _is, v, _swap );
217 _val =
static_cast<T
>(v);
220 case OMFormat::Chunk::Integer_32:
223 bytes = restore( _is, v, _swap );
224 _val =
static_cast<T
>(v);
228 case OMFormat::Chunk::Integer_64:
231 bytes = restore( _is, v, _swap );
232 _val =
static_cast<T
>(v);