9 #include "imstkTypes.h" 10 #include "imstkEventObject.h" 38 virtual void resize(
const int size) = 0;
43 virtual void reserve(
const int size) = 0;
58 inline int size()
const {
return m_size; }
79 virtual std::shared_ptr<AbstractDataArray>
cast(ScalarTypeId) = 0;
90 std::unique_ptr<AbstractDataArray>
clone()
92 return std::unique_ptr<AbstractDataArray>(cloneImplementation());
97 void setType(
const ScalarTypeId type) { this->m_scalarType = type; }
99 ScalarTypeId m_scalarType;
int size() const
Get number of values/tuples.
virtual void * getVoidPointer()=0
Returns void pointer to data.
Base class for events which contain a type, priority, and data priority defaults to 0 and uses a grea...
virtual std::shared_ptr< AbstractDataArray > cast(ScalarTypeId)=0
cast the content to the given imstk scalar type without having to know the type of the enclosed array...
virtual int getNumberOfComponents() const
Returns the number of components.
virtual void resize(const int size)=0
Resizes the array, may reallocate.
This class serves as the base class of DataArray, for typeless use.
void clear()
Resizes to 0.
std::unique_ptr< AbstractDataArray > clone()
polymorphic clone() function, utilize this to get a copy of the array without casting to the expected...
int getCapacity() const
Return the capacity of the array.
void postModified()
emits signal to all observers, informing them on the current address in memory and size of array ...
EventObject is the base class for all objects in iMSTK that can receive and emit events. It supports direct and queued observer functions. Direct observers receive events immediately on the same thread This can either be posted on an object or be a function pointer Queued observers receive events within their queue which they can process whenever they like. These can be connected with the connect/queuedConnect/disconnect functions Lambda recievers cannot be disconnected unless all receivers to a signal are removed.
void postEvent(const T &e)
Emits the event Direct observers will be immediately called, in sync Queued observers will receive th...
virtual void reserve(const int size)=0
Reserves a size for the array in memory, may reallocate.
virtual ~AbstractDataArray()
Ensure all observers are disconnected.
ScalarTypeId getScalarType() const
Returns the scalar type of this array.