15#ifdef JPH_OBJECT_STREAM
18#define JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, prefix, class_name) \
19 linkage prefix bool OSReadData(IObjectStreamIn &ioStream, class_name &inInstance); \
20 linkage prefix bool OSReadData(IObjectStreamIn &ioStream, class_name *&inPointer); \
21 linkage prefix bool OSIsType(class_name *, int inArrayDepth, EOSDataType inDataType, const char *inClassName); \
22 linkage prefix bool OSIsType(class_name **, int inArrayDepth, EOSDataType inDataType, const char *inClassName); \
23 linkage prefix void OSWriteData(IObjectStreamOut &ioStream, const class_name &inInstance); \
24 linkage prefix void OSWriteData(IObjectStreamOut &ioStream, class_name *const &inPointer); \
25 linkage prefix void OSWriteDataType(IObjectStreamOut &ioStream, class_name *); \
26 linkage prefix void OSWriteDataType(IObjectStreamOut &ioStream, class_name **);
29#define JPH_IMPLEMENT_SERIALIZATION_FUNCTIONS(class_name) \
30 bool OSReadData(IObjectStreamIn &ioStream, class_name &inInstance) \
32 return ioStream.ReadClassData(#class_name, (void *)&inInstance); \
34 bool OSReadData(IObjectStreamIn &ioStream, class_name *&inPointer) \
36 return ioStream.ReadPointerData(JPH_RTTI(class_name), (void **)&inPointer); \
38 bool OSIsType(class_name *, int inArrayDepth, EOSDataType inDataType, const char *inClassName) \
40 return inArrayDepth == 0 && inDataType == EOSDataType::Instance && strcmp(inClassName, #class_name) == 0; \
42 bool OSIsType(class_name **, int inArrayDepth, EOSDataType inDataType, const char *inClassName) \
44 return inArrayDepth == 0 && inDataType == EOSDataType::Pointer && strcmp(inClassName, #class_name) == 0; \
46 void OSWriteData(IObjectStreamOut &ioStream, const class_name &inInstance) \
48 ioStream.WriteClassData(JPH_RTTI(class_name), (void *)&inInstance); \
50 void OSWriteData(IObjectStreamOut &ioStream, class_name *const &inPointer) \
53 ioStream.WritePointerData(GetRTTI(inPointer), (void *)inPointer); \
55 ioStream.WritePointerData(nullptr, nullptr); \
57 void OSWriteDataType(IObjectStreamOut &ioStream, class_name *) \
59 ioStream.WriteDataType(EOSDataType::Instance); \
60 ioStream.WriteName(#class_name); \
62 void OSWriteDataType(IObjectStreamOut &ioStream, class_name **) \
64 ioStream.WriteDataType(EOSDataType::Pointer); \
65 ioStream.WriteName(#class_name); \
70#define JPH_DECLARE_SERIALIZATION_FUNCTIONS(...)
71#define JPH_IMPLEMENT_SERIALIZATION_FUNCTIONS(...)
80#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(linkage, class_name) \
82 JPH_DECLARE_RTTI_NON_VIRTUAL(linkage, class_name) \
83 JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, friend, class_name) \
86#define JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(class_name) \
87 JPH_IMPLEMENT_SERIALIZATION_FUNCTIONS(class_name) \
88 JPH_IMPLEMENT_RTTI_NON_VIRTUAL(class_name) \
95#define JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(linkage, class_name) \
96 JPH_DECLARE_RTTI_OUTSIDE_CLASS(linkage, class_name) \
97 JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, extern, class_name) \
100#define JPH_IMPLEMENT_SERIALIZABLE_OUTSIDE_CLASS(class_name) \
101 JPH_IMPLEMENT_SERIALIZATION_FUNCTIONS(class_name) \
102 JPH_IMPLEMENT_RTTI_OUTSIDE_CLASS(class_name) \
109#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(linkage, class_name) \
111 JPH_DECLARE_RTTI_VIRTUAL(linkage, class_name) \
112 JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, friend, class_name) \
115#define JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(class_name) \
116 JPH_IMPLEMENT_SERIALIZATION_FUNCTIONS(class_name) \
117 JPH_IMPLEMENT_RTTI_VIRTUAL(class_name) \
120#define JPH_DECLARE_SERIALIZABLE_ABSTRACT(linkage, class_name) \
122 JPH_DECLARE_RTTI_ABSTRACT(linkage, class_name) \
123 JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, friend, class_name) \
126#define JPH_IMPLEMENT_SERIALIZABLE_ABSTRACT(class_name) \
127 JPH_IMPLEMENT_SERIALIZATION_FUNCTIONS(class_name) \
128 JPH_IMPLEMENT_RTTI_ABSTRACT(class_name) \
131#define JPH_DECLARE_SERIALIZABLE_VIRTUAL_BASE(linkage, class_name) \
133 JPH_DECLARE_RTTI_VIRTUAL_BASE(linkage, class_name) \
134 JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, friend, class_name) \
137#define JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL_BASE(class_name) \
138 JPH_IMPLEMENT_SERIALIZATION_FUNCTIONS(class_name) \
139 JPH_IMPLEMENT_RTTI_VIRTUAL_BASE(class_name) \
142#define JPH_DECLARE_SERIALIZABLE_ABSTRACT_BASE(linkage, class_name) \
144 JPH_DECLARE_RTTI_ABSTRACT_BASE(linkage, class_name) \
145 JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, friend, class_name) \
148#define JPH_IMPLEMENT_SERIALIZABLE_ABSTRACT_BASE(class_name) \
149 JPH_IMPLEMENT_SERIALIZATION_FUNCTIONS(class_name) \
150 JPH_IMPLEMENT_RTTI_ABSTRACT_BASE(class_name)
#define JPH_EXPORT
Definition: Core.h:236
#define JPH_NAMESPACE_END
Definition: Core.h:378
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
#define JPH_DECLARE_SERIALIZABLE_ABSTRACT_BASE(linkage, class_name)
Definition: SerializableObject.h:142
Class that makes another class non-copyable. Usage: Inherit from NonCopyable.
Definition: NonCopyable.h:11
Definition: SerializableObject.h:156
virtual ~SerializableObject()=default
Constructor.