AlgorithmFactory Class Reference
[Algorithms]

The algorithm factory is responsible for creating new instances of Algorithms, Configrations and ConfigWidgets. More...

#include <algorithm_factory.h>

List of all members.

Public Types

typedef boost::shared_ptr<
Algorithm
algorithm_pointer_type
typedef std::string key_type

Public Member Functions

 AlgorithmFactory ()
 ~AlgorithmFactory ()
void loadAlgorithm (key_type key, std::string library_path) throw (AlgorithmFactoryException)
bool isAlgorithmLoaded (key_type algorithm_key)
bool unloadAlgorithm (key_type algorithm_key)
algorithm_pointer_type createAlgorithm (key_type algorithm_key) const throw (AlgorithmNotFoundException, NullPointerException)
config_widget_pointer_type createConfigWidget (key_type algorithm_key) const throw (AlgorithmNotFoundException,NullPointerException)
configuration_pointer_type createConfiguration (AlgorithmFactory::key_type algorithm_key) const throw (AlgorithmNotFoundException,NullPointerException)

Protected Types

typedef AlgorithmInterfacelibrary_handle_type
typedef std::map< key_type,
library_handle_type
key_to_library_handle_map_type
typedef key_to_library_handle_map_type::iterator key_to_library_handle_iterator
typedef key_to_library_handle_map_type::const_iterator key_to_library_handle_const_iterator

Protected Attributes

key_to_library_handle_map_type library_handle_map_


Detailed Description

The algorithm factory is responsible for creating new instances of Algorithms, Configrations and ConfigWidgets.

The AlgorithmFactory provides an interface for loading shared libries that contain algorithms and creating instance of these algorithms and their configuration widgets.

Author:
Tobias Gross (tobias.gross@imedgine.org)

Christian Koerner (christian.koerner@imedgine.org)

Alexander Lex (alexander.lex@imedgine.org)

Marc Streit (marc.streit@imedgine.org)

Martin Reininger (martin.reininger@imedgine.org)

Definition at line 57 of file algorithm_factory.h.


Member Typedef Documentation

typedef boost::shared_ptr<Algorithm> algorithm_pointer_type
 

a shared pointer type holding an Algorithm object

Definition at line 65 of file algorithm_factory.h.

typedef std::string key_type
 

the type algorithm keys are stored as

Definition at line 71 of file algorithm_factory.h.


Constructor & Destructor Documentation

AlgorithmFactory  )  [inline]
 

Constructor

Definition at line 77 of file algorithm_factory.h.

~AlgorithmFactory  )  [inline]
 

Destructor

Definition at line 83 of file algorithm_factory.h.


Member Function Documentation

AlgorithmFactory::algorithm_pointer_type createAlgorithm key_type  algorithm_key  )  const throw (AlgorithmNotFoundException, NullPointerException)
 

Create an instance of the algorithm associated with the given key.

Parameters:
algorithm_key The key that identifies the algorithm uniquely (as returned by loadAlgorithm)
Returns:
A smart pointer to the newly created algorithm object or to NULL if no such algorithm can be found
Precondition:
The algorithm with the given key must have been previously loaded
Postcondition:
Object remains unchanged

Definition at line 90 of file algorithm_factory.cpp.

configuration_pointer_type createConfiguration AlgorithmFactory::key_type  algorithm_key  )  const throw (AlgorithmNotFoundException,NullPointerException)
 

Create an instance of the configuration class associated with the given algorithm_key

Parameters:
algorithm_key The key that identifies the configuration widget uniquely
Returns:
a smart pointer to the newly created configuration instance
Exceptions:
AlgorithmNotFoundException if the algorithm_key doesn't point to an algorithm
NullPointerException if the Configuration object's creation fails

Definition at line 139 of file algorithm_factory.cpp.

config_widget_pointer_type createConfigWidget key_type  algorithm_key  )  const throw (AlgorithmNotFoundException,NullPointerException)
 

Create an instance of the configuration widget associated with the given key.

Parameters:
algorithm_key The key that identifies the configuration widget uniquely (as returned by loadAlgorithm)
Returns:
product_type A smart pointer to the newly created widget instance or to NULL if no such key could be found
Precondition:
The algorithm with the given key must have been previously loaded
Postcondition:
Object remains unchanged

Definition at line 112 of file algorithm_factory.cpp.

bool isAlgorithmLoaded key_type  algorithm_key  ) 
 

Checks if the algorithm identified by algorithm_key is loaded.

Parameters:
algorithm_key the algorithm's identifier
Returns:
true if the algorithm is loaded, false otherwise

Definition at line 53 of file algorithm_factory.cpp.

Referenced by Controller::isAlgorithmLoaded().

void loadAlgorithm key_type  key,
std::string  library_path
throw (AlgorithmFactoryException)
 

Make an algorithm defined in a shared library accessible for the algorithm factory.

Parameters:
library_path The path to the shared library file
key_type The key that identifies the loaded algorithm uniquely
Exceptions:
AlgorithmFactoryException 

Definition at line 27 of file algorithm_factory.cpp.

bool unloadAlgorithm key_type  algorithm_key  ) 
 

Unload a shared library implementing an algorithm

Parameters:
algorithm The key that identifies the algorithm to unload uniquely
Returns:
false if an algorithm with the given key could not be found

Definition at line 67 of file algorithm_factory.cpp.

References AlgorithmFactory::library_handle_map_.


The documentation for this class was generated from the following files:
Generated on Sun Aug 13 18:19:59 2006 for iMEDgine by  doxygen 1.4.6