Sacado Package Browser (Single Doxygen Collection)
Version of the Day
|
Container class to manager template instantiations of a template class. More...
#include <Sacado_TemplateManager.hpp>
Classes | |
struct | BuildObject |
struct | DefaultBuilderOp |
The default builder class for building objects for each ScalarT. More... | |
struct | type_info_less |
Implementation of < for type_info objects. More... | |
Public Types | |
typedef TemplateIterator< BaseT > | iterator |
Typedef for iterator. More... | |
typedef ConstTemplateIterator < BaseT > | const_iterator |
Typedef for const_iterator. More... | |
Public Member Functions | |
TemplateManager () | |
Default constructor. More... | |
~TemplateManager () | |
Destructor. More... | |
template<typename BuilderOpT > | |
void | buildObjects (const BuilderOpT &builder) |
Build objects for each ScalarT. More... | |
void | buildObjects () |
Build objects for each ScalarT using default builder. More... | |
template<typename ScalarT > | |
Teuchos::RCP< BaseT > | getAsBase () |
Get RCP to object corrensponding to ScalarT as BaseT. More... | |
template<typename ScalarT > | |
Teuchos::RCP< const BaseT > | getAsBase () const |
Get RCP to object corrensponding to ScalarT as BaseT. More... | |
template<typename ScalarT > | |
Teuchos::RCP< typename Sacado::mpl::apply< ObjectT, ScalarT >::type > | getAsObject () |
Get RCP to object corrensponding to ScalarT as ObjectT<ScalarT> More... | |
template<typename ScalarT > | |
Teuchos::RCP< const typename Sacado::mpl::apply< ObjectT, ScalarT >::type > | getAsObject () const |
Get RCP to object corrensponding to ScalarT as ObjectT<ScalarT> More... | |
Sacado::TemplateManager < TypeSeq, BaseT, ObjectT > ::iterator | begin () |
Return an iterator that points to the first type object. More... | |
Sacado::TemplateManager < TypeSeq, BaseT, ObjectT > ::const_iterator | begin () const |
Return an iterator that points to the first type object. More... | |
Sacado::TemplateManager < TypeSeq, BaseT, ObjectT > ::iterator | end () |
Return an iterator that points one past the last type object. More... | |
Sacado::TemplateManager < TypeSeq, BaseT, ObjectT > ::const_iterator | end () const |
Return an iterator that points one past the last type object. More... | |
Private Attributes | |
std::vector< Teuchos::RCP < BaseT > > | objects |
Stores array of rcp's to objects of each type. More... | |
Container class to manager template instantiations of a template class.
This class provides a generic container class for managing multiple instantiations of another class ObjectT. It assumes each class ObjectT<ScalarT> is derived from a non-template base class BaseT. It stores a vector of reference counted pointers to objects of type BaseT corresponding to each instantiation of ObjectT. The instantiations ObjectT for each ScalarT are provided by a builder class, passed through the buildObjects() method (see DefaultBuilderOp for an example builder). An iterator is provided for accessing each template instantiation, and non-templated virtual methods of BaseT can be called by dereferencing the iterator. Finally, template methods are provided to access the stored objects as either objects of type BaseT (getAsBase()) or objects of type ObjectT<ScalarT> (getAsObject()). A map using RTTI is used to map a typename to an index into the vector corresponding to the object of that type.
Template managers for specific types should derive from this class instantiated on those types. In most cases, a builder class will also need to be created to instantiate the objects for each scalar type.
Definition at line 49 of file Sacado_TemplateManager.hpp.
typedef TemplateIterator<BaseT> Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::iterator |
Typedef for iterator.
Definition at line 74 of file Sacado_TemplateManager.hpp.
typedef ConstTemplateIterator<BaseT> Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::const_iterator |
Typedef for const_iterator.
Definition at line 77 of file Sacado_TemplateManager.hpp.
Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::TemplateManager | ( | ) |
Default constructor.
Definition at line 12 of file Sacado_TemplateManagerImp.hpp.
Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::~TemplateManager | ( | ) |
Destructor.
Definition at line 21 of file Sacado_TemplateManagerImp.hpp.
void Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::buildObjects | ( | const BuilderOpT & | builder | ) |
Build objects for each ScalarT.
Definition at line 29 of file Sacado_TemplateManagerImp.hpp.
void Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::buildObjects | ( | ) |
Build objects for each ScalarT using default builder.
Definition at line 37 of file Sacado_TemplateManagerImp.hpp.
Teuchos::RCP< BaseT > Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::getAsBase | ( | ) |
Get RCP to object corrensponding to ScalarT as BaseT.
Definition at line 47 of file Sacado_TemplateManagerImp.hpp.
Teuchos::RCP< const BaseT > Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::getAsBase | ( | ) | const |
Get RCP to object corrensponding to ScalarT as BaseT.
Definition at line 56 of file Sacado_TemplateManagerImp.hpp.
Teuchos::RCP< typename Sacado::mpl::apply< ObjectT, ScalarT >::type > Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::getAsObject | ( | ) |
Get RCP to object corrensponding to ScalarT as ObjectT<ScalarT>
Definition at line 66 of file Sacado_TemplateManagerImp.hpp.
Teuchos::RCP< const typename Sacado::mpl::apply< ObjectT, ScalarT >::type > Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::getAsObject | ( | ) | const |
Get RCP to object corrensponding to ScalarT as ObjectT<ScalarT>
Definition at line 76 of file Sacado_TemplateManagerImp.hpp.
Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::iterator Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::begin | ( | ) |
Return an iterator that points to the first type object.
Definition at line 85 of file Sacado_TemplateManagerImp.hpp.
Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::const_iterator Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::begin | ( | ) | const |
Return an iterator that points to the first type object.
Definition at line 93 of file Sacado_TemplateManagerImp.hpp.
Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::iterator Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::end | ( | ) |
Return an iterator that points one past the last type object.
Definition at line 101 of file Sacado_TemplateManagerImp.hpp.
Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::const_iterator Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::end | ( | ) | const |
Return an iterator that points one past the last type object.
Definition at line 109 of file Sacado_TemplateManagerImp.hpp.
|
private |
Stores array of rcp's to objects of each type.
Definition at line 137 of file Sacado_TemplateManager.hpp.