Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Private Types | List of all members
Teuchos::StringIndexedOrderedValueObjectContainer< ObjType > Class Template Reference

String indexed ordered value-type object container class. More...

#include <Teuchos_StringIndexedOrderedValueObjectContainer.hpp>

Inheritance diagram for Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >:
Inheritance graph
[legend]

Private Types

typedef KeyObjectPair< ObjTypekey_and_obj_t
 
typedef std::deque< key_and_obj_tkey_and_obj_array_t
 
typedef std::map< std::string, OrdinalIndexkey_to_idx_map_t
 
- Private Types inherited from Teuchos::StringIndexedOrderedValueObjectContainerBase
typedef Teuchos_Ordinal Ordinal
 Ordinal used for the index.
 

Public types.

typedef StringIndexedOrderedValueObjectContainerBase::Ordinal Ordinal
 Ordinal used for the index.
 
typedef FilteredIterator< typename key_and_obj_array_t::iterator, SelectActive< ObjType > > Iterator
 The non-const iterator type.
 
typedef FilteredIterator< typename key_and_obj_array_t::const_iterator, SelectActive< ObjType > > ConstIterator
 The const iterator type.
 

Iterator access

key_and_obj_array_t key_and_obj_array_
 Stories objects contiguously along with key strings.
 
key_to_idx_map_t key_to_idx_map_
 Provides lookups of key -> ordinal index into above array.
 
Iterator nonconstBegin ()
 
Iterator nonconstEnd ()
 
ConstIterator begin () const
 
ConstIterator end () const
 
void assertOrdinalIndex (const Ordinal idx) const
 
key_and_obj_tgetNonconstKeyAndObject (const Ordinal idx)
 
const key_and_obj_tgetKeyAndObject (const Ordinal idx) const
 
void throwInvalidKeyError (const Ordinal idx, const std::string &key) const
 
Ordinal assertKeyGetOrdinal (const std::string &key) const
 

Constructors/Destructors/Info

 StringIndexedOrderedValueObjectContainer ()
 
Ordinal numObjects () const
 
Ordinal numStorage () const
 

Set, get, and remove functions

Ordinal setObj (const std::string &key, const ObjType &obj)
 Set (or reset) object by value and return its ordinal index.
 
Ordinal getObjOrdinalIndex (const std::string &key) const
 Get the ordinal index given the string key.
 
Ptr< ObjTypegetNonconstObjPtr (const Ordinal &idx)
 Get a nonconst semi-persisting association with the stored object indexed by ordinal.
 
Ptr< const ObjTypegetObjPtr (const Ordinal &idx) const
 Get a const semi-persisting association with the stored object indexed by ordinal.
 
Ptr< ObjTypegetNonconstObjPtr (const std::string &key)
 Get a nonconst semi-persisting association with the stored object indexed by string key.
 
Ptr< const ObjTypegetObjPtr (const std::string &key) const
 Get a const semi-persisting association with the stored object indexed by string key.
 
void removeObj (const Ordinal &idx)
 Remove an object given its ordinal index.
 
void removeObj (const std::string &key)
 Remove an object given its string key.
 

Additional Inherited Members

- Private Member Functions inherited from Teuchos::StringIndexedOrderedValueObjectContainerBase
virtual ~StringIndexedOrderedValueObjectContainerBase ()
 Destructor.
 
- Static Private Member Functions inherited from Teuchos::StringIndexedOrderedValueObjectContainerBase
static Ordinal getInvalidOrdinal ()
 Return the value for invalid ordinal.
 

Detailed Description

template<class ObjType>
class Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >

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:

Todo
Implement compression of unused entries. This will invalidate the indexes but will allow handling of lots of inserts and deletes of elements.

Definition at line 180 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

Member Typedef Documentation

◆ key_and_obj_t

◆ key_and_obj_array_t

template<class ObjType >
typedef std::deque<key_and_obj_t> Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::key_and_obj_array_t
private

◆ key_to_idx_map_t

template<class ObjType >
typedef std::map<std::string, OrdinalIndex> Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::key_to_idx_map_t
private

◆ Ordinal

Ordinal used for the index.

Definition at line 198 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ Iterator

The non-const iterator type.

Definition at line 202 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ ConstIterator

template<class ObjType >
typedef FilteredIterator<typename key_and_obj_array_t::const_iterator, SelectActive<ObjType> > Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::ConstIterator

The const iterator type.

Definition at line 206 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

Constructor & Destructor Documentation

◆ StringIndexedOrderedValueObjectContainer()

template<class ObjType >
Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::StringIndexedOrderedValueObjectContainer ( )

Member Function Documentation

◆ numObjects()

◆ numStorage()

◆ setObj()

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.

Returns
Returns the ordinal index by which the object can be looked up with.

Definition at line 476 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ getObjOrdinalIndex()

Get the ordinal index given the string key.

If the key does not exist, then getInvalidOrdinal() is returned.

Definition at line 464 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ getNonconstObjPtr() [1/2]

template<class ObjType >
Ptr< ObjType > Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::getNonconstObjPtr ( const Ordinal & idx)
inline

Get a nonconst semi-persisting association with the stored object indexed by ordinal.

Definition at line 353 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ getObjPtr() [1/2]

Get a const semi-persisting association with the stored object indexed by ordinal.

Definition at line 362 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ getNonconstObjPtr() [2/2]

template<class ObjType >
Ptr< ObjType > Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::getNonconstObjPtr ( const std::string & key)
inline

Get a nonconst semi-persisting association with the stored object indexed by string key.

Definition at line 371 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ getObjPtr() [2/2]

template<class ObjType >
Ptr< const ObjType > Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::getObjPtr ( const std::string & key) const
inline

Get a const semi-persisting association with the stored object indexed by string key.

Definition at line 380 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ removeObj() [1/2]

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 495 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ removeObj() [2/2]

template<class ObjType >
void Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::removeObj ( const std::string & key)

Remove an object given its string key.

Definition at line 504 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ nonconstBegin()

◆ nonconstEnd()

◆ begin()

◆ end()

◆ assertOrdinalIndex()

template<class ObjType >
void Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::assertOrdinalIndex ( const Ordinal idx) const
private

◆ getNonconstKeyAndObject()

◆ getKeyAndObject()

◆ throwInvalidKeyError()

template<class ObjType >
void Teuchos::StringIndexedOrderedValueObjectContainer< ObjType >::throwInvalidKeyError ( const Ordinal idx,
const std::string & key ) const
private

◆ assertKeyGetOrdinal()

Member Data Documentation

◆ key_and_obj_array_

Stories objects contiguously along with key strings.

Definition at line 296 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.

◆ key_to_idx_map_

Provides lookups of key -> ordinal index into above array.

Definition at line 298 of file Teuchos_StringIndexedOrderedValueObjectContainer.hpp.


The documentation for this class was generated from the following file: