Teko  Version of the Day
 All Classes Files Functions Variables Pages
Public Member Functions | Protected Attributes | List of all members
Teko::CloneFactory< CloneBaseType > Class Template Reference

#include <Teko_CloneFactory.hpp>

Inheritance diagram for Teko::CloneFactory< CloneBaseType >:
Inheritance graph
[legend]

Public Member Functions

 CloneFactory ()
 Default constructor. More...
 
 CloneFactory (const CloneFactory< CloneBaseType > &cf)
 Copy constructor. More...
 
virtual Teuchos::RCP
< CloneBaseType > 
build (const std::string &str) const
 
virtual void addClone (const std::string &str, const Teuchos::RCP< Cloneable > &clone)
 
virtual int cloneCount () const
 Return the number of clones stored in this factory. More...
 
void getCloneNames (std::vector< std::string > &names) const
 

Protected Attributes

std::map< std::string,
Teuchos::RCP< const Cloneable > > 
parentClones_
 stores the clonable objects More...
 

Detailed Description

template<class CloneBaseType>
class Teko::CloneFactory< CloneBaseType >

This class eases the construction of clone factories. It takes any Cloneable object and associates it with a string. It will then perform the dynamic cast to whatever type the user specifies using the CloneBaseType template parameter.

Note
A word of warning. This class does not provide compile time type safety.

Definition at line 91 of file Teko_CloneFactory.hpp.

Constructor & Destructor Documentation

template<class CloneBaseType>
Teko::CloneFactory< CloneBaseType >::CloneFactory ( )
inline

Default constructor.

Definition at line 94 of file Teko_CloneFactory.hpp.

template<class CloneBaseType>
Teko::CloneFactory< CloneBaseType >::CloneFactory ( const CloneFactory< CloneBaseType > &  cf)
inline

Copy constructor.

Definition at line 97 of file Teko_CloneFactory.hpp.

Member Function Documentation

template<class CloneBaseType>
virtual Teuchos::RCP<CloneBaseType> Teko::CloneFactory< CloneBaseType >::build ( const std::string &  str) const
inlinevirtual

Build a clone of the object associated with the string. This object is automatically cast to the desired base type. This will permit the easy use of the AutoClone class.

Note
This method will throw an exception if the clone is not the right type (i.e. the dynamic cast to CloneBaseType fails). Also, this method returns null if the clone associated with the string can't be found.
Parameters
[in]strString associated with object to build.
Returns
A cloned object, correctly casted to CloneBaseType. If the string cannot be found then null is returned.

Definition at line 115 of file Teko_CloneFactory.hpp.

template<class CloneBaseType>
virtual void Teko::CloneFactory< CloneBaseType >::addClone ( const std::string &  str,
const Teuchos::RCP< Cloneable > &  clone 
)
inlinevirtual

Add a string associated clone to the factory. This object can be used later to build a clone of itself. If this method is called twice with the same string, the later clone will be maintained.

Note
The object to be cloned is stored until the CloneFactory is destroyed.
Parameters
[in]strString associated with this object.
[in]cloneObject to be cloned.

Definition at line 131 of file Teko_CloneFactory.hpp.

template<class CloneBaseType>
virtual int Teko::CloneFactory< CloneBaseType >::cloneCount ( ) const
inlinevirtual

Return the number of clones stored in this factory.

Definition at line 136 of file Teko_CloneFactory.hpp.

template<class CloneBaseType>
void Teko::CloneFactory< CloneBaseType >::getCloneNames ( std::vector< std::string > &  names) const
inline

Get the label for all clones in this CloneFactory.

Parameters
[in,out]namesDestination vector for the the clone names

Definition at line 142 of file Teko_CloneFactory.hpp.

Member Data Documentation

template<class CloneBaseType>
std::map<std::string, Teuchos::RCP<const Cloneable> > Teko::CloneFactory< CloneBaseType >::parentClones_
protected

stores the clonable objects

Definition at line 150 of file Teko_CloneFactory.hpp.


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