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
186 bool m_serializationEnabled;
187 static bool s_uuidGeneration_enabled;
191#define AGXSTREAM_CLASS_NAME(T) \
193 inline const char* getClassName() const override { return #T; } \
196#define AGXSTREAM_DECLARE_SERIALIZABLE_BASE( T ) \
197 inline agxStream::StorageAgent* getStorageAgent() const override { return agxStream::StorageManager::instance()->find( #T ); } \
198 inline static const char* getConstructClassId() { return #T; } \
199 friend class agxStream::DefStorageAgent<T>; \
200 AGXSTREAM_CLASS_NAME(T) \
201 static agxStream::Serializable *create() { return new T(); } \
202 virtual void store( agxStream::OutputArchive& out ) const override;\
203 virtual void restore( agxStream::InputArchive& in ) override
208#define AGXSTREAM_DECLARE_SERIALIZABLE( T ) \
209 AGXSTREAM_DECLARE_SERIALIZABLE_BASE(T); \
210 static agxStream::Serializable *create(agxStream::InputArchive& ) { return new T(); }
215#define AGXSTREAM_DECLARE_SERIALIZABLE_CUSTOM_CREATE( T ) \
216 AGXSTREAM_DECLARE_SERIALIZABLE_BASE(T); \
217 static agxStream::Serializable *create(agxStream::InputArchive& in)
222#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE( T ) \
223 inline agxStream::StorageAgent* getStorageAgent() const override { return agxStream::StorageManager::instance()->find(#T); } \
224 inline static const char* getConstructClassId() { return #T; } \
225 AGXSTREAM_CLASS_NAME(T)
228#define AGXSTREAM_INSTANTIATE_STORAGE( C ) \
229 static agxStream::Storage<C> storage ## C;
232#define AGXSTREAM_INSTANTIATE_STORAGE_VARIABLE( V,C ) \
233 static agxStream::Storage<C> storage ## V;
236#define AGXARCHIVE_MODIFICATIONS(...) {__VA_ARGS__}
245#define AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATION_CHECK_VARIABLE( VARIABLE, NEW_CLASS, DEPRECATED_CLASS, MODIFICATION_LIST ) \
246 static agxStream::DeprecatedStorage<NEW_CLASS, DEPRECATED_CLASS> VARIABLE(MODIFICATION_LIST);
254#define AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATED_CLASS( VARIABLE, NAMESPACE, CLASS_NAME, DEPRECATED_CLASS_NAME ) \
255namespace NAMESPACE { \
257 class CLASS_NAME : public DEPRECATED_CLASS_NAME \
261 AGXSTREAM_DECLARE_SERIALIZABLE(NAMESPACE::CLASS_NAME); \
263 void CLASS_NAME::store(agxStream::OutputArchive&) const { LOGGER_ERROR() << #NAMESPACE << "::" << #CLASS_NAME << " is deprecated and should never be stored" << LOGGER_ENDL(); } \
264 void CLASS_NAME::restore(agxStream::InputArchive&) { LOGGER_ERROR() << #NAMESPACE << "::" << #CLASS_NAME << " is deprecated and should never be restored" << LOGGER_ENDL(); } \
266static agxStream::DeprecatedStorage<NAMESPACE::CLASS_NAME, DEPRECATED_CLASS_NAME> VARIABLE(AGXARCHIVE_MODIFICATIONS("\\-##-//83ddfJ4Dj"));
277 return (m_flags & FINISHED) != 0;
282 return (m_flags & DYNAMICALLY_ALLOCATED) != 0;
295 return m_serializationEnabled;
301 #define AGXSTREAM_DECLARE_SERIALIZABLE( T )
302 #define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE( T )
303 #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...
virtual const char * getClassName() const
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.
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.
bool getEnableSerialization() const
bool getEnableUuidGeneration()
Serializable(const Serializable &other)
Copy constructor.
virtual ~Serializable()
Destructor for normal C++ use but hidden from SWIG bindings.
virtual StorageAgent * getStorageAgent() const =0
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...
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...