Teko Version of the Day
Public Member Functions | Protected Attributes
Teko::CloneFactory< CloneBaseType > Class Template Reference

#include <Teko_CloneFactory.hpp>

Inheritance diagram for Teko::CloneFactory< CloneBaseType >:
Inheritance graph

List of all members.

Public Member Functions

 CloneFactory ()
 Default constructor.
 CloneFactory (const CloneFactory< CloneBaseType > &cf)
 Copy constructor.
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.
void getCloneNames (std::vector< std::string > &names) const

Protected Attributes

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

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.

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

Definition at line 129 of file Teko_CloneFactory.hpp.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 132 of file Teko_CloneFactory.hpp.

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

Copy constructor.

Definition at line 135 of file Teko_CloneFactory.hpp.

Member Function Documentation

template<class CloneBaseType>
virtual Teuchos::RCP<CloneBaseType> Teko::CloneFactory< CloneBaseType >::build ( const std::string &  str) const [inline, virtual]

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.

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.
[in]strString associated with object to build.
A cloned object, correctly casted to CloneBaseType. If the string cannot be found then null is returned.

Definition at line 153 of file Teko_CloneFactory.hpp.

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

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.

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

Definition at line 170 of file Teko_CloneFactory.hpp.

template<class CloneBaseType>
virtual int Teko::CloneFactory< CloneBaseType >::cloneCount ( ) const [inline, virtual]

Return the number of clones stored in this factory.

Definition at line 174 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.

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

Definition at line 181 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 190 of file Teko_CloneFactory.hpp.

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables