Container class to manager template instantiations of a template class. More...
#include <Phalanx_TemplateManager.hpp>
Classes | |
struct | DefaultBuilderOp |
The default builder class for building objects for each ScalarT. More... | |
Public Types | |
typedef TemplateIterator < TypeSeq, BaseT, ObjectT > | iterator |
Typedef for iterator. | |
typedef ConstTemplateIterator < TypeSeq, BaseT, ObjectT > | const_iterator |
Typedef for const_iterator. | |
Public Member Functions | |
TemplateManager () | |
Default constructor. | |
~TemplateManager () | |
Destructor. | |
template<typename BuilderOpT > | |
void | buildObjects (const BuilderOpT &builder) |
Build objects for each ScalarT. | |
void | buildObjects () |
Build objects for each ScalarT using default builder. | |
template<typename ScalarT > | |
Teuchos::RCP< BaseT > | getAsBase () |
Get RCP to object corrensponding to ScalarT as BaseT. | |
template<typename ScalarT > | |
Teuchos::RCP< const BaseT > | getAsBase () const |
Get RCP to object corrensponding to ScalarT as BaseT. | |
template<typename ScalarT > | |
Teuchos::RCP< typename Sacado::mpl::apply< ObjectT, ScalarT >::type > | getAsObject () |
Get RCP to object corrensponding to ScalarT as ObjectT<ScalarT> | |
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> | |
PHX::TemplateManager< TypeSeq, BaseT, ObjectT >::iterator | begin () |
Return an iterator that points to the first type object. | |
PHX::TemplateManager< TypeSeq, BaseT, ObjectT > ::const_iterator | begin () const |
Return an iterator that points to the first type object. | |
PHX::TemplateManager< TypeSeq, BaseT, ObjectT >::iterator | end () |
Return an iterator that points one past the last type object. | |
PHX::TemplateManager< TypeSeq, BaseT, ObjectT > ::const_iterator | end () const |
Return an iterator that points one past the last type object. | |
template<typename BuilderOpT > | |
void | deleteType () |
Delete the underlying type. Used to clean out unused types. | |
template<typename BuilderOpT > | |
void | disableType () |
Disable the type so that it is not allocated. | |
Friends | |
class | TemplateIterator< TypeSeq, BaseT, ObjectT > |
Declare TemplateIterator as a friend class. | |
Container class to manager template instantiations of a template class.
This class evaluatedFields 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.