13#ifndef TEUCHOS_SIMPLEOBJECTTABLE_HPP 
   14#define TEUCHOS_SIMPLEOBJECTTABLE_HPP 
   38    int storeNew(
T* obj, 
bool owned = 
true);
 
   43    int removeRCP(
int &index);
 
   45    const RCP<T> getRCP(
int index);
 
 
   64SimpleObjectTable<T>::~SimpleObjectTable()
 
   70int SimpleObjectTable<T>::storeRCP(
const RCP<T> & robj)
 
   72  robj.assert_not_null();
 
   76  if (freedIndices.size() != 0) {
 
   77    index = freedIndices.back();
 
   78    freedIndices.pop_back();
 
   79    tableOfObjects[index] = robj;
 
   81    tableOfObjects.push_back(robj);
 
   82    index = tableOfObjects.size() - 1;
 
   89int SimpleObjectTable<T>::storeNew(T* obj, 
bool owned)
 
   91  return storeRCP(
rcp(obj, owned));
 
   96int SimpleObjectTable<T>::storeCastedRCP(
const RCP<TOld> & robj_old)
 
   98  return storeRCP(rcp_dynamic_cast<T>(robj_old, 
true));
 
  102int SimpleObjectTable<T>::removeRCP(
int &index)
 
  104  if (tableOfObjects[index] == Teuchos::null) {
 
  105    throw RangeError(
"Item has already been deleted from SimpleObjectTable.");
 
  108  int cnt = tableOfObjects[index].strong_count();
 
  110  tableOfObjects[index] = Teuchos::null;
 
  111  freedIndices.push_back(index);
 
  118const RCP<T> SimpleObjectTable<T>::getRCP(
int index)
 
  120  if (tableOfObjects[index] == Teuchos::null) {
 
  121    throw RangeError(
"Item has already been deleted from SimpleObjectTable.");
 
  124  return tableOfObjects[index];
 
  128void SimpleObjectTable<T>::purge()
 
  130  int ocnt = tableOfObjects.size();
 
  131  for (
int i=0; i<ocnt; i++) {
 
  132    tableOfObjects[i] = Teuchos::null;
 
  135  if (tableOfObjects.size() > 0)
 
  136    tableOfObjects.erase(tableOfObjects.begin(), tableOfObjects.end());
 
  137  if (freedIndices.size() > 0)
 
  138    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.
 
Smart reference counting pointer class for automatic garbage collection.
 
RCP< T > rcp(const boost::shared_ptr< T > &sptr)
Conversion function that takes in a boost::shared_ptr object and spits out a Teuchos::RCP object.
 
This class provides a central place to store objects.
 
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...