45 #ifndef TEUCHOS_SIMPLEOBJECTTABLE_HPP 46 #define TEUCHOS_SIMPLEOBJECTTABLE_HPP 68 int storeRCP(
const RCP<T> & robj);
70 int storeNew(T* obj,
bool owned =
true);
73 int storeCastedRCP(
const RCP<TOld> & robj_old);
75 int removeRCP(
int &index);
77 const RCP<T> getRCP(
int index);
108 if (freedIndices.
size() != 0) {
109 index = freedIndices.
back();
111 tableOfObjects[index] = robj;
114 index = tableOfObjects.
size() - 1;
123 return storeRCP(
rcp(obj, owned));
127 template <
class TOld>
130 return storeRCP(rcp_dynamic_cast<T>(robj_old,
true));
136 if (tableOfObjects[index] == Teuchos::null) {
137 throw RangeError(
"Item has already been deleted from SimpleObjectTable.");
140 int cnt = tableOfObjects[index].strong_count();
142 tableOfObjects[index] = Teuchos::null;
152 if (tableOfObjects[index] == Teuchos::null) {
153 throw RangeError(
"Item has already been deleted from SimpleObjectTable.");
156 return tableOfObjects[index];
162 int ocnt = tableOfObjects.
size();
163 for (
int i=0; i<ocnt; i++) {
164 tableOfObjects[i] = Teuchos::null;
167 if (tableOfObjects.
size() > 0)
168 tableOfObjects.
erase(tableOfObjects.
begin(), tableOfObjects.
end());
169 if (freedIndices.
size() > 0)
170 freedIndices.
erase(freedIndices.
begin(), freedIndices.
end());
This class provides a central place to store objects.
iterator erase(iterator position)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
const RCP< T > & assert_not_null() const
Throws NullReferenceError if this->get()==NULL, otherwise returns reference to *this.
Templated array class derived from the STL std::vector.
void push_back(const value_type &x)
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos, as well as a number of utility routines.
Smart reference counting pointer class for automatic garbage collection.
Range error exception class.
Reference-counted pointer class and non-member templated function implementations.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes...