added static function string_for_value_type (void) to binary struct
and adapted each instance
This commit is contained in:
@@ -106,6 +106,8 @@ template < typename T > struct binary
|
||||
static size_t size_of(void) { return UnknownSize; }
|
||||
static size_t size_of(const value_type&) { return UnknownSize; }
|
||||
|
||||
static std::string string_for_value_type (void) { return "UnknownType"; }
|
||||
|
||||
static
|
||||
size_t store( std::ostream& /* _os */,
|
||||
const value_type& /* _v */,
|
||||
|
||||
@@ -72,6 +72,9 @@
|
||||
#include <OpenMesh/Core/IO/SR_rbo.hh>
|
||||
#include <OpenMesh/Core/IO/SR_binary.hh>
|
||||
|
||||
|
||||
#include <OpenMesh/Core/Utils/typename.hh>
|
||||
|
||||
//== NAMESPACES ===============================================================
|
||||
|
||||
namespace OpenMesh {
|
||||
@@ -91,6 +94,7 @@ namespace IO {
|
||||
static const bool is_streamable = true; \
|
||||
static size_t size_of(const value_type&) { return sizeof(value_type); } \
|
||||
static size_t size_of(void) { return sizeof(value_type); } \
|
||||
static std::string string_for_value_type(void) { return get_string_for_type(value_type()); } \
|
||||
static size_t store( std::ostream& _os, const value_type& _val, \
|
||||
bool _swap=false) { \
|
||||
value_type tmp = _val; \
|
||||
@@ -142,6 +146,7 @@ SIMPLE_BINARY(uint64_t);
|
||||
static const bool is_streamable = true; \
|
||||
static size_t size_of(const value_type&) { return sizeof(value_type); } \
|
||||
static size_t size_of(void) { return sizeof(value_type); } \
|
||||
static std::string string_for_value_type(void) { return get_string_for_type(value_type()); } \
|
||||
static size_t store( std::ostream& _os, const value_type& _val, \
|
||||
bool _swap=false) { \
|
||||
value_type tmp = _val; \
|
||||
@@ -172,6 +177,7 @@ SIMPLE_BINARY(unsigned long);
|
||||
static const bool is_streamable = true; \
|
||||
static size_t size_of(void) { return sizeof(value_type); } \
|
||||
static size_t size_of(const value_type&) { return size_of(); } \
|
||||
static std::string string_for_value_type(void) { return get_string_for_type(value_type()); } \
|
||||
static size_t store( std::ostream& _os, const value_type& _val, \
|
||||
bool _swap=false) { \
|
||||
value_type tmp = _val; \
|
||||
@@ -222,7 +228,7 @@ template <> struct binary< std::string > {
|
||||
static size_t size_of() { return UnknownSize; }
|
||||
static size_t size_of(const value_type &_v)
|
||||
{ return sizeof(length_t) + _v.size(); }
|
||||
|
||||
static std::string string_for_value_type(void) { return get_string_for_type(value_type()); }
|
||||
static
|
||||
size_t store(std::ostream& _os, const value_type& _v, bool _swap=false)
|
||||
{
|
||||
@@ -264,6 +270,7 @@ template <> struct binary<OpenMesh::Attributes::StatusInfo>
|
||||
static size_t size_of() { return sizeof(status_t); }
|
||||
static size_t size_of(const value_type&) { return size_of(); }
|
||||
|
||||
static std::string string_for_value_type(void) { return "StatusInfo";}
|
||||
static size_t n_bytes(size_t _n_elem)
|
||||
{ return _n_elem*sizeof(status_t); }
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ template <> struct binary< std::vector<bool> >
|
||||
{
|
||||
return _v.size() / 8 + ((_v.size() % 8)!=0);
|
||||
}
|
||||
|
||||
static std::string string_for_value_type(void) { return get_string_for_type(value_type()); }
|
||||
static
|
||||
size_t store( std::ostream& _ostr, const value_type& _v, bool )
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ template <> struct binary< std::vector< T > > { \
|
||||
\
|
||||
static size_t size_of(const value_type& _v) \
|
||||
{ return sizeof(elem_type)*_v.size(); } \
|
||||
\
|
||||
static std::string string_for_value_type(void) { return get_string_for_type(value_type()); }\
|
||||
static \
|
||||
size_t store(std::ostream& _os, const value_type& _v, bool _swap=false) { \
|
||||
size_t bytes=0; \
|
||||
|
||||
@@ -23,6 +23,7 @@ template <> struct binary< std::vector< std::string > >
|
||||
static size_t size_of(const value_type& _v)
|
||||
{ return std::accumulate( _v.begin(), _v.end(), size_t(0), Sum() ); }
|
||||
|
||||
static std::string string_for_value_type(void) { return get_string_for_type(value_type()); }
|
||||
static
|
||||
size_t store(std::ostream& _os, const value_type& _v, bool _swap=false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user