61 bool isFinished()
const;
90 bool getEnableSerialization( )
const;
133 virtual ~Serializable();
143 void setDynamicallyAllocated();
145 bool isDynamicallyAllocated() const;
153 friend class InputArchive;
154 friend class OutputArchive;
157 void setArchive( InputArchive* archive );
160 InputArchive* getArchive( );
165 static StorageAgent* s_storageAgent;
169 DYNAMICALLY_ALLOCATED = 2
185 bool m_serializationEnabled;
186 static bool s_uuidGeneration_enabled;
190 #define AGXSTREAM_CLASS_NAME(T) \
192 inline const char* getClassName() const override { return #T; } \
195 #define AGXSTREAM_DECLARE_SERIALIZABLE_BASE( T ) \
196 inline agxStream::StorageAgent* getStorageAgent() const override { return agxStream::StorageManager::instance()->find( #T ); } \
197 inline static const char* getConstructClassId() { return #T; } \
198 friend class agxStream::DefStorageAgent<T>; \
199 AGXSTREAM_CLASS_NAME(T) \
200 static agxStream::Serializable *create() { return new T(); } \
201 virtual void store( agxStream::OutputArchive& out ) const override;\
202 virtual void restore( agxStream::InputArchive& in ) override
207 #define AGXSTREAM_DECLARE_SERIALIZABLE( T ) \
208 AGXSTREAM_DECLARE_SERIALIZABLE_BASE(T); \
209 static agxStream::Serializable *create(agxStream::InputArchive& ) { return new T(); }
214 #define AGXSTREAM_DECLARE_SERIALIZABLE_CUSTOM_CREATE( T ) \
215 AGXSTREAM_DECLARE_SERIALIZABLE_BASE(T); \
216 static agxStream::Serializable *create(agxStream::InputArchive& in)
221 #define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE( T ) \
222 inline agxStream::StorageAgent* getStorageAgent() const override { return agxStream::StorageManager::instance()->find(#T); } \
223 inline static const char* getConstructClassId() { return #T; } \
224 AGXSTREAM_CLASS_NAME(T)
227 #define AGXSTREAM_INSTANTIATE_STORAGE( C ) \
228 static agxStream::Storage<C> storage ## C;
231 #define AGXSTREAM_INSTANTIATE_STORAGE_VARIABLE( V,C ) \
232 static agxStream::Storage<C> storage ## V;
235 #define AGXARCHIVE_MODIFICATIONS(...) {__VA_ARGS__}
244 #define AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATION_CHECK_VARIABLE( V, DEFAULT_CLASS, DEPRECATED_CLASS, MODIFICATION_LIST ) \
245 static agxStream::DeprecatedStorage<DEFAULT_CLASS, DEPRECATED_CLASS> V(MODIFICATION_LIST);
255 return (m_flags & FINISHED) != 0;
260 return (m_flags & DYNAMICALLY_ALLOCATED) != 0;
276 return m_serializationEnabled;
282 #define AGXSTREAM_DECLARE_SERIALIZABLE( T )
283 #define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE( T )
284 #define AGXSTREAM_DECLARE_SERIALIZABLE_CUSTOM_CREATE( T )
Class for writing serialized data in binary format to a stream.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
agx::Uuid getUuid() const
agx::UInt32 getIndex() const
This index is given at creation of this object.
void setFinished()
Tells this class that it is restored correctly and should not be deleted during destruction of an Arc...
Serializable()
Default constructor.
virtual const char * getClassName() const
void setUuid(const agx::Uuid &uuid)
Explicitly set a Uuid on a serializable object.
void setEnableSerialization(bool flag)
Set to false to disable serialization of this object.
virtual StorageAgent * getStorageAgent() const =0
bool getEnableSerialization() const
bool getEnableUuidGeneration()
Serializable(const Serializable &other)
Copy constructor.
virtual ~Serializable()
Destructor for normal C++ use but hidden from SWIG bindings.
static void setEnableUuidGeneration(bool flag)
Specify if there should be UUID:s generated for each new Serializable object. By default it is enable...
Abstract base class for storing/restoring a line/drums with version control.
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.