43#ifndef TEUCHOS_STRING_INDEXED_ORDERED_VALUE_OBJECT_CONTAINER_HPP
44#define TEUCHOS_STRING_INDEXED_ORDERED_VALUE_OBJECT_CONTAINER_HPP
105 template<
class ObjType>
117 KeyObjectPair(
const std::string &key_in,
const ObjType &obj_in,
bool isActive_in =
true)
140 template<
class ObjType>
179template<
class ObjType>
350template<
class ObjType>
359template<
class ObjType>
368template<
class ObjType>
377template<
class ObjType>
389template<
class ObjType>
399template<
class ObjType>
409template<
class ObjType>
419template<
class ObjType>
437template<
class ObjType>
442template<
class ObjType>
450template<
class ObjType>
461template<
class ObjType>
468 return itr->second.idx;
474template<
class ObjType>
479 typename key_to_idx_map_t::iterator obj_idx_itr =
key_to_idx_map_.find(key);
482 const Ordinal obj_idx = obj_idx_itr->second.idx;
494template<
class ObjType>
503template<
class ObjType>
510 const Ordinal idx = itr->second.idx;
519template<
class ObjType>
524 "Error, the ordinal index " << idx <<
" is invalid"
525 <<
" because it falls outside of the range of valid objects"
530template<
class ObjType>
538 "Error, the ordinal index " << idx <<
" is invalid"
539 <<
" because the object has been deleted!");
544template<
class ObjType>
552 "Error, the ordinal index " << idx <<
" is invalid"
553 <<
" because the object has been deleted!");
558template<
class ObjType>
561 const Ordinal idx,
const std::string &key)
const
564 "Error, the key '" << key <<
"' does not exist!");
568template<
class ObjType>
Templated array class derived from the STL std::vector.
TEUCHOS_ORDINAL_TYPE Teuchos_Ordinal
ExceptionBase(const std::string &what_arg)
C++ Standard Library compatable filtered iterator.
Simple wrapper class for raw pointers to single objects where no persisting relationship exists.
Ptr< T > ptrFromRef(T &arg)
Create a pointer to a object from an object reference.
Thrown if an invalid string is passed in.
InvalidKeyError(const std::string &what_arg)
Thrown if an invalid ordinal index is passed in.
InvalidOrdinalIndexError(const std::string &what_arg)
A simple aggregate type to bind a key string and and objects value.
const std::string & first
KeyObjectPair< ObjType > & operator=(const KeyObjectPair< ObjType > &kop)
KeyObjectPair(const std::string &key_in, const ObjType &obj_in, bool isActive_in=true)
KeyObjectPair(const KeyObjectPair< ObjType > &kop)
static KeyObjectPair< ObjType > makeInvalid()
StringIndexedOrderedValueObjectContainerBase::Ordinal Ordinal
OrdinalIndex(const Ordinal idx_in)
Predicate for selecting active object entries in filtered iterator.
bool operator()(const KeyObjectPair< ObjType > &key_and_obj) const
Base types for StringIndexedOrderedValueObjectContainer.
virtual ~StringIndexedOrderedValueObjectContainerBase()
Destructor.
static Ordinal getInvalidOrdinal()
Return the value for invalid ordinal.
Teuchos_Ordinal Ordinal
Ordinal used for the index.
ConstIterator end() const
Ptr< const ObjType > getObjPtr(const std::string &key) const
Get a const semi-persisting association with the stored object indexed by string key.
Ordinal getObjOrdinalIndex(const std::string &key) const
Get the ordinal index given the string key.
FilteredIterator< typename key_and_obj_array_t::const_iterator, SelectActive< ObjType > > ConstIterator
The const iterator type.
Ordinal assertKeyGetOrdinal(const std::string &key) const
Ordinal numObjects() const
key_and_obj_array_t key_and_obj_array_
FilteredIterator< typename key_and_obj_array_t::iterator, SelectActive< ObjType > > Iterator
The non-const iterator type.
std::deque< key_and_obj_t > key_and_obj_array_t
void removeObj(const Ordinal &idx)
Remove an object given its ordinal index.
key_to_idx_map_t key_to_idx_map_
Ordinal numStorage() const
std::map< std::string, OrdinalIndex > key_to_idx_map_t
Ptr< ObjType > getNonconstObjPtr(const std::string &key)
Get a nonconst semi-persisting association with the stored object indexed by string key.
ConstIterator begin() const
void throwInvalidKeyError(const Ordinal idx, const std::string &key) const
key_and_obj_t & getNonconstKeyAndObject(const Ordinal idx)
Ptr< ObjType > getNonconstObjPtr(const Ordinal &idx)
Get a nonconst semi-persisting association with the stored object indexed by ordinal.
void assertOrdinalIndex(const Ordinal idx) const
Ordinal setObj(const std::string &key, const ObjType &obj)
Set (or reset) object by value and return its ordinal index.
KeyObjectPair< ObjType > key_and_obj_t
StringIndexedOrderedValueObjectContainerBase::Ordinal Ordinal
Ordinal used for the index.
Ptr< const ObjType > getObjPtr(const Ordinal &idx) const
Get a const semi-persisting association with the stored object indexed by ordinal.
void removeObj(const std::string &key)
Remove an object given its string key.
const key_and_obj_t & getKeyAndObject(const Ordinal idx) const
StringIndexedOrderedValueObjectContainer()
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.