AGX Dynamics 2.41.2.0
Loading...
Searching...
No Matches
agx::Model Class Reference

A model is an abstract representation of the class of an agx::Object. More...

#include <Model.h>

+ Inheritance diagram for agx::Model:

Classes

class  Loader
 

Public Member Functions

 Model (const agx::Name &name, agx::Model *source)
 
 Model (const agx::Name &name, const agx::Name &implementation=agx::Name())
 
virtual void buildNavigationTree (agxJson::Value &eNode) const override
 
agx::String fullInheritancePath () const
 The active instances of this model.
 
agx::String fullName () const
 
agx::String fullPath () const
 
const agx::NamegetImplementationName () const
 
agx::NamespacegetNamespace ()
 
const agx::NamespacegetNamespace () const
 
agx::Path getPath () const
 
agx::Path getPath (const agx::Object *root) const
 
agx::ModelgetSource ()
 
const agx::ModelgetSource () const
 
const agx::StringgetSourcePath () const
 
bool hasParent (const agx::Model *parent) const
 
bool hasSource (const agx::Model *source) const
 
template<typename T >
bool is () const
 Subclass test.
 
bool is (const agx::Model *other) const
 
bool isShutdown () const
 
void setSource (Model *source)
 
void setSourcePath (const String &path)
 
- Public Member Functions inherited from agx::Component
 Component (const agx::Name &name=agx::Name(), agx::Model *model=agx::Component::ClassModel(), agx::Device *device=nullptr)
 
virtual void addObject (agx::Object *object, bool assignContext=true)
 Add an object to the component.
 
virtual String autoComplete (const String &partialName, StringVector &matchingNames) const
 
virtual void buildNavigationTree (agxJson::Value &eNode) const override
 
void configure (Model *model)
 
virtual void configure (TiXmlElement *eComponent) override
 
agx::DevicegetDevice ()
 
template<typename T >
T * getDevice ()
 
const agx::DevicegetDevice () const
 
template<typename T >
const T * getDevice () const
 
size_t getNumObjects (const agx::Name &name) const
 
agx::ObjectgetObject (const agx::Name &name, agx::Model *model, size_t index=0)
 
const agx::ObjectgetObject (const agx::Name &name, agx::Model *model, size_t index=0) const
 
agx::ObjectgetObject (const agx::Name &name, size_t index=0)
 
template<typename T >
T * getObject (const agx::Name &name, size_t index=0)
 
const agx::ObjectgetObject (const agx::Name &name, size_t index=0) const
 
template<typename T >
const T * getObject (const agx::Name &name, size_t index=0) const
 
const agx::ObjectRefVectorgetObjects () const
 
template<typename T >
void getObjects (agx::ObjectPtrVector &result, bool recursive=false) const
 
void getObjects (agx::ObjectPtrVector &result, const agx::Model *model, bool recursive=false) const
 
virtual ObjectgetResourceImpl (const Path &path, agx::Model *model) override
 
virtual void printSubtree () const override
 
void printSubtree (std::ostream &stream, int depth=0) const
 
virtual void rebind () override
 
void removeAllObjects ()
 Remove all components.
 
virtual void removeObject (agx::Object *object)
 Remove an object from the component.
 
void removeObject (const agx::Name &name, size_t index=0)
 Remove an object with a specified name (and optional index) from the component.
 
virtual void snapshot (TiXmlNode *eParent, const String &directory) const override
 
void traverse (ComponentVisitor *)
 
void traverse (const TraverseCallback &callback)
 
- Public Member Functions inherited from agx::Object
 Object (const Name &name=Name(), Model *model=Object::ClassModel())
 
void addListener (EventListener *listener)
 
virtual void buildNavigationTree (agxJson::Value &eNode) const
 
virtual void configure (TiXmlElement *)
 
agx::String fullName () const
 
agx::String fullPath () const
 
agx::String fullPath (const agx::Object *root) const
 
template<typename T >
T * getAutoScopedResource (const agx::Path &path)
 
