Sacado Development
Classes | Public Types | Public Member Functions
Sacado::TemplateManager< TypeSeq, BaseT, ObjectT > Class Template Reference

Container class to manager template instantiations of a template class. More...

#include <Sacado_TemplateManager.hpp>

List of all members.

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.

Public Types

typedef TemplateIterator< BaseT > iterator
 Typedef for iterator.
typedef ConstTemplateIterator
< BaseT > 
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>
Sacado::TemplateManager
< TypeSeq, BaseT, ObjectT >
::iterator 
begin ()
 Return an iterator that points to the first type object.
Sacado::TemplateManager
< TypeSeq, BaseT, ObjectT >
::const_iterator 
begin () const
 Return an iterator that points to the first type object.
Sacado::TemplateManager
< TypeSeq, BaseT, ObjectT >
::iterator 
end ()
 Return an iterator that points one past the last type object.
Sacado::TemplateManager
< TypeSeq, BaseT, ObjectT >
::const_iterator 
end () const
 Return an iterator that points one past the last type object.

Detailed Description

template<typename TypeSeq, typename BaseT, typename ObjectT>
class Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends