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);
72 class DefStorageAgent :
public StorageAgent
75 DefStorageAgent() : StorageAgent(T::getConstructClassId()) { }
76 virtual ~DefStorageAgent() { }
78 virtual Serializable* createInstance(InputArchive& in)
override {
83 return dynamic_cast<const T*
>(derived) !=
nullptr;
89 return m_className.c_str();
101 static StorageManager* instance();
109 class RegisterStorageProxy :
public ProxyBase
113 RegisterStorageProxy() {
114 if (StorageManager::instance()) {
115 m_registerStorageProxy =
new T;
116 StorageManager::instance()->add(m_registerStorageProxy);
121 virtual ~RegisterStorageProxy() {
122 delete m_registerStorageProxy;
125 T* getStorageAgent()
const {
126 return m_registerStorageProxy;
130 T* m_registerStorageProxy;
137 ModificationCallback();
142 ~ModificationCallback();
153 template<
class T,
class Deprecated_T>
154 class DeprecatedRegisterStorageProxy :
public ProxyBase
160 if (StorageManager::instance()) {
163 m_registerStorageProxy =
new T;
164 m_deprecatedRegisterStorageProxy =
new Deprecated_T;
165 StorageManager::instance()->add(m_registerStorageProxy, modificationList, m_deprecatedRegisterStorageProxy);
169 virtual ~DeprecatedRegisterStorageProxy() {
170 delete m_registerStorageProxy;
172 if (m_deprecatedRegisterStorageProxy)
173 delete m_deprecatedRegisterStorageProxy;
178 T* m_registerStorageProxy;
179 Deprecated_T* m_deprecatedRegisterStorageProxy;
184 void add(
const char *className, StorageAgent* agent);
187 void add(StorageAgent* agent);
190 void add(StorageAgent* defaultAgent,
const agx::StringVector& modificationList, StorageAgent* deprecatedAgent);
193 void remove(StorageAgent* agent);
207 AgentStorage(StorageAgent* defaultAgent,
const agx::StringVector& modificationList, StorageAgent* deprecatedAgent);
213 StorageAgent* m_defaultAgent;
214 StorageAgent* m_deprecatedAgent;
224 StorageAgentMap m_storageAgents;
236 template <
typename DefaultClass_T,
typename DeprecatedClass_T>
237 struct DeprecatedStorage :
public StorageManager::DeprecatedRegisterStorageProxy< DefStorageAgent<DefaultClass_T>, DefStorageAgent<DeprecatedClass_T> >
239 DeprecatedStorage(
const agx::StringVector& modificationList) : StorageManager::DeprecatedRegisterStorageProxy< DefStorageAgent<DefaultClass_T>, DefStorageAgent<DeprecatedClass_T> >(modificationList)
243 ~DeprecatedStorage() {}
251 template <
typename T>
252 struct Storage :
public StorageManager::RegisterStorageProxy< DefStorageAgent<T> >
#define AGX_DECLARE_POINTER_TYPES(type)
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Inheritance with partial specialization due to bug with ref_ptr containers.
Base class providing referencing counted objects.
Smart pointer for handling referenced counted objects.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
agx::ref_ptr< DynamicLibrary > DynamicLibraryRef
void AGXPHYSICS_EXPORT shutdown()
Shutdown of the AGX Dynamics API will be done when the number of shutdown matches the number of calls...