42#ifndef TEUCHOS_SIMPLE_OBJECT_DB_HPP
43#define TEUCHOS_SIMPLE_OBJECT_DB_HPP
129 template <
class TOld>
299 const int index_in = index;
359 "Error, the object index = " << index <<
" falls outside of the range"
363 "Error, the object at index "<<index<<
" of type "
Templated array class derived from the STL std::vector.
Definition of Teuchos::as, for conversions between types.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes.
Null reference error exception class.
Simple wrapper class for raw pointers to single objects where no persisting relationship exists.
Smart reference counting pointer class for automatic garbage collection.
RCP< T2 > rcp_dynamic_cast(const RCP< T1 > &p1, bool throw_on_fail=false)
Dynamic cast of underlying RCP type from T1* to T2*.
const RCP< T > & assert_not_null() const
Throws NullReferenceError if this->get()==NULL, otherwise returns reference to *this.
Range error exception class.
Simple object object database.
int storeCastedNonconstObj(const RCP< TOld > &robj_old)
Performs an rcp_dynamic_cast<>() to store the obejct.
int removeRCP(int &index)
Remove an indexed object from the table.
RCP< const T > removeConstObj(const int index)
int storeNonconstObj(const RCP< T > &obj)
Store a non-const object.
void purge()
Clear out all storage.
RCP< T > removeNonconstObj(const int index)
void removeObj(const int index)
Remove a stored object without returning it.
SimpleObjectDB()
Construct an empty DB.
freedIndices_t freedIndices_
int storeConstObj(const RCP< const T > &obj)
Store a const object.
int storeObjectImpl(const RCP< T2 > &robj)
int numFreeIndexes() const
Return number of free indexes.
int tableSize() const
Return the current size of the table.
int numObjects() const
Return number of non-null stored objects.
Array< int > freedIndices_t
tableOfObjects_t tableOfObjects_
Ptr< T > getNonconstObjPtr(const int index)
Get an object (nonconst semi-persisting association).
void validateIndex(const int index) const
void removeObjImpl(const int index)
RCP< T > getNonconstObjRCP(const int index)
Get an object (nonconst persisting association).
RCP< const T > getConstObjRCP(const int index) const
Get an object (const persisting association).
Ptr< const T > getConstObjPtr(const int index) const
Get an object (const semi-persisting association).
Array< ConstNonconstObjectContainer< T > > tableOfObjects_t
static std::string name()
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
TypeTo as(const TypeFrom &t)
Convert from one value type to another.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
RCP< SimpleObjectDB< T > > createSimpleObjectDB()
Nonmember constructor.