openModeller
Version 1.5.0
|
#include <AlgorithmFactory.hh>
Classes | |
class | DLL |
Public Member Functions | |
~AlgorithmFactory () | |
Static Public Member Functions | |
static void | setDefaultAlgDir (std::string const dir) |
static std::string | getDefaultAlgDir () |
static int | searchDefaultDirs () |
static int | addDir (const std::string &dirs) |
static bool | addDll (const std::string &file) |
static AlgMetadata const ** | availableAlgorithms () |
static int | numAvailableAlgorithms () |
static AlgMetadata const * | algorithmMetadata (std::string const algorithm_id) |
static AlgorithmPtr | newAlgorithm (std::string const id) |
static AlgorithmPtr | newAlgorithm (const ConstConfigurationPtr &) |
static ConfigurationPtr | getConfiguration () |
static std::string const | getCurrentId (std::string const algorithm_id) |
Private Types | |
typedef ReferenceCountedPointer< DLL > | DLLPtr |
typedef std::list< DLLPtr > | ListDLL |
typedef std::list< std::string > | PluginPath |
Private Member Functions | |
AlgorithmFactory () | |
int | p_addDir (const std::string &dir) |
bool | p_addDll (const std::string &file) |
Static Private Member Functions | |
static AlgorithmFactory & | getInstance () |
Private Attributes | |
std::string | _default_alg_dir |
ListDLL | _dlls |
PluginPath | _pluginpath |
Friends | |
class | testDLLId |
Responsable for instantiate algorithms.
Obs: Besides instantiate the algorithms it does not sets the Sampler object of the algorithms. So, before use an algorithm returned by this classe one needs to calls the method Algorithm::setSample().
Definition at line 55 of file AlgorithmFactory.hh.
|
private |
Definition at line 167 of file AlgorithmFactory.hh.
|
private |
Definition at line 169 of file AlgorithmFactory.hh.
|
private |
Definition at line 170 of file AlgorithmFactory.hh.
AlgorithmFactory::~AlgorithmFactory | ( | ) |
Definition at line 177 of file AlgorithmFactory.cpp.
|
private |
Definition at line 168 of file AlgorithmFactory.cpp.
|
static |
Search for all DLLs in some directories.
dirs | null terminated string representing a directory to scan |
Definition at line 366 of file AlgorithmFactory.cpp.
References getInstance(), and p_addDir().
Referenced by searchDefaultDirs().
|
static |
Add a single file to the DLL search list.
file | name of dll file to attempt to load |
Definition at line 404 of file AlgorithmFactory.cpp.
References getInstance(), and p_addDll().
|
static |
Returns an specific algorithm metadata
algorithm_id | Identifier of the algorithm. |
Definition at line 257 of file AlgorithmFactory.cpp.
References _dlls, Log::error(), getCurrentId(), getInstance(), and Log::instance().
Referenced by OpenModeller::algorithmMetadata(), and main().
|
static |
Finds the system available algorithms.
Note that the returned algorithms can not run because they are not initialized with "Sampler" and parameters! To do so, use the method newAlgorithm().
The pointer to the array must be deallocated by the caller using delete []. However, the individual AlgMetadata*'s in the array must not be deallocated. For instance:
AlgMetadata const **algorithms = om->availableAlgorithms(); // do something delete [] algorithms;
Definition at line 213 of file AlgorithmFactory.cpp.
References _dlls, getInstance(), and metadata.
Referenced by OpenModeller::availableAlgorithms().
|
static |
Definition at line 435 of file AlgorithmFactory.cpp.
References _dlls, AlgMetadata::absence, AlgMetadata::author, AlgMetadata::biblio, AlgMetadata::categorical, AlgMetadata::code_author, AlgMetadata::contact, AlgParamMetadata::description, AlgMetadata::description, getInstance(), AlgParamMetadata::has_max, AlgParamMetadata::has_min, AlgParamMetadata::id, AlgMetadata::id, Integer, AlgParamMetadata::max_val, AlgParamMetadata::min_val, AlgParamMetadata::name, AlgMetadata::name, AlgMetadata::nparam, AlgParamMetadata::overview, AlgMetadata::overview, AlgMetadata::param, Real, String, AlgParamMetadata::type, AlgParamMetadata::typical, and AlgMetadata::version.
Referenced by main().
|
static |
Returns the current algorithm id in case it matches one of the previous ids of an algorithm. This method was created to allow changes in algorithm ids without breaking compatibility with serialized data.
algorithm_id | Identifier of an algorithm. |
Definition at line 575 of file AlgorithmFactory.cpp.
Referenced by algorithmMetadata().
|
static |
Return the default directory to search for algorithms.
Definition at line 203 of file AlgorithmFactory.cpp.
References _default_alg_dir, and getInstance().
Referenced by initialPluginPath().
|
staticprivate |
Definition at line 184 of file AlgorithmFactory.cpp.
Referenced by addDir(), addDll(), algorithmMetadata(), availableAlgorithms(), getConfiguration(), getDefaultAlgDir(), numAvailableAlgorithms(), and setDefaultAlgDir().
|
static |
Instantiate a new algorithm object.
id | Identifier of the algorithm to be instantiated. |
Referenced by ConsensusAlgorithm::_setAlgorithm(), ConsensusAlgorithm::_setConfiguration(), BestSubsets::_setConfiguration(), AbstractBestSubsets::_setConfiguration(), AlgorithmImpl::getFreshCopy(), AbstractBestSubsets::iterate(), main(), AbstractBestSubsets::needNormalization(), newAlgorithm(), OpenModeller::setAlgorithm(), OpenModeller::setModelConfiguration(), and OpenModeller::setProjectionConfiguration().
|
static |
Definition at line 328 of file AlgorithmFactory.cpp.
References Log::debug(), Log::instance(), and newAlgorithm().
|
static |
Number of available algorithms. If the algorithms are not already searched in the system, searchs them first.
Definition at line 244 of file AlgorithmFactory.cpp.
References _dlls, and getInstance().
Referenced by OpenModeller::numAvailableAlgorithms().
|
private |
Implementation of directory scan.
dir | Directory to scan. |
Definition at line 376 of file AlgorithmFactory.cpp.
References _dlls, Log::instance(), p_addDll(), scanDirectory(), and Log::warn().
Referenced by addDir().
|
private |
Implementation of Dll load.
file | Name of file to laod. |
Definition at line 414 of file AlgorithmFactory.cpp.
References _dlls, Log::debug(), and Log::instance().
Referenced by addDll(), and p_addDir().
|
static |
Search for all DLLs in default directories.
The default search algorithm is platform specific.
Definition at line 351 of file AlgorithmFactory.cpp.
References addDir(), Log::debug(), initialPluginPath(), and Log::instance().
Referenced by main().
|
static |
Set a default directory to search for algorithms.
dir | Default directory |
Definition at line 193 of file AlgorithmFactory.cpp.
References _default_alg_dir, and getInstance().
Referenced by setupExternalResources().
|
friend |
Definition at line 166 of file AlgorithmFactory.hh.
|
private |
Definition at line 164 of file AlgorithmFactory.hh.
Referenced by getDefaultAlgDir(), and setDefaultAlgDir().
|
private |
Definition at line 172 of file AlgorithmFactory.hh.
Referenced by algorithmMetadata(), availableAlgorithms(), getConfiguration(), numAvailableAlgorithms(), p_addDir(), and p_addDll().
|
private |
Definition at line 173 of file AlgorithmFactory.hh.