51#ifndef OPENMESH_SR_BINARY_HH
52#define OPENMESH_SR_BINARY_HH
77 const static size_t UnknownSize(
size_t(-1));
96template <
typename T,
typename =
void >
struct binary
104 static size_t size_of(
void) {
return UnknownSize; }
106 static size_t size_of(
const value_type&) {
return UnknownSize; }
118 std::ostringstream msg;
119 msg <<
"Type not supported: " <<
typeid(value_type).name();
120 throw std::logic_error(msg.str());
130 std::ostringstream msg;
131 msg <<
"Type not supported: " <<
typeid(value_type).name();
132 throw std::logic_error(msg.str());
static size_t restore(std::istream &, value_type &, bool=false, bool=true)
Restore a value of T and return the number of bytes read.
static const bool is_streamable
Can we store T? Set this to true in your specialization.
static size_t store(std::ostream &, const value_type &, bool=false, bool=true)
Store a value of T and return the number of bytes written.
static std::string type_identifier(void)
A string that identifies the type of T.
static size_t size_of(void)
What's the size of T? If it depends on the actual value (e.g. for vectors) return UnknownSize.
static size_t size_of(const value_type &)
What't the size of a specific value of type T.