PetaVision
Alpha
|
#include <KeywordHandler.hpp>
Public Member Functions | |
KeywordHandler (char const *kw, ObjectCreateFn creator) | |
KeywordHandler (KeywordHandler const &orig) | |
virtual | ~KeywordHandler () |
BaseObject * | create (char const *name, HyPerCol *hc) const |
ObjectCreateFn | getCreator () const |
const char * | getKeyword () const |
KeywordHandler & | operator= (KeywordHandler const &orig) |
Protected Member Functions | |
int | initialize (char const *kw, BaseObject *(*creator)(char const *name, HyPerCol *hc)) |
Private Attributes | |
ObjectCreateFn | creator |
char * | keyword |
KeywordHandler is a class that associates a string, the keyword, with a function pointer for creating objects of a type corresponding to that keyword. It is used by Factory to to manage creating layers, connections, etc., within a HyPerCol. It is generally not used except internally by Factory.
As an example, after creating a KeywordHandler with the statement
KeywordHandler * kwh = new KeywordHandler("HyPerLayer", createHyPerLayer);
(the function createHyPerLayer is defined in layers/HyPerLayer.hpp), one can insert a new HyPerLayer called "layer" into a given HyPerCol with the statement.
kwh->create("layer", hc);
Definition at line 37 of file KeywordHandler.hpp.
PV::KeywordHandler::KeywordHandler | ( | char const * | kw, |
ObjectCreateFn | creator | ||
) |
The constructor for KeywordHandler.
Definition at line 17 of file KeywordHandler.cpp.
PV::KeywordHandler::KeywordHandler | ( | KeywordHandler const & | orig | ) |
The copy constructor for KeywordHandler
Definition at line 19 of file KeywordHandler.cpp.
|
virtual |
The destructor for KeywordHandler.
Definition at line 42 of file KeywordHandler.cpp.
BaseObject * PV::KeywordHandler::create | ( | char const * | name, |
HyPerCol * | hc | ||
) | const |
The method that calls the function pointer with the given arguments
Definition at line 38 of file KeywordHandler.cpp.
|
inline |
A get-method for the handler's creator function pointer.
Definition at line 62 of file KeywordHandler.hpp.
|
inline |
A get-method for the handler's keyword.
Definition at line 57 of file KeywordHandler.hpp.
|
protected |
A method used internally by the constructors and copy assignment operator to set the initialize the KeywordHandler object.
Definition at line 29 of file KeywordHandler.cpp.
KeywordHandler & PV::KeywordHandler::operator= | ( | KeywordHandler const & | orig | ) |
The copy assignment operator for KeywordHandler
Definition at line 23 of file KeywordHandler.cpp.