45#ifndef TEUCHOS_SIMPLEOBJECTTABLE_HPP
46#define TEUCHOS_SIMPLEOBJECTTABLE_HPP
104 robj.assert_not_null();
108 if (freedIndices.size() != 0) {
109 index = freedIndices.back();
110 freedIndices.pop_back();
111 tableOfObjects[index] =
robj;
113 tableOfObjects.push_back(
robj);
114 index = tableOfObjects.
size() - 1;
137 throw RangeError(
"Item has already been deleted from SimpleObjectTable.");
140 int cnt = tableOfObjects[index].strong_count();
143 freedIndices.push_back(index);
153 throw RangeError(
"Item has already been deleted from SimpleObjectTable.");
156 return tableOfObjects[index];
167 if (tableOfObjects.size() > 0)
168 tableOfObjects.erase(tableOfObjects.begin(), tableOfObjects.end());
169 if (freedIndices.size() > 0)
170 freedIndices.erase(freedIndices.begin(), freedIndices.end());
Templated array class derived from the STL std::vector.
Reference-counted pointer class and non-member templated function implementations.
int size(const Comm< Ordinal > &comm)
Get the number of processes in the communicator.
Range error exception class.
Concrete serial communicator subclass.
This class provides a central place to store objects.
const RCP< T > getRCP(int index)
Array< RCP< T > > tableOfObjects
int removeRCP(int &index)
Array< int > freedIndices
int storeRCP(const RCP< T > &robj)
int storeNew(T *obj, bool owned=true)
int storeCastedRCP(const RCP< TOld > &robj_old)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.