A Factory singleton class for creating objects whose class derives from Fitter. More...
#include <FitterFactory.h>


Public Member Functions | |
| void | add (Fitter *) |
| Adds a prototype object to the list of prototypes. More... | |
| Fitter * | create (const std::string &name) |
| Creates a new object from a prototype named name. More... | |
| bool | exists (const std::string &name) const |
| Returns true if prototype with name name exists in the factory, otherwise returns false. More... | |
| const std::string & | getDefault () const |
| Returns the default Fitter. More... | |
| const std::vector< std::string > & | names () const |
| Returns the list of available prototype names. More... | |
| Fitter * | prototype (const std::string &name) const |
| Returns a pointer to a prototype with name name. More... | |
| void | remove (const std::string &name) |
| Removes the named prototype object from the list of prototypes. More... | |
| void | setDefault (const std::string &name) |
| Sets the application's default Fitter. More... | |
Static Public Member Functions | |
| static FitterFactory * | instance () |
| Returns a pointer to the singleton instance. More... | |
Protected Member Functions | |
| FitterFactory () | |
| A default constructor for prevent creation except by the itself or the derived classes. More... | |
Protected Attributes | |
| std::vector< std::string > | m_names |
| The list of available types by names. More... | |
| std::map< std::string, Fitter * > | m_types |
| A list of available types. More... | |
Private Member Functions | |
| FitterFactory (const FitterFactory &) | |
| A private copy constructor to prevent copying. More... | |
| void | initialize () |
| Initializes the factory with a set of default functions. More... | |
Private Attributes | |
| std::string | m_default |
| The application's default fitter, if non empty. More... | |
Static Private Attributes | |
| static FitterFactory * | s_instance = 0 |
| A pointer to the singleton object. More... | |
A Factory singleton class for creating objects whose class derives from Fitter.
Definition at line 28 of file FitterFactory.h.
|
private |
A private copy constructor to prevent copying.
|
protected |
A default constructor for prevent creation except by the itself or the derived classes.
Definition at line 46 of file FitterFactory.cxx.
Referenced by FitterFactory::instance().
|
inherited |
Adds a prototype object to the list of prototypes.
Referenced by FitterFactory::initialize().
|
inherited |
Creates a new object from a prototype named name.
If found, returns a new object by invoking the clone() member function of the prototype. If not found, throws a FactoryException object with the name not found.
|
inherited |
Returns true if prototype with name name exists in the factory, otherwise returns false.
Referenced by FitterFactory::setDefault().
| const string & getDefault | ( | ) | const |
Returns the default Fitter.
Definition at line 109 of file FitterFactory.cxx.
References FitterFactory::m_default, and Factory< Fitter >::names().
|
private |
Initializes the factory with a set of default functions.
Definition at line 60 of file FitterFactory.cxx.
References Factory< Fitter >::add().
Referenced by FitterFactory::instance().
|
static |
Returns a pointer to the singleton instance.
Definition at line 50 of file FitterFactory.cxx.
References FitterFactory::FitterFactory(), FitterFactory::initialize(), and FitterFactory::s_instance.
Referenced by FunctionController::addFunctionRep(), FunctionController::changeFitter(), FunctionController::createFunctionRep(), FunctionController::getDefaultFitter(), FunctionController::getFitterNames(), FunctionController::isCompatible(), FunctionController::setDefaultFitter(), and FunctionController::setFitter().
|
inherited |
Returns the list of available prototype names.
Referenced by FitterFactory::getDefault().
|
inherited |
Returns a pointer to a prototype with name name.
If a prototype with name doesn't exit, throws a FactoryException object with the name not found.
|
inherited |
Removes the named prototype object from the list of prototypes.
| void setDefault | ( | const std::string & | name | ) |
Sets the application's default Fitter.
Sets the application's default fitter, if the name exists, otherwise throws a std::runtime_error exception.
Definition at line 93 of file FitterFactory.cxx.
References Factory< Fitter >::exists(), FitterFactory::m_default, and yes.
|
private |
The application's default fitter, if non empty.
Definition at line 35 of file FitterFactory.h.
Referenced by FitterFactory::getDefault(), and FitterFactory::setDefault().
|
mutableprotectedinherited |
|
protectedinherited |
|
staticprivate |
A pointer to the singleton object.
Definition at line 38 of file FitterFactory.h.
Referenced by FitterFactory::instance().