template<typename T >
const T * getAutoScopedResource (const agx::Path &path) const
 
agx::ObjectgetAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::ObjectgetAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) const
 
agx::ObjectgetContext ()
 
template<typename T >
T * getContext ()
 
const agx::ObjectgetContext () const
 
template<typename T >
const T * getContext () const
 
agx::UInt32 getId () const
 
const agx::NamegetImplementationName () const
 
agx::ModelgetModel ()
 
const agx::ModelgetModel () const
 
const agx::NamegetName () const
 
agx::ObjectgetNextSibling ()
 
const agx::ObjectgetNextSibling () const
 
agx::Path getPath () const
 
agx::Path getPath (const agx::Object *root) const
 
template<typename T >
T * getResource (const agx::Path &path)
 
template<typename T >
const T * getResource (const agx::Path &path) const
 
agx::ObjectgetResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::ObjectgetResource (const agx::Path &path, agx::Model *model=nullptr) const
 
virtual agx::ObjectgetResourceImpl (const agx::Path &path, agx::Model *model)
 
agx::ObjectgetRootContext ()
 
const agx::ObjectgetRootContext () const
 
bool hasListener (EventListener *listener)
 
bool hasParent (const agx::Object *node) const
 
bool isUnique () const
 
virtual void printSubtree () const
 
virtual void rebind ()
 
void removeListener (EventListener *listener)
 
virtual void save (TiXmlElement *) const
 
virtual void setContext (agx::Object *context)
 
void setId (UInt32 id)
 
void setModel (agx::Model *model)
 Set the object model (handled automatically).
 
void setName (const agx::Name &name)
 Set the name of the object.
 
virtual void snapshot (TiXmlNode *, const String &) const
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 

Static Public Member Functions

static ModelClassModel ()
 
static agx::ModelcreateModel (const agx::Path &path, const agx::Name &implementation, agx::Model *source)
 
static bool getDiskPath (const Path &modelPath, Path &fullModelPath, String &filePath, TiXmlElement *relativeRoot, agxIO::Environment::Type envType, const String &fileExtension)
 Locate a model definition file.
 
static agx::String getFileSystemRoot (agx::TiXmlElement *element, agxIO::Environment::Type pathType=agxIO::Environment::RUNTIME_PATH)
 
static agx::Path getNamespace (agx::TiXmlElement *element, agxIO::Environment::Type pathType=agxIO::Environment::RUNTIME_PATH)
 
static agx::Path getNamespace (const agx::String &filePath, agxIO::Environment::Type pathType=agxIO::Environment::RUNTIME_PATH)
 
static agx::Path getPath (agx::TiXmlElement *element, agx::Name &implementation, agxIO::Environment::Type pathType=agxIO::Environment::RUNTIME_PATH)
 
static agx::Path getPath (agx::TiXmlElement *element, agxIO::Environment::Type pathType=agxIO::Environment::RUNTIME_PATH)
 
static agx::Path getPath (const agx::String &filePath, agxIO::Environment::Type pathType=agxIO::Environment::RUNTIME_PATH)
 
static void parsePathString (const agx::String &pathStr, agx::Path &path, agx::Name &implementation)
 
static agx::Namespaceroot ()
 
- Static Public Member Functions inherited from agx::Component
static Component_load (TiXmlElement *eComponent, Device *device)
 
static agx::ModelClassModel ()
 
static Componentload (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path())
 
static Componentload (const String &path, const Path &_namespace=Path())
 
static Componentload (const String &path, Device *device, const Path &_namespace=Path())
 
static Componentload (TiXmlElement *eComponent, Device *device)
 
- Static Public Member Functions inherited from agx::Object
static agx::ModelClassModel ()
 
static agx::String generateName (const agx::String &bindPath)
 
static const HashSet< Object * > & getActiveObjects ()
 
static bool getEnableRebind ()
 Should rebinding be allowed? Right now a global setting.
 
static Objectload (const String &path, Device *device, const String &type, const String &attribute, const String &value)
 
