Simple dynamic array implementation that also supports event posting and viewing/facade.
More...
|
| DataArray () |
| Constructs an empty data array DataArray will never have capacity < 1.
|
|
| DataArray (const int size) |
| Constructs a data array.
|
|
template<typename U > |
| DataArray (std::initializer_list< U > list) |
| Constructs from intializer list.
|
|
| DataArray (const DataArray &other) |
| Copy Constructor. More...
|
|
| DataArray (DataArray &&other) |
|
void | resize (const int size) override |
| Resize data array to hold exactly size number of values.
|
|
void | fill (const T &val) |
| Fill the array with the specified value.
|
|
virtual void | squeeze () |
| Resize to current size.
|
|
void | push_back (const T &val) |
| Append the data array to hold the new value, resizes if neccesary.
|
|
void | push_back (const T &&val) |
|
void | reserve (const int capacity) override |
| Allocates extra capacity, for the number of values, conservative reallocate.
|
|
T * | getPointer () |
|
void * | getVoidPointer () override |
| Returns void pointer to data.
|
|
T & | operator[] (const size_t pos) |
|
const T & | operator[] (const size_t pos) const |
|
T & | at (const size_t pos) |
|
const T & | at (const size_t pos) const |
|
template<typename U > |
DataArray< T > & | operator= (std::initializer_list< U > list) |
| Allow initialization from initializer list, ie: DataArray<int> arr = { 1, 2 }.
|
|
DataArray & | operator= (const DataArray &other) |
|
void | setData (T *ptr, const int size) |
| Computes the range of a component of the vectors elements. More...
|
|
virtual int | getNumberOfComponents () const override |
| Returns the number of components.
|
|
template<typename N > |
DataArray< N > | cast () |
| Cast array to specific c++ type.
|
|
std::shared_ptr< AbstractDataArray > | cast (ScalarTypeId type) override |
| Cast array to the IMSTK type on the abstract interface.
|
|
std::unique_ptr< DataArray< T > > | clone () |
| Polymorphic clone, shadows the declaration in the superclasss but returns own type.
|
|
|
iterator | begin () |
| begin(), end() to mirror std::vector
|
|
const_iterator | begin () const |
|
iterator | end () |
|
const_iterator | end () const |
|
const_iterator | cbegin () const |
|
const_iterator | cend () const |
|
| AbstractDataArray (const int size) |
|
virtual | ~AbstractDataArray () |
| Ensure all observers are disconnected.
|
|
| SIGNAL (AbstractDataArray, modified) |
|
void | clear () |
| Resizes to 0.
|
|
int | size () const |
| Get number of values/tuples.
|
|
ScalarTypeId | getScalarType () const |
| Returns the scalar type of this array.
|
|
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
|
|
std::unique_ptr< AbstractDataArray > | clone () |
| polymorphic clone() function, utilize this to get a copy of the array without casting to the expected array type
|
|
template<typename T > |
void | postEvent (const T &e) |
| Emits the event Direct observers will be immediately called, in sync Queued observers will receive the Command in their queue for later execution, reciever must implement doEvent.
|
|
template<typename T > |
void | queueEvent (const T &e) |
| Queues event directly to this.
|
|
void | doEvent () |
| Do an event, if none exists return.
|
|
void | doAllEvents () |
| Do all the events in the event queue.
|
|
void | foreachEvent (std::function< void(Command cmd)> func) |
| Thread safe loop over all event commands, one can implement a custom handler.
|
|
void | rforeachEvent (std::function< void(Command cmd)> func) |
| thread safe reverse loop over all event commands, one can implement a custom handler
|
|
void | clearEvents () |
| Removes all events from queue cleans up copies of the event.
|
|
template<typename T>
class imstk::DataArray< T >
Simple dynamic array implementation that also supports event posting and viewing/facade.
Definition at line 22 of file imstkDataArray.h.