Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
Sacado::TemplateManager< TypeSeq, BaseT, ObjectT > Class Template Reference

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...
 

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.

Definition at line 49 of file Sacado_TemplateManager.hpp.

Member Typedef Documentation

template<typename TypeSeq, typename BaseT, typename ObjectT>
typedef TemplateIterator<BaseT> Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::iterator

Typedef for iterator.

Definition at line 74 of file Sacado_TemplateManager.hpp.

template<typename TypeSeq, typename BaseT, typename ObjectT>
typedef ConstTemplateIterator<BaseT> Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::const_iterator

Typedef for const_iterator.

Definition at line 77 of file Sacado_TemplateManager.hpp.

Constructor & Destructor Documentation

template<typename TypeSeq , typename BaseT , typename ObjectT >
Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::TemplateManager ( )

Default constructor.

Definition at line 12 of file Sacado_TemplateManagerImp.hpp.

template<typename TypeSeq , typename BaseT , typename ObjectT >
Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::~TemplateManager ( )

Destructor.

Definition at line 21 of file Sacado_TemplateManagerImp.hpp.

Member Function Documentation

template<typename TypeSeq , typename BaseT , typename ObjectT >
template<typename BuilderOpT >
void Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::buildObjects ( const BuilderOpT &  builder)

Build objects for each ScalarT.

Definition at line 29 of file Sacado_TemplateManagerImp.hpp.

template<typename TypeSeq , typename BaseT , typename ObjectT >
void Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::buildObjects ( )

Build objects for each ScalarT using default builder.

Definition at line 37 of file Sacado_TemplateManagerImp.hpp.

template<typename TypeSeq , typename BaseT , typename ObjectT >
template<typename ScalarT >
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.

template<typename TypeSeq , typename BaseT , typename ObjectT >
template<typename ScalarT >
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.

template<typename TypeSeq , typename BaseT , typename ObjectT >
template<typename ScalarT >
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.

template<typename TypeSeq , typename BaseT , typename ObjectT >
template<typename ScalarT >
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.

template<typename TypeSeq , typename BaseT , typename ObjectT >
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.

template<typename TypeSeq , typename BaseT , typename ObjectT >
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.

template<typename TypeSeq , typename BaseT , typename ObjectT >
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.

template<typename TypeSeq , typename BaseT , typename ObjectT >
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.

Member Data Documentation

template<typename TypeSeq, typename BaseT, typename ObjectT>
std::vector< Teuchos::RCP<BaseT> > Sacado::TemplateManager< TypeSeq, BaseT, ObjectT >::objects
private

Stores array of rcp's to objects of each type.

Definition at line 137 of file Sacado_TemplateManager.hpp.


The documentation for this class was generated from the following files: