38 std::string m_className;
41 StorageAgent(
const StorageAgent&);
42 StorageAgent& operator=(
const StorageAgent&);
46 StorageAgent(
const char* className);
50 virtual ~StorageAgent();
53 const char* getClassName()
const;
56 virtual Serializable* createInstance(InputArchive&
in) = 0;
65 static std::string stripClassName(
const char* functionName,
const char* className);
70 class DefStorageAgent :
public StorageAgent
73 DefStorageAgent() : StorageAgent(T::getConstructClassId()) { }
74 virtual ~DefStorageAgent() { }
76 virtual Serializable* createInstance(InputArchive&
in)
override {
83 return m_className.c_str();
95 static StorageManager* instance();
103 class RegisterStorageProxy :
public ProxyBase
107 RegisterStorageProxy() {
108 if (StorageManager::instance()) {
109 m_registerStorageProxy =
new T;
110 StorageManager::instance()->add(m_registerStorageProxy);
115 virtual ~RegisterStorageProxy() {
116 delete m_registerStorageProxy;
119 T* getStorageAgent()
const {
120 return m_registerStorageProxy;
124 T* m_registerStorageProxy;
131 ModificationCallback();
136 ~ModificationCallback();
147 template<
class T,
class Deprecated_T>
148 class DeprecatedRegisterStorageProxy :
public ProxyBase
154 if (StorageManager::instance()) {
157 m_registerStorageProxy =
new T;
158 m_deprecatedRegisterStorageProxy =
new Deprecated_T;
159 StorageManager::instance()->add(m_registerStorageProxy, modificationList, m_deprecatedRegisterStorageProxy);
163 virtual ~DeprecatedRegisterStorageProxy() {
164 delete m_registerStorageProxy;
166 if (m_deprecatedRegisterStorageProxy)
167 delete m_deprecatedRegisterStorageProxy;
172 T* m_registerStorageProxy;
173 Deprecated_T* m_deprecatedRegisterStorageProxy;
178 void add(
const char *className, StorageAgent* agent);
181 void add(StorageAgent* agent);
184 void add(StorageAgent* defaultAgent,
const agx::StringVector& modificationList, StorageAgent* deprecatedAgent);
187 void remove(StorageAgent* agent);
201 AgentStorage(StorageAgent* defaultAgent,
const agx::StringVector& modificationList, StorageAgent* deprecatedAgent);
207 StorageAgent* m_defaultAgent;
208 StorageAgent* m_deprecatedAgent;
215 StorageAgentMap m_storageAgents;
227 template <
typename DefaultClass_T,
typename DeprecatedClass_T>
228 struct DeprecatedStorage :
public StorageManager::DeprecatedRegisterStorageProxy< DefStorageAgent<DefaultClass_T>, DefStorageAgent<DeprecatedClass_T> >
230 DeprecatedStorage(
const agx::StringVector& modificationList) : StorageManager::DeprecatedRegisterStorageProxy< DefStorageAgent<DefaultClass_T>, DefStorageAgent<DeprecatedClass_T> >(modificationList)
234 ~DeprecatedStorage() {}
242 template <
typename T>
243 struct Storage :
public StorageManager::RegisterStorageProxy< DefStorageAgent<T> >
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...
void AGXPHYSICS_EXPORT shutdown()
Shutdown of the AGX Dynamics API will be done when the number of shutdown matches the number of calls...
agx::ref_ptr< DynamicLibrary > DynamicLibraryRef
#define AGX_DECLARE_POINTER_TYPES(type)
Base class providing referencing counted objects.
Smart pointer for handling referenced counted objects.
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
Inheritance with partial specialization due to bug with ref_ptr containers.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()