AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
ListCollection.hpp File Reference

Header file for ListCollection. More...

#include <map>
#include <list>
#include <stack>
#include <string>
#include <vector>
#include "axom/config.hpp"
#include "axom/core/Types.hpp"
#include "SidreTypes.hpp"
#include "ItemCollection.hpp"

Classes

class  axom::sidre::ListCollection< T >
 ListCollection is a container class template for holding a collection of items of template parameter type T, using a list container. More...
 

Namespaces

 axom
 
 axom::sidre
 

Detailed Description

Header file for ListCollection.

     This is an implementation of ItemCollection to hold a
     collection of items of a fixed type. This implementation
     is intended to hold items that may have no name. If they do
     have names, those names are ignored.

     This class is templated on the item type so that the same
     class can be used to hold either View or Group object pointers
     without having to code a separate class for each.

     \attention This class should be robust against any potential
                user interaction. It doesn't report errors and leaves
                checking of return values to calling code.

     \attention The interface is as follows:

     \verbatim
  • - // Return number of items in collection.
  • size_t getNumItems() const;
  • - // Return first item index for iteration.
  • // sidre::InvalidIndex returned if no items in collection
  • IndexType getFirstValidIndex() const;
  • - // Return next valid item index for iteration.
  • // sidre::InvalidIndex returned if there are no further items
  • IndexType getNextValidIndex(IndexType idx) const;
  • *
  • - // Return true if item with given index in collection; else false.
  • bool hasItem(IndexType idx) const;
  • - // Return pointer to item with given index (nullptr if none).
  • T* getItem(IndexType idx);
  • T const* getItem(IndexType idx) const;
  • - // Insert item; the name argument will be ignored.
  • // Return index if insertion succeeded, and InvalidIndex
  • // otherwise.
  • IndexType insertItem(T* item, const std::string& name);
  • - // Remove item with given index if it exists and return a
  • // pointer to it. If it doesn't exist, return nullptr.
  • T* removeItem(IndexType idx);
  • - // Remove all items (items not destroyed).
  • void removeAllItems();
  • - // Clear all items and destroy them.
  • void deleteAllItems();