|
@@ -53,6 +53,17 @@ namespace igl { namespace serialization { \
|
|
|
} \
|
|
|
}}
|
|
|
|
|
|
+#define SERIALIZE_TYPE_SOURCE(Type,Params) \
|
|
|
+namespace igl { namespace serialization { \
|
|
|
+ void _serialization(bool s,Type& obj,std::vector<char>& buffer) {Params} \
|
|
|
+ void _serialize(const Type& obj,std::vector<char>& buffer) { \
|
|
|
+ _serialization(true,const_cast<Type&>(obj),buffer); \
|
|
|
+ } \
|
|
|
+ void _deserialize(Type& obj,const std::vector<char>& buffer) { \
|
|
|
+ _serialization(false,obj,const_cast<std::vector<char>&>(buffer)); \
|
|
|
+ } \
|
|
|
+}}
|
|
|
+
|
|
|
#define SERIALIZE_MEMBER(Object) ::igl::serializer(s,obj.Object,std::string(#Object),buffer);
|
|
|
#define SERIALIZE_MEMBER_NAME(Object,Name) ::igl::serializer(s,obj.Object,std::string(Name),buffer);
|
|
|
|
|
@@ -1148,13 +1159,13 @@ namespace igl
|
|
|
template <typename T>
|
|
|
inline void serialize(const T& obj,std::vector<char>& buffer)
|
|
|
{
|
|
|
- std::cerr << typeid(obj).name() << " is not serializable: derive from igl::Serializable or overload the function igl::serialization::serialize(const T& obj,std::vector<char>& buffer)" << std::endl;
|
|
|
+ std::cerr << typeid(obj).name() << " is not serializable: derive from igl::Serializable or spezialize the template function igl::serialization::serialize(const T& obj,std::vector<char>& buffer)" << std::endl;
|
|
|
}
|
|
|
|
|
|
template <typename T>
|
|
|
inline void deserialize(T& obj,const std::vector<char>& buffer)
|
|
|
{
|
|
|
- std::cerr << typeid(obj).name() << " is not deserializable: derive from igl::Serializable or overload the function igl::serialization::deserialize(T& obj, const std::vector<char>& buffer)" << std::endl;
|
|
|
+ std::cerr << typeid(obj).name() << " is not deserializable: derive from igl::Serializable or spezialize the template function igl::serialization::deserialize(T& obj, const std::vector<char>& buffer)" << std::endl;
|
|
|
}
|
|
|
|
|
|
// helper functions
|