60 bool isFinished()
const;
89 bool getEnableSerialization( )
const;
132 virtual ~Serializable();
142 void setDynamicallyAllocated();
144 bool isDynamicallyAllocated() const;
152 friend class InputArchive;
153 friend class OutputArchive;
156 void setArchive( InputArchive* archive );
159 InputArchive* getArchive( );
164 static StorageAgent* s_storageAgent;
168 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( VARIABLE, NEW_CLASS, DEPRECATED_CLASS, MODIFICATION_LIST ) \
245 static agxStream::DeprecatedStorage<NEW_CLASS, DEPRECATED_CLASS> VARIABLE(MODIFICATION_LIST);
253#define AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATED_CLASS( VARIABLE, NAMESPACE, CLASS_NAME, DEPRECATED_CLASS_NAME ) \
254namespace NAMESPACE { \
256 class CLASS_NAME : public DEPRECATED_CLASS_NAME \
260 AGXSTREAM_DECLARE_SERIALIZABLE(NAMESPACE::CLASS_NAME); \
262 void CLASS_NAME::store(agxStream::OutputArchive&) const { LOGGER_ERROR() << #NAMESPACE << "::" << #CLASS_NAME << " is deprecated and should never be stored" << LOGGER_ENDL(); } \
263 void CLASS_NAME::restore(agxStream::InputArchive&) { LOGGER_ERROR() << #NAMESPACE << "::" << #CLASS_NAME << " is deprecated and should never be restored" << LOGGER_ENDL(); } \
265static agxStream::DeprecatedStorage<NAMESPACE::CLASS_NAME, DEPRECATED_CLASS_NAME> VARIABLE(AGXARCHIVE_MODIFICATIONS("\\-##-//83ddfJ4Dj"));
276 return (m_flags & FINISHED) != 0;
281 return (m_flags & DYNAMICALLY_ALLOCATED) != 0;
294 return m_serializationEnabled;
300 #define AGXSTREAM_DECLARE_SERIALIZABLE( T )
301 #define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE( T )
302 #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...