17#ifndef AGXDATA_ENTITYREF_H
18#define AGXDATA_ENTITYREF_H
33 template <
typename PtrT>
56 template <
typename PtrT>
59 template <
typename PtrT>
65 template <
typename PtrT>
71 template <
typename PtrT>
77 template <
typename PtrT>
83 template <
typename PtrT>
88 this->getStorage()->reference();
90 typename PtrT::InstanceType instance = this->instance();
92 instance.referenceCount()++;
93 instance.observers().push_back(
this);
97 template <
typename PtrT>
102 typename PtrT::InstanceType instance = this->instance();
112 size_t index = instance.observers().find(
this);
113 agxAssert(index != instance.observers().size());
114 instance.observers().eraseFast(index);
117 refCounter = refCount;
128 template <
typename PtrT>
132 PtrT::init(storage,
id);
137 template <
typename PtrT>
141 PtrT::operator=(other);
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
An entity reference is a safe/referencing handle to an entity instance whose model is descendant from...
EntityRef(const agxData::EntityRef< PtrT > &other)
EntityRef(agxData::EntityStorage *storage, agx::Index id)
EntityRef< PtrT > & operator=(const EntityRef< PtrT > &other)
void init(agxData::EntityStorage *storage, agx::Index id)
EntityRef(const agxData::EntityPtr &other)
Data storage for a collection of entity instances of a specified EntityModel.
void unreference(void *ptr=nullptr) const
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
Contains classes for low level data storage for AGX.
AGXTERRAIN_EXPORT TimingStorage & getStorage()
std::lock_guard< T > ScopeLock
agx::ScopeLock is an alias for std::lock_guard