template<typename T >
static T * load (const String &path, Device *device, const String &type, const String &attribute, const String &value)
 
static Objectload (const String &path, Device *device, const String &type="", size_t instance=0)
 
template<typename T >
static T * load (const String &path, Device *device, const String &type="", size_t instance=0)
 
static void load (const String &path, Device *device, ObjectPtrVector &loadedObjects)
 
static Objectload (TiXmlElement *eObject, Device *device)
 
template<typename T >
static T * load (TiXmlElement *eObject, Device *device)
 
static TiXmlDocument openDocument (const String &path)
 
static void setEnableRebind (bool flag)
 Sets if rebinding of objects should be allowed (Right now a global setting).
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

virtual ~Model ()
 
- Protected Member Functions inherited from agx::Component
virtual ~Component ()
 
String expandAutoCompletionMatch (const String &query, const StringVector &matchingNames) const
 
void setDevice (Device *device)
 
- Protected Member Functions inherited from agx::Object
virtual ~Object ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

bool m_isShutdown
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- Public Types inherited from agx::Component
typedef Event2< Component *, Object * > ObjectEvent
 Event when adding removing child objects.
 
typedef Callback1< Object * > TraverseCallback
 
- Public Types inherited from agx::Object
typedef agx::observer_ptr< const EventEventConstObserver
 
typedef agx::ref_ptr< const EventEventConstRef
 
typedef agx::observer_ptr< EventEventObserver
 
typedef agx::Vector< EventObserverEventObserverVector
 
typedef agx::VectorPOD< Event * > EventPtrVector
 
typedef agx::ref_ptr< EventEventRef
 
typedef agx::Vector< EventRefEventRefVector
 
- Public Attributes inherited from agx::Component
ObjectEvent addObjectEvent
 
ObjectEvent removeObjectEvent
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Detailed Description

A model is an abstract representation of the class of an agx::Object.

The models are organized in a hierarchy and supports inheritance. For example: Physics.RigidBody.IntegratePositions -> Kernel -> Task -> Component -> Object

Definition at line 40 of file Model.h.

Constructor & Destructor Documentation

◆ Model() [1/2]

agx::Model::Model ( const agx::Name name,
const agx::Name implementation = agx::Name() 
)

◆ Model() [2/2]

agx::Model::Model ( const agx::Name name,
agx::Model source 
)

◆ ~Model()

virtual agx::Model::~Model ( )
protectedvirtual

Member Function Documentation

◆ buildNavigationTree()

virtual void agx::Model::buildNavigationTree ( agxJson::Value &  eNode) const
overridevirtual

Reimplemented from agx::Component.

◆ ClassModel()

static Model * agx::Model::ClassModel ( )
static

◆ createModel()

static agx::Model * agx::Model::createModel ( const agx::Path path,
const agx::Name implementation,
agx::Model source 
)
static

◆ fullInheritancePath()

agx::String agx::Model::fullInheritancePath ( ) const

The active instances of this model.

Returns
the full inheritance path.

◆ fullName()

agx::String agx::Model::fullName ( ) const

◆ fullPath()

agx::String agx::Model::fullPath ( ) const

◆ getDiskPath()

static bool agx::Model::getDiskPath ( const Path modelPath,
Path fullModelPath,
String filePath,
TiXmlElement *  relativeRoot,
agxIO::Environment::Type  envType,
const String fileExtension 
)
static

Locate a model definition file.

Parameters
modelPath- Path to model, for example Physics.Particle
fullModelPath- Full resolved path of model, expanding input path if is a relative path
filePath- Absolute path to the file on disk
relativeRoot- The relative node from where the input path is specified
envType- When to search for files
fileExtension- for example "agxEntity"
Returns
false if model is not found

◆ getFileSystemRoot()

static agx::String agx::Model::getFileSystemRoot ( agx::TiXmlElement *  element,
agxIO::Environment::Type  pathType = agxIO::Environment::RUNTIME_PATH 
)
static
Returns
The component root directory For example: path/to/Components/Physics/Foo/Particle.agxEntity -> path/to/Components

