The PackedArray class.
More...
#include <PackedArray.h>
template<typename T>
class JoeEngine::PackedArray< T >
The PackedArray class.
Data structure class that stores a densely-packed list of data with a variety of helper functions for easy insertion and removal.
- See also
- JEEngineInstance
◆ PackedArray()
Constructor.
No interesting behavior.
◆ ~PackedArray()
◆ AddElement()
Add index-element pair.
Adds the specified data element to the densely-packed data list. Will re-use a previously invalid entry if one is available to avoid unnecessary allocations. The indirection map and data indices lists are updated to reflect this addition. Now, using the []-operator with the specified index will return the specified element.
- Parameters
-
index | the index to insert the element at |
element | the specified data element |
◆ begin() [1/2]
Get const interator to beginning.
Returns a const iterator to the front of the underlying data list. This is useful, for example, when using a for-each loop to read from each element of the array.
- Returns
- iterator to the front of the data list.
- See also
- ComponentManager, RotatorComponent
◆ begin() [2/2]
Get non-const interator to beginning.
Returns a non-const iterator to the front of the underlying data list. This is useful, for example, when using a for-each loop to, say, update each element of the array. This is common with various Component types.
- Returns
- iterator to the front of the data list.
- See also
- ComponentManager, RotatorComponent
◆ end() [1/2]
Get const interator to end.
Returns a const iterator to the ednd of the underlying data list. This is useful, for example, when using a for-each loop to read from each element of the array.
- Returns
- iterator to the end of the data list.
- See also
- ComponentManager, RotatorComponent
◆ end() [2/2]
Get non-const interator to end.
Returns a non-const iterator to the end of the underlying data list. This is useful, for example, when using a for-each loop to, say, update each element of the array. This is common with various Component types.
- Returns
- iterator to the end of the data list.
- See also
- ComponentManager, RotatorComponent
◆ GetData() [1/2]
Get non-const reference to data.
Returns a non-const reference to the data list.
- Returns
- non-const reference to the data list
◆ GetData() [2/2]
Get const reference to data.
Returns a const reference to the data list.
- Returns
- const reference to the data list
◆ operator[]() [1/2]
Get non-const element at index.
Accesses the element at the specified index (e.g. an entity ID) via the indirection map. Catches invalid indices and throws an error in those cases. This []-operator is for non-const accesses, which is most likely writing.
- Parameters
-
- Returns
- a non-const reference to the data element.
◆ operator[]() [2/2]
Get const element at index.
Accesses the element at the specified index (e.g. an entity ID) via the indirection map. Catches invalid indices and throws an error in those cases. This []-operator is for const accesses, meaning reading.
- Parameters
-
- Returns
- a const reference to the data element.
◆ RemoveElement()
Remove element at index.
Removes the element at the specified index. The indirection map entry for this index will now be marked as invalid, and future attempts to read the data from this index via the []-operator will throw an error.
- Parameters
-
index | the index whose element to remove |
◆ Size()
Get size.
Returns the number of data elements stored by this class in the densely-packed data list.
- Returns
- the number of elements
The documentation for this class was generated from the following file: