AGX Dynamics  2.35.0.1
Serializable.h File Reference
#include <agx/agxCore_export.h>
#include <agx/Integer.h>
#include <functional>
#include <agxStream/StorageAgent.h>
#include <agx/Uuid.h>

Go to the source code of this file.

Classes

class  agxStream::Serializable
 This class is an abstract base class for all classes that can be stored and retrieved from an Archive. More...
 

Namespaces

 agxStream
 This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serialization).
 

Macros

#define AGXARCHIVE_MODIFICATIONS(...)   {__VA_ARGS__}
 
#define AGXSTREAM_CLASS_NAME(T)
 Macro for retrieving a class name based on the function scope. More...
 
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
 Use this in a pure abstract Serializable class to add the required methods Important: Use full namespace in the declaration! For example: agx::deprecated::SomeClass. More...
 
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
 Use this in a Serializable class to add the required methods Important: Use full namespace in the declaration! For example: agx::deprecated::SomeClass. More...
 
#define AGXSTREAM_DECLARE_SERIALIZABLE_BASE(T)
 
#define AGXSTREAM_DECLARE_SERIALIZABLE_CUSTOM_CREATE(T)
 Use this in a Serializable class to add the required methods Important: Use full namespace in the declaration! For example: agx::deprecated::SomeClass. More...
 
#define AGXSTREAM_INSTANTIATE_STORAGE(C)    static agxStream::Storage<C> storage ## C;
 Use this macro to instantiate a storage for a Serializable class. If you have '::' in the class name, you need to use the AGXSTREAM_INSTANTIATE_STORAGE_VARIABLE macro. More...
 
#define AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATION_CHECK_VARIABLE(V, DEFAULT_CLASS, DEPRECATED_CLASS, MODIFICATION_LIST)    static agxStream::DeprecatedStorage<DEFAULT_CLASS, DEPRECATED_CLASS> V(MODIFICATION_LIST);
 This macro will instantiate a storage for a serializable class V - the name of the variable that will be instantiated DEFAULT_CLASS - The new implementation of a class with the same name as the old one, for example agxDriveTrain::TorqueConverter DEPRECATED_CLASS - The old implementation, now with a different namespace, for example agxDriveTrain::deprecated::TorqueConverter MODIFICATION_LIST - List of modifications that if they are all present in the input archive, the default class will be used. More...
 
#define AGXSTREAM_INSTANTIATE_STORAGE_VARIABLE(V, C)    static agxStream::Storage<C> storage ## V;
 Use this macro for instantiate a storage as a specific variable name if necessary. For example if C contains :: the previous macro cannot be used. More...
 

Macro Definition Documentation

◆ AGXARCHIVE_MODIFICATIONS

#define AGXARCHIVE_MODIFICATIONS (   ...)    {__VA_ARGS__}

Definition at line 235 of file Serializable.h.

◆ AGXSTREAM_CLASS_NAME

#define AGXSTREAM_CLASS_NAME (   T)
Value:
\
inline const char* getClassName() const override { return #T; } \

Macro for retrieving a class name based on the function scope.

Definition at line 190 of file Serializable.h.

◆ AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE

#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (   T)
Value:
inline agxStream::StorageAgent* getStorageAgent() const override { return agxStream::StorageManager::instance()->find(#T); } \
inline static const char* getConstructClassId() { return #T; } \
AGXSTREAM_CLASS_NAME(T)

Use this in a pure abstract Serializable class to add the required methods Important: Use full namespace in the declaration! For example: agx::deprecated::SomeClass.

Definition at line 221 of file Serializable.h.

◆ AGXSTREAM_DECLARE_SERIALIZABLE

#define AGXSTREAM_DECLARE_SERIALIZABLE (   T)
Value:
static agxStream::Serializable *create(agxStream::InputArchive& /*in*/) { return new T(); }
#define AGXSTREAM_DECLARE_SERIALIZABLE_BASE(T)
Definition: Serializable.h:195
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:52
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45

Use this in a Serializable class to add the required methods Important: Use full namespace in the declaration! For example: agx::deprecated::SomeClass.

Definition at line 207 of file Serializable.h.

◆ AGXSTREAM_DECLARE_SERIALIZABLE_BASE

#define AGXSTREAM_DECLARE_SERIALIZABLE_BASE (   T)
Value:
inline agxStream::StorageAgent* getStorageAgent() const override { return agxStream::StorageManager::instance()->find( #T ); } \
inline static const char* getConstructClassId() { return #T; } \
friend class agxStream::DefStorageAgent<T>; \
AGXSTREAM_CLASS_NAME(T) \
static agxStream::Serializable *create() { return new T(); } \
virtual void store( agxStream::OutputArchive& out ) const override;\
virtual void restore( agxStream::InputArchive& in ) override
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
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...
Definition: InputArchive.h:400
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.

Definition at line 195 of file Serializable.h.

◆ AGXSTREAM_DECLARE_SERIALIZABLE_CUSTOM_CREATE

#define AGXSTREAM_DECLARE_SERIALIZABLE_CUSTOM_CREATE (   T)
Value:

Use this in a Serializable class to add the required methods Important: Use full namespace in the declaration! For example: agx::deprecated::SomeClass.

Definition at line 214 of file Serializable.h.

◆ AGXSTREAM_INSTANTIATE_STORAGE

#define AGXSTREAM_INSTANTIATE_STORAGE (   C)     static agxStream::Storage<C> storage ## C;

Use this macro to instantiate a storage for a Serializable class. If you have '::' in the class name, you need to use the AGXSTREAM_INSTANTIATE_STORAGE_VARIABLE macro.

Definition at line 227 of file Serializable.h.

◆ AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATION_CHECK_VARIABLE

#define AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATION_CHECK_VARIABLE (   V,
  DEFAULT_CLASS,
  DEPRECATED_CLASS,
  MODIFICATION_LIST 
)     static agxStream::DeprecatedStorage<DEFAULT_CLASS, DEPRECATED_CLASS> V(MODIFICATION_LIST);

This macro will instantiate a storage for a serializable class V - the name of the variable that will be instantiated DEFAULT_CLASS - The new implementation of a class with the same name as the old one, for example agxDriveTrain::TorqueConverter DEPRECATED_CLASS - The old implementation, now with a different namespace, for example agxDriveTrain::deprecated::TorqueConverter MODIFICATION_LIST - List of modifications that if they are all present in the input archive, the default class will be used.

Definition at line 244 of file Serializable.h.

◆ AGXSTREAM_INSTANTIATE_STORAGE_VARIABLE

#define AGXSTREAM_INSTANTIATE_STORAGE_VARIABLE (   V,
  C 
)     static agxStream::Storage<C> storage ## V;

Use this macro for instantiate a storage as a specific variable name if necessary. For example if C contains :: the previous macro cannot be used.

Definition at line 231 of file Serializable.h.