◆ getImplementationName()

const Name & agx::Model::getImplementationName ( ) const
Returns
The implementation name.

Definition at line 207 of file Model.h.

◆ getNamespace() [1/4]

Namespace * agx::Model::getNamespace ( )
Returns
The namespace of the model

Definition at line 209 of file Model.h.

References agxAssert, and agx::Object::getContext().

Referenced by getNamespace().

◆ getNamespace() [2/4]

const Namespace * agx::Model::getNamespace ( ) const
Returns
The namespace of the model

Definition at line 215 of file Model.h.

References getNamespace().

◆ getNamespace() [3/4]

static agx::Path agx::Model::getNamespace ( agx::TiXmlElement *  element,
agxIO::Environment::Type  pathType = agxIO::Environment::RUNTIME_PATH 
)
static
Returns
The namespace of the model for example path/to/Components/Physics/Foo/Particle.agxEntity -> Physics.Foo

◆ getNamespace() [4/4]

static agx::Path agx::Model::getNamespace ( const agx::String filePath,
agxIO::Environment::Type  pathType = agxIO::Environment::RUNTIME_PATH 
)
static

◆ getPath() [1/5]

agx::Path agx::Object::getPath ( ) const
Returns
The path to the object in the system tree.

◆ getPath() [2/5]

static agx::Path agx::Model::getPath ( agx::TiXmlElement *  element,
agx::Name implementation,
agxIO::Environment::Type  pathType = agxIO::Environment::RUNTIME_PATH 
)
static

◆ getPath() [3/5]

static agx::Path agx::Model::getPath ( agx::TiXmlElement *  element,
agxIO::Environment::Type  pathType = agxIO::Environment::RUNTIME_PATH 
)
static
Returns
The model path with dot-separator. For example: path/to/Components/Physics/Foo/Particle.agxEntity -> Physics.Foo.Particle

◆ getPath() [4/5]

agx::Path agx::Object::getPath ( const agx::Object root) const
Returns
A relative path from a specified root
Parameters
rootA node along the parent path from this object.

◆ getPath() [5/5]

static agx::Path agx::Model::getPath ( const agx::String filePath,
agxIO::Environment::Type  pathType = agxIO::Environment::RUNTIME_PATH 
)
static

◆ getSource() [1/2]

Model * agx::Model::getSource ( )
Returns
The source model.

Definition at line 220 of file Model.h.

◆ getSource() [2/2]

const Model * agx::Model::getSource ( ) const
Returns
The source model.

Definition at line 221 of file Model.h.

◆ getSourcePath()

const String & agx::Model::getSourcePath ( ) const
Returns
The source path on disk which defines the model.

Definition at line 223 of file Model.h.

◆ hasParent()

bool agx::Model::hasParent ( const agx::Model parent) const

◆ hasSource()

bool agx::Model::hasSource ( const agx::Model source) const
Returns
True if the specified model is a source (direct and indirect)

◆ is() [1/2]

template<typename T >
bool agx::Referenced::is ( ) const

Subclass test.

◆ is() [2/2]

bool agx::Model::is ( const agx::Model other) const

◆ isShutdown()

bool agx::Model::isShutdown ( ) const

Definition at line 224 of file Model.h.

References m_isShutdown.

◆ parsePathString()

static void agx::Model::parsePathString ( const agx::String pathStr,
agx::Path path,
agx::Name implementation 
)
static

◆ root()

static agx::Namespace * agx::Model::root ( )
static
Returns
The root model.

◆ setSource()

void agx::Model::setSource ( Model source)

◆ setSourcePath()

void agx::Model::setSourcePath ( const String path)

References agx::isShutdown().

Member Data Documentation

◆ m_isShutdown

bool agx::Model::m_isShutdown
protected

Definition at line 197 of file Model.h.

Referenced by isShutdown().


The documentation for this class was generated from the following file: