AGX Dynamics 2.41.3.0
Loading...
Searching...
No Matches
agxData::EntityInstance Class Reference

Entity instance provides access to a single instance in an EntityStorage. More...

#include <EntityInstance.h>

Public Member Functions

 EntityInstance ()
 Constructors.
 
 EntityInstance (agxData::EntityData *data, agx::Index index)
 
 EntityInstance (agxData::EntityStorage *storage, agx::Index index)
 
 EntityInstance (const agxData::EntityInstance &other)
 
 EntityInstance (const agxData::EntityPtr &other)
 
 ~EntityInstance ()=default
 Destructor.
 
agx::Index calculateId () const
 
agxData::EntityData * getData ()
 
const agxData::EntityData * getData () const
 
agx::Index getIndex () const
 
agxData::EntityModelgetModel ()
 Alias for getData()->getStorage()->getModel()
 
const agxData::EntityModelgetModel () const
 
agxData::EntityStoragegetStorage ()
 Alias for getData()->getStorage()
 
const agxData::EntityStoragegetStorage () const
 
agx::UInt32 hash () const
 
void init (agxData::EntityData *data, agx::Index index)
 Initialize an instance.
 
bool isInstanceOf (agxData::EntityModel *model) const
 
bool isValid () const
 
 operator bool () const
 
bool operator! () const
 Boolean operators, implemented using isValid.
 
bool operator!= (const EntityInstance &rhs) const
 
bool operator< (const EntityInstance &rhs) const
 
bool operator== (const EntityInstance &rhs) const
 
bool operator> (const EntityInstance &rhs) const
 
void verifyIndex () const
 Check for broken ptr, by verifying that the index is active in the storage.
 

Static Public Member Functions

static void TransformToAscii (void *targetBuffer, const void *sourceBuffer, size_t numElements)
 

Detailed Description

Entity instance provides access to a single instance in an EntityStorage.

Behaves like a struct, but stored using SOA buffers. The EntityInstance is temporal, it stores a direct index to its position in the storage. As the storage is modified and instances are added/removed, existing EntityInstance variables may be invalidated. For this reason EntityInstance should only be used in local scopes where the instance is known to be valid. For other cases, use EntityPtr instead, which use indirect addressing, and is valid even when the storage is permuted. The downside is that data access is a bit more costly.

Definition at line 43 of file EntityInstance.h.

Constructor & Destructor Documentation

◆ EntityInstance() [1/5]

agxData::EntityInstance::EntityInstance ( )

Constructors.

Definition at line 134 of file EntityInstance.h.

◆ EntityInstance() [2/5]

agxData::EntityInstance::EntityInstance ( agxData::EntityStorage storage,
agx::Index  index 
)

Definition at line 804 of file EntityStorage.h.

◆ EntityInstance() [3/5]

agxData::EntityInstance::EntityInstance ( agxData::EntityData *  data,
agx::Index  index 
)

Definition at line 137 of file EntityInstance.h.

◆ EntityInstance() [4/5]

agxData::EntityInstance::EntityInstance ( const agxData::EntityInstance other)

Definition at line 141 of file EntityInstance.h.

◆ EntityInstance() [5/5]

agxData::EntityInstance::EntityInstance ( const agxData::EntityPtr other)

◆ ~EntityInstance()

agxData::EntityInstance::~EntityInstance ( )
default

Destructor.

Member Function Documentation

◆ calculateId()

agx::Index agxData::EntityInstance::calculateId ( ) const
Returns
The id of the instance.

Definition at line 815 of file EntityStorage.h.

References agxAssert, getStorage(), and agxData::EntityStorage::indexToId().

◆ getData() [1/2]

agxData::EntityData * agxData::EntityInstance::getData ( )
Returns
The data set which the instance is part of.

Definition at line 149 of file EntityInstance.h.

◆ getData() [2/2]

const agxData::EntityData * agxData::EntityInstance::getData ( ) const

Definition at line 150 of file EntityInstance.h.

◆ getIndex()

agx::Index agxData::EntityInstance::getIndex ( ) const
Returns
The index of the instance.

Definition at line 147 of file EntityInstance.h.

Referenced by agxData::EntityPtr::EntityPtr(), operator!=(), operator<(), operator==(), operator>(), and verifyIndex().

◆ getModel() [1/2]

agxData::EntityModel * agxData::EntityInstance::getModel ( )

Alias for getData()->getStorage()->getModel()

Returns
The entity model for this instance.

Definition at line 825 of file EntityStorage.h.

References agxData::EntityStorage::getEntityModel(), and getStorage().

Referenced by getModel(), and isInstanceOf().

◆ getModel() [2/2]

const agxData::EntityModel * agxData::EntityInstance::getModel ( ) const

Definition at line 826 of file EntityStorage.h.

References getModel().

◆ getStorage() [1/2]

agxData::EntityStorage * agxData::EntityInstance::getStorage ( )

Alias for getData()->getStorage()

Returns
The storage which the instance is part of.

Definition at line 822 of file EntityStorage.h.

Referenced by calculateId(), getModel(), getStorage(), operator!=(), operator==(), and verifyIndex().

◆ getStorage() [2/2]

const agxData::EntityStorage * agxData::EntityInstance::getStorage ( ) const

Definition at line 823 of file EntityStorage.h.

References getStorage().

◆ hash()

agx::UInt32 agxData::EntityInstance::hash ( ) const

Definition at line 152 of file EntityInstance.h.

References agx::hash().

◆ init()

void agxData::EntityInstance::init ( agxData::EntityData *  data,
agx::Index  index 
)

Initialize an instance.

Parameters
dataThe data set
indexThe instance index

Definition at line 145 of file EntityInstance.h.

◆ isInstanceOf()

bool agxData::EntityInstance::isInstanceOf ( agxData::EntityModel model) const
Returns
True if the pointer is an instance of a specified model or sub-model

Definition at line 829 of file EntityStorage.h.

References getModel(), and agx::Model::is().

◆ isValid()

bool agxData::EntityInstance::isValid ( ) const
Returns
True if the instance is valid (non-nullptr)

Definition at line 157 of file EntityInstance.h.

Referenced by operator!().

◆ operator bool()

agxData::EntityInstance::operator bool ( ) const

Definition at line 159 of file EntityInstance.h.

◆ operator!()

bool agxData::EntityInstance::operator! ( ) const

Boolean operators, implemented using isValid.

Definition at line 158 of file EntityInstance.h.

References isValid().

◆ operator!=()

bool agxData::EntityInstance::operator!= ( const EntityInstance rhs) const

Definition at line 176 of file EntityInstance.h.

References getIndex(), and getStorage().

◆ operator<()

bool agxData::EntityInstance::operator< ( const EntityInstance rhs) const

Definition at line 161 of file EntityInstance.h.

References getIndex().

◆ operator==()

bool agxData::EntityInstance::operator== ( const EntityInstance rhs) const

Definition at line 171 of file EntityInstance.h.

References getIndex(), and getStorage().

◆ operator>()

bool agxData::EntityInstance::operator> ( const EntityInstance rhs) const

Definition at line 166 of file EntityInstance.h.

References getIndex().

◆ TransformToAscii()

static void agxData::EntityInstance::TransformToAscii ( void *  targetBuffer,
const void *  sourceBuffer,
size_t  numElements 
)
static

◆ verifyIndex()

void agxData::EntityInstance::verifyIndex ( ) const

Check for broken ptr, by verifying that the index is active in the storage.

Only used in debug mode.

Definition at line 836 of file EntityStorage.h.

References agxAssertN, agx::Path::c_str(), getIndex(), agx::Object::getPath(), getStorage(), and agxData::EntityStorage::size().


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