Radium Engine
1.5.20
|
#include <Core/Utils/IndexMap.hpp>
Public Types | |
using | Container = typename std::deque<T> |
using | IndexContainer = typename std::deque<Index> |
Where the objects are stored. | |
using | ConstIndexIterator |
Where the indices are stored. | |
using | Iterator |
using | ConstIterator = typename Container::const_iterator |
Iterator to the list of objects of the IndexMap. | |
Public Member Functions | |
IndexMap () | |
IndexMap (const IndexMap &id_map) | |
Default constructor. | |
~IndexMap () | |
Copy constructor. | |
Index | insert (const T &obj) |
Destructor. | |
template<typename... Args> | |
Index | emplace (const Args &&... args) |
bool | remove (const Index &idx) |
Remove the object with the given index. Return false if the operation failed. | |
const T & | at (const Index &idx) const |
Return a read-only ref to object with the given index. Crashes if index does not exist. | |
T & | access (const Index &idx) |
Return a reference to the object with the given index. Crash if index does not exist. | |
size_t | size () const |
void | clear () |
Return the size of the IndexMap ( number of object contained ). | |
bool | empty () const |
Clear the IndexMap. | |
bool | full () const |
Return true if the IndexMap is empty. | |
bool | contains (const Index &idx) const |
Return true if the IndexMap cannot contain more objects. | |
Index | index (const uint i) const |
Return true if the IndexMap contains a object with the given index. | |
T & | operator[] (const Index &idx) |
Return the i-th index. Return an invalid index if i is out of bound. | |
const T & | operator[] (const Index &idx) const |
Return a reference to the object with given index. | |
ConstIndexIterator | cbegin_index () const |
Return a const reference to the object with given index. | |
ConstIndexIterator | cend_index () const |
Return a const iterator to the first index in the IndexMap. | |
Iterator | begin () |
Return a const iterator to the end of the indices of the IndexMap. | |
Iterator | end () |
Return a iterator to the first object in the IndexMap. | |
ConstIterator | begin () const |
Return a iterator to the end of the object list in the IndexMap. | |
ConstIterator | end () const |
Return a iterator to the first object in the IndexMap. | |
ConstIterator | cbegin () const |
Return a iterator to the end of the object list in the IndexMap. | |
ConstIterator | cend () const |
Return a const iterator to the first object in the IndexMap. | |
Protected Attributes | |
Container | m_data |
Return a const iterator to the end of the object list in the IndexMap. | |
IndexContainer | m_index |
Objects in the IndexMap. | |
The class IndexMap define a map where a object is coupled with a index. The index is unique, it is assigned to a object when it's inserted and is kept until the object is removed. After a removal, the index becomes free again. A object will be given the first free index available. If no free indices are available, the object will not be inserted and the IndexMap is considered full.
Definition at line 23 of file IndexMap.hpp.
using Ra::Core::Utils::IndexMap< T >::ConstIndexIterator |
Where the indices are stored.
Definition at line 32 of file IndexMap.hpp.
using Ra::Core::Utils::IndexMap< T >::ConstIterator = typename Container::const_iterator |
Iterator to the list of objects of the IndexMap.
Definition at line 37 of file IndexMap.hpp.
using Ra::Core::Utils::IndexMap< T >::Container = typename std::deque<T> |
Definition at line 29 of file IndexMap.hpp.
using Ra::Core::Utils::IndexMap< T >::IndexContainer = typename std::deque<Index> |
Where the objects are stored.
Definition at line 30 of file IndexMap.hpp.
using Ra::Core::Utils::IndexMap< T >::Iterator |
Const iterator to the list of indices of the IndexMap.
Definition at line 35 of file IndexMap.hpp.
|
inline |
Const iterator to the list of objects of the IndexMap.
Definition at line 154 of file IndexMap.hpp.
|
inline |
Default constructor.
Definition at line 157 of file IndexMap.hpp.
|
inline |
Copy constructor.
Definition at line 164 of file IndexMap.hpp.
|
inline |
Return a reference to the object with the given index. Crash if index does not exist.
Definition at line 221 of file IndexMap.hpp.
|
inline |
Return a read-only ref to object with the given index. Crashes if index does not exist.
Definition at line 213 of file IndexMap.hpp.
|
inline |
Return a const iterator to the end of the indices of the IndexMap.
Definition at line 299 of file IndexMap.hpp.
|
inline |
Return a iterator to the end of the object list in the IndexMap.
Definition at line 309 of file IndexMap.hpp.
|
inline |
Return a iterator to the end of the object list in the IndexMap.
Definition at line 319 of file IndexMap.hpp.
|
inline |
Return a const reference to the object with given index.
Definition at line 286 of file IndexMap.hpp.
|
inline |
Return a const iterator to the first object in the IndexMap.
Definition at line 324 of file IndexMap.hpp.
|
inline |
Return a const iterator to the first index in the IndexMap.
Definition at line 291 of file IndexMap.hpp.
|
inline |
Return the size of the IndexMap ( number of object contained ).
Definition at line 236 of file IndexMap.hpp.
|
inline |
Return true if the IndexMap cannot contain more objects.
Definition at line 257 of file IndexMap.hpp.
|
inline |
Construct an object in place in the IndexMap. Return an invalid index if the object is not inserted.
Definition at line 184 of file IndexMap.hpp.
|
inline |
Clear the IndexMap.
Definition at line 247 of file IndexMap.hpp.
|
inline |
Return a iterator to the first object in the IndexMap.
Definition at line 304 of file IndexMap.hpp.
|
inline |
Return a iterator to the first object in the IndexMap.
Definition at line 314 of file IndexMap.hpp.
|
inline |
Return true if the IndexMap is empty.
Definition at line 252 of file IndexMap.hpp.
|
inline |
Return true if the IndexMap contains a object with the given index.
Definition at line 264 of file IndexMap.hpp.
|
inline |
Destructor.
Insert a object in the IndexMap. Return an invalid index if the object is not inserted.
Definition at line 170 of file IndexMap.hpp.
|
inline |
Return the i-th index. Return an invalid index if i is out of bound.
Definition at line 273 of file IndexMap.hpp.
|
inline |
Return a reference to the object with given index.
Definition at line 278 of file IndexMap.hpp.
|
inline |
Remove the object with the given index. Return false if the operation failed.
Definition at line 200 of file IndexMap.hpp.
|
inline |
Definition at line 231 of file IndexMap.hpp.
|
protected |
Return a const iterator to the end of the object list in the IndexMap.
Definition at line 123 of file IndexMap.hpp.
|
protected |
Objects in the IndexMap.
Definition at line 124 of file IndexMap.hpp.