104 virtual void save(TiXmlElement* )
const {}
109 template <
typename T>
110 static T *load(TiXmlElement *eObject,
Device *device);
128 template <
typename T>
129 static T *load(
const String& path,
Device *device,
const String& type =
"",
size_t instance = 0);
131 template <
typename T>
230 template <
typename T>
233 template <
typename T>
234 const T *getContext()
const;
236 template <
typename T>
239 template <
typename T>
240 const T *getResource(
const agx::Path& path)
const;
242 template <
typename T>
243 T *getAutoScopedResource(
const agx::Path& path);
245 template <
typename T>
246 const T *getAutoScopedResource(
const agx::Path& path)
const;
251 bool isUnique()
const;
275 static bool g_shouldRebind;
283 EventDispatch *m_eventDispatch;
301 template <
typename T>
304 template <
typename T>
330 #define AGX_MODEL_IMPLEMENTATION(_class, _path) \
331 agx::Model *_class::ClassModel() \
333 static std::atomic<agx::Model*> s_model = nullptr; \
335 agx::Model* tmp = s_model.load(std::memory_order_acquire); \
340 ScopeLock<ReentrantMutex> lock(agx::getTypeSystemMutex()); \
341 tmp = s_model.load(std::memory_order_relaxed); \
343 agx::createImplementedModel(_path, s_model); \
344 tmp = s_model.load(std::memory_order_relaxed); \
348 LOGGER_ERROR() << agx::String::format("No model found for path \'%s\'. Make sure AGX environment is properly setup", _path) << LOGGER_ENDL(); \
353 #define AGX_BUILTIN_MODEL(_class, _path, _parent) \
354 agx::Model *_class::ClassModel() \
356 static std::atomic<agx::Model*> s_model = nullptr; \
358 agx::Model* tmp = s_model.load(std::memory_order_acquire); \
363 ScopeLock<ReentrantMutex> lock(agx::getTypeSystemMutex()); \
364 tmp = s_model.load(std::memory_order_relaxed); \
366 agx::createBuiltinModel(_path, _parent, s_model); \
367 tmp = s_model.load(std::memory_order_relaxed); \
376 template <
typename T>
379 template <
typename T>
391 template <
typename T>
395 return dynamic_cast<T *
>(object);
398 template <
typename T>
402 return dynamic_cast<T *
>(object);
405 template <
typename T>
409 return dynamic_cast<T *
>(object);
413 template <
typename T>
419 template <
typename T>
422 return dynamic_cast<const T *
>(this->
getContext());
426 template <
typename T>
430 return (
object !=
nullptr && object->
is<T>()) ?
object->as<T>() :
nullptr;
433 template <
typename T>
436 return const_cast<Object *
>(
this)->getResource<T>(path);
440 template <
typename T>
444 return (
object !=
nullptr && object->
is<T>()) ?
object->as<T>() :
nullptr;
447 template <
typename T>
450 return const_cast<Object *
>(
this)->getAutoScopedResource<T>(path);
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGX_DECLARE_HASHSET_TYPES(type)
#define AGX_DECLARE_VECTOR_TYPES(type)
A component is an object containing other objects, enabling hierarchical structuring.
An agx::Device is an abstract representation of a device on which data can be stored and processed.
Inheritance with partial specialization due to bug with ref_ptr containers.
Inheritance with partial specialization due to bug with ref_ptr containers.
A model is an abstract representation of the class of an agx::Object.
Representation of a name string.
agx::Object is a refcounted object with a name.
const agx::Object * getRootContext() const
agx::Path getPath() const
virtual void snapshot(TiXmlNode *, const String &) const
agx::String fullName() const
virtual void configure(TiXmlElement *)
static agx::String generateName(const agx::String &bindPath)
static Object * load(const String &path, Device *device, const String &type="", size_t instance=0)
const agx::Object * getAutoScopedResource(const agx::Path &path, agx::Model *model=nullptr) const
agx::Path getPath(const agx::Object *root) const
void setModel(agx::Model *model)
Set the object model (handled automatically).
const agx::Object * getNextSibling() const
const agx::Name & getImplementationName() const
void addListener(EventListener *listener)
const agx::Name & getName() const
static void setEnableRebind(bool flag)
Sets if rebinding of objects should be allowed (Right now a global setting).
Object(const Name &name=Name(), Model *model=Object::ClassModel())
virtual void setContext(agx::Object *context)
virtual void printSubtree() const
virtual void save(TiXmlElement *) const
agx::Object * getContext()
void removeListener(EventListener *listener)
bool hasParent(const agx::Object *node) const
static const HashSet< Object * > & getActiveObjects()
agx::UInt32 getId() const
static Object * load(const String &path, Device *device, const String &type, const String &attribute, const String &value)
void setName(const agx::Name &name)
Set the name of the object.
static bool getEnableRebind()
Should rebinding be allowed? Right now a global setting.
static void load(const String &path, Device *device, ObjectPtrVector &loadedObjects)
const agx::Object * getResource(const agx::Path &path, agx::Model *model=nullptr) const
virtual void buildNavigationTree(agxJson::Value &eNode) const
agx::String fullPath(const agx::Object *root) const
agx::Object * getAutoScopedResource(const agx::Path &path, agx::Model *model=nullptr)
agx::Object * getRootContext()
static agx::Model * ClassModel()
virtual agx::Object * getResourceImpl(const agx::Path &path, agx::Model *model)
static Object * load(TiXmlElement *eObject, Device *device)
static TiXmlDocument openDocument(const String &path)
agx::Object * getResource(const agx::Path &path, agx::Model *model=nullptr)
agx::Object * getNextSibling()
agx::String fullPath() const
bool hasListener(EventListener *listener)
Representation of a path, a list of name components.
A pointer to an agx::Object.
Base class providing referencing counted objects.
bool is() const
Subclass test.
Vector containing 'raw' data.
Contains classes for low level data storage for AGX.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AGXCORE_EXPORT agx::ReentrantMutex & getTypeSystemMutex()
AGXCORE_EXPORT void printNode(const char *path)
Debugging.
AGXCORE_EXPORT void createBuiltinModel(const char *path, Model *parent, std::atomic< Model * > &result)
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
AGXCORE_EXPORT Component * root()
std::recursive_mutex ReentrantMutex
AGXCORE_EXPORT void createImplementedModel(const char *path, std::atomic< Model * > &result)
HashTable< Name, Object * > ObjectPtrTable