AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
IndexedCollection is a container for a collection of pointers to items of template parameter type T, each with a corresponding index. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/src/axom/sidre/core/IndexedCollection.hpp>
Public Types | |
using | value_type = T |
using | iterator = typename ItemCollection< T >::iterator |
using | const_iterator = typename ItemCollection< T >::const_iterator |
Public Member Functions | |
size_t | getNumItems () const |
Gets the number of items stored in the collection. More... | |
IndexType | getFirstValidIndex () const |
Returns the index of the first valid item or InvalidIndex if there are none. More... | |
IndexType | getNextValidIndex (IndexType idx) const |
Returns the next valid index after \idx or InvalidIndex if there are none. More... | |
bool | hasItem (IndexType idx) const |
Return true if there is an item at index idx. More... | |
T * | getItem (IndexType idx) |
Return the item at index \idx or nullptr if that index is empty. More... | |
T const * | getItem (IndexType idx) const |
Return the item at index \idx or nullptr if that index is empty. More... | |
IndexType | insertItem (T *item) |
Insert item into the next available free index. More... | |
IndexType | insertItem (T *item, const std::string &AXOM_UNUSED_PARAM(name)) |
Insert item into the next available free index. More... | |
IndexType | insertItem (T *item, IndexType idx) |
Insert item at index idx if that index is not already occupied. More... | |
T * | removeItem (IndexType idx) |
Removes the item from index idx but does not destroy it. More... | |
void | removeAllItems () |
Removes all items from the collection, but does not destroy them. More... | |
IndexType | getValidEmptyIndex () |
Return the index of a valid empty slot in the collection. More... | |
IndexType | getLastAvailableEmptyIndex () const |
Gets the empty index at the end of the range of available indices. More... | |
iterator | begin () |
iterator | end () |
const_iterator | cbegin () const |
const_iterator | cend () const |
const_iterator | begin () const |
const_iterator | end () const |
virtual IndexType | insertItem (T *item, const std::string &name="")=0 |
iterator_adaptor | getIteratorAdaptor () |
Returns an adaptor wrapping this collection in support of iteration. More... | |
const_iterator_adaptor | getIteratorAdaptor () const |
Returns a const adaptor wrapping this collection in support of iteration. More... | |
IndexedCollection is a container for a collection of pointers to items of template parameter type T, each with a corresponding index.
Each item has an associated index which will always be in the range between 0 and getLastAvailableEmptyIndex()
using axom::sidre::IndexedCollection< T >::value_type = T |
using axom::sidre::IndexedCollection< T >::iterator = typename ItemCollection<T>::iterator |
using axom::sidre::IndexedCollection< T >::const_iterator = typename ItemCollection<T>::const_iterator |
|
inlinevirtual |
Gets the number of items stored in the collection.
Implements axom::sidre::ItemCollection< T >.
|
virtual |
Returns the index of the first valid item or InvalidIndex if there are none.
Implements axom::sidre::ItemCollection< T >.
References axom::sidre::InvalidIndex.
|
virtual |
Returns the next valid index after \idx or InvalidIndex if there are none.
Implements axom::sidre::ItemCollection< T >.
References axom::sidre::InvalidIndex.
|
inlinevirtual |
Return true if there is an item at index idx.
Implements axom::sidre::ItemCollection< T >.
|
inlinevirtual |
Return the item at index \idx or nullptr if that index is empty.
Implements axom::sidre::ItemCollection< T >.
References axom::sidre::IndexedCollection< T >::hasItem().
|
inlinevirtual |
Return the item at index \idx or nullptr if that index is empty.
Implements axom::sidre::ItemCollection< T >.
References axom::sidre::IndexedCollection< T >::hasItem().
|
inline |
Insert item into the next available free index.
References axom::sidre::IndexedCollection< T >::getValidEmptyIndex().
|
inline |
Insert item into the next available free index.
References axom::sidre::IndexedCollection< T >::insertItem().
|
inline |
Insert item at index idx if that index is not already occupied.
References axom::sidre::IndexedCollection< T >::getLastAvailableEmptyIndex(), axom::sidre::IndexedCollection< T >::hasItem(), and axom::sidre::InvalidIndex.
|
virtual |
Removes the item from index idx but does not destroy it.
Implements axom::sidre::ItemCollection< T >.
|
inlinevirtual |
Removes all items from the collection, but does not destroy them.
Implements axom::sidre::ItemCollection< T >.
|
inline |
Return the index of a valid empty slot in the collection.
Finds an empty (unused) index at which an item can be inserted
References axom::sidre::IndexedCollection< T >::hasItem(), axom::sidre::InvalidIndex, and SLIC_ASSERT_MSG.
|
inline |
Gets the empty index at the end of the range of available indices.
|
inlinevirtual |
Implements axom::sidre::ItemCollection< T >.
|
inlinevirtual |
Implements axom::sidre::ItemCollection< T >.
|
inlinevirtual |
Implements axom::sidre::ItemCollection< T >.
|
inlinevirtual |
Implements axom::sidre::ItemCollection< T >.
|
inlinevirtual |
Implements axom::sidre::ItemCollection< T >.
|
inlinevirtual |
Implements axom::sidre::ItemCollection< T >.
|
pure virtualinherited |
Implemented in axom::sidre::ListCollection< T >, and axom::sidre::MapCollection< T >.
|
inlineinherited |
Returns an adaptor wrapping this collection in support of iteration.
|
inlineinherited |
Returns a const adaptor wrapping this collection in support of iteration.