AGX Dynamics 2.41.2.0
Loading...
Searching...
No Matches
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

namespace  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.
 
#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.
 
#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.
 
#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.
 
#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.
 
#define AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATED_CLASS(VARIABLE, NAMESPACE, CLASS_NAME, DEPRECATED_CLASS_NAME)
 This macro will instantiate a storage for a completely deprecated class.
 
#define AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATION_CHECK_VARIABLE(VARIABLE, NEW_CLASS, DEPRECATED_CLASS, MODIFICATION_LIST)    static agxStream::DeprecatedStorage<NEW_CLASS, DEPRECATED_CLASS> VARIABLE(MODIFICATION_LIST);
 This macro will instantiate a storage for a class that superseeds a deprecated class.
 
#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.
 

Macro Definition Documentation

◆ AGXARCHIVE_MODIFICATIONS

#define AGXARCHIVE_MODIFICATIONS (   ...)    {__VA_ARGS__}

Definition at line 236 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 191 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 222 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:196
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
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 208 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

Definition at line 196 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 215 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 228 of file Serializable.h.

◆ AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATED_CLASS

#define AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATED_CLASS (   VARIABLE,
  NAMESPACE,
  CLASS_NAME,
  DEPRECATED_CLASS_NAME 
)
Value:
namespace NAMESPACE { \
\
class CLASS_NAME : public DEPRECATED_CLASS_NAME \
{ \
public: \
CLASS_NAME() {} \
AGXSTREAM_DECLARE_SERIALIZABLE(NAMESPACE::CLASS_NAME); \
}; \
void CLASS_NAME::store(agxStream::OutputArchive&) const { LOGGER_ERROR() << #NAMESPACE << "::" << #CLASS_NAME << " is deprecated and should never be stored" << LOGGER_ENDL(); } \
void CLASS_NAME::restore(agxStream::InputArchive&) { LOGGER_ERROR() << #NAMESPACE << "::" << #CLASS_NAME << " is deprecated and should never be restored" << LOGGER_ENDL(); } \
} \
static agxStream::DeprecatedStorage<NAMESPACE::CLASS_NAME, DEPRECATED_CLASS_NAME> VARIABLE(AGXARCHIVE_MODIFICATIONS("\\-##-//83ddfJ4Dj"));
#define LOGGER_ERROR()
Definition: Logger.h:22
#define LOGGER_ENDL()
Definition: Logger.h:27
#define AGXARCHIVE_MODIFICATIONS(...)
Definition: Serializable.h:236

This macro will instantiate a storage for a completely deprecated class.

VARIABLE - the name of the variable that will be instantiated (For example storage_deprecated_terrain). NAMESPACE - Namespace where the deprecated class used to live. (For example agxModel). CLASS_NAME - The name of the deprecated class. (For example Terrain). DEPRECATED_CLASS - New name/namespace of the deprecated class, usually something like agxModel::deprecated::Terrain.

Definition at line 254 of file Serializable.h.

◆ AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATION_CHECK_VARIABLE

#define AGXSTREAM_INSTANTIATE_STORAGE_DEPRECATION_CHECK_VARIABLE (   VARIABLE,
  NEW_CLASS,
  DEPRECATED_CLASS,
  MODIFICATION_LIST 
)     static agxStream::DeprecatedStorage<NEW_CLASS, DEPRECATED_CLASS> VARIABLE(MODIFICATION_LIST);

This macro will instantiate a storage for a class that superseeds a deprecated class.

VARIABLE - the name of the variable that will be instantiated NEW_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 NEW_CLASS class will be used.

Definition at line 245 of file Serializable.h.

◆ AGXSTREAM_INSTANTIATE_STORAGE_VARIABLE

#define AGXSTREAM_INSTANTIATE_STORAGE_VARIABLE (   V,
 
)     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 232 of file Serializable.h.