Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
|
String indexed ordered value-type object container class. More...
#include <Teuchos_StringIndexedOrderedValueObjectContainer.hpp>
Public Member Functions | |
template<typename U , typename > | |
StringIndexedOrderedValueObjectContainer < ObjType >::Ordinal | setObj (const std::string &key, U &&obj) |
Private Types | |
typedef KeyObjectPair< ObjType > | key_and_obj_t |
typedef std::deque< key_and_obj_t > | key_and_obj_array_t |
typedef std::map< std::string, OrdinalIndex > | key_to_idx_map_t |
Private Types inherited from Teuchos::StringIndexedOrderedValueObjectContainerBase | |
typedef Teuchos_Ordinal | Ordinal |
Ordinal used for the index. More... | |
Private Member Functions | |
void | assertOrdinalIndex (const Ordinal idx) const |
key_and_obj_t & | getNonconstKeyAndObject (const Ordinal idx) |
const key_and_obj_t & | getKeyAndObject (const Ordinal idx) const |
void | throwInvalidKeyError (const Ordinal idx, const std::string &key) const |
Ordinal | assertKeyGetOrdinal (const std::string &key) const |
Private Member Functions inherited from Teuchos::StringIndexedOrderedValueObjectContainerBase | |
virtual | ~StringIndexedOrderedValueObjectContainerBase () |
Destructor. More... | |
Private Attributes | |
key_and_obj_array_t | key_and_obj_array_ |
Stories objects contiguously along with key strings. More... | |
key_to_idx_map_t | key_to_idx_map_ |
Provides lookups of key -> ordinal index into above array. More... | |
Public types. | |
typedef StringIndexedOrderedValueObjectContainerBase::Ordinal | Ordinal |
Ordinal used for the index. More... | |
typedef FilteredIterator < typename key_and_obj_array_t::iterator, SelectActive< ObjType > > | Iterator |
The non-const iterator type. More... | |
typedef FilteredIterator < typename key_and_obj_array_t::const_iterator, SelectActive< ObjType > > | ConstIterator |
The const iterator type. More... | |
Constructors/Destructors/Info | |
StringIndexedOrderedValueObjectContainer () | |
Ordinal | numObjects () const |
Ordinal | numStorage () const |
Set, get, and remove functions | |
template<typename U , typename = std::enable_if_t<std::is_convertible_v<U, ObjType>>> | |
Ordinal | setObj (const std::string &key, U &&obj) |
Set (or reset) object by value and return its ordinal index. More... | |
Ordinal | getObjOrdinalIndex (const std::string &key) const |
Get the ordinal index given the string key. More... | |
Ptr< ObjType > | getNonconstObjPtr (const Ordinal &idx) |
Get a nonconst semi-persisting association with the stored object indexed by ordinal. More... | |
Ptr< const ObjType > | getObjPtr (const Ordinal &idx) const |
Get a const semi-persisting association with the stored object indexed by ordinal. More... | |
Ptr< ObjType > | getNonconstObjPtr (const std::string &key) |
Get a nonconst semi-persisting association with the stored object indexed by string key. More... | |
Ptr< const ObjType > | getObjPtr (const std::string &key) const |
Get a const semi-persisting association with the stored object indexed by string key. More... | |
void | removeObj (const Ordinal &idx) |
Remove an object given its ordinal index. More... | |
void | removeObj (const std::string &key) |
Remove an object given its string key. More... | |
Iterator access | |
Iterator | nonconstBegin () |
Iterator | nonconstEnd () |
ConstIterator | begin () const |
ConstIterator | end () const |
Additional Inherited Members | |
Static Private Member Functions inherited from Teuchos::StringIndexedOrderedValueObjectContainerBase | |
static Ordinal | getInvalidOrdinal () |
Return the value for invalid ordinal. More... | |
String indexed ordered value-type object container class.
This class is a simple utility class for managing the storage and retrievel of value-type objects which the following features/properties:
The design of this class comes with a few important limitations:
Definition at line 151 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
private |
Definition at line 157 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
private |
Definition at line 159 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
private |
Definition at line 161 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
typedef StringIndexedOrderedValueObjectContainerBase::Ordinal Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::Ordinal |
Ordinal used for the index.
Definition at line 169 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
typedef FilteredIterator<typename key_and_obj_array_t::iterator, SelectActive<ObjType> > Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::Iterator |
The non-const iterator type.
Definition at line 173 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
typedef FilteredIterator<typename key_and_obj_array_t::const_iterator, SelectActive<ObjType> > Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::ConstIterator |
The const iterator type.
Definition at line 177 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::StringIndexedOrderedValueObjectContainer | ( | ) |
Definition at line 410 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
StringIndexedOrderedValueObjectContainer< ObjType >::Ordinal Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::numObjects | ( | ) | const |
Definition at line 416 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
StringIndexedOrderedValueObjectContainer< ObjType >::Ordinal Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::numStorage | ( | ) | const |
Definition at line 424 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
Ordinal Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::setObj | ( | const std::string & | key, |
U && | obj | ||
) |
Set (or reset) object by value and return its ordinal index.
If the object with the given key index does not exist, it will be added. If an object with the given key does not exist, it will be created.
|
inline |
Get the ordinal index given the string key.
If the key does not exist, then getInvalidOrdinal() is returned.
Definition at line 436 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
inline |
Get a nonconst semi-persisting association with the stored object indexed by ordinal.
Definition at line 325 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
inline |
Get a const semi-persisting association with the stored object indexed by ordinal.
Definition at line 334 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
inline |
Get a nonconst semi-persisting association with the stored object indexed by string key.
Definition at line 343 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
inline |
Get a const semi-persisting association with the stored object indexed by string key.
Definition at line 352 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
void Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::removeObj | ( | const Ordinal & | idx | ) |
Remove an object given its ordinal index.
Each object is errased by assigning to a default-constructed ObjType(). This, for example, will wipe out the reference count for a smart pointer class or will unsize an array, etc..
Definition at line 468 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
void Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::removeObj | ( | const std::string & | key | ) |
Remove an object given its string key.
Definition at line 477 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
inline |
Definition at line 364 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
inline |
Definition at line 374 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
inline |
Definition at line 384 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
inline |
Definition at line 394 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
private |
Definition at line 493 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
private |
Definition at line 505 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
private |
Definition at line 519 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
private |
Definition at line 533 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
private |
Definition at line 543 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
StringIndexedOrderedValueObjectContainer<ObjType>::Ordinal Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::setObj | ( | const std::string & | key, |
U && | obj | ||
) |
Definition at line 449 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
private |
Stories objects contiguously along with key strings.
Definition at line 268 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.
|
private |
Provides lookups of key -> ordinal index into above array.
Definition at line 270 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.