PetaVision  Alpha
 All Data Structures Namespaces Functions Variables
PV::KeywordHandler Class Reference

#include <KeywordHandler.hpp>

Public Member Functions

 KeywordHandler (char const *kw, ObjectCreateFn creator)
 KeywordHandler (KeywordHandler const &orig)
virtual ~KeywordHandler ()
BaseObjectcreate (char const *name, HyPerCol *hc) const
ObjectCreateFn getCreator () const
const char * getKeyword () const
KeywordHandleroperator= (KeywordHandler const &orig)

Protected Member Functions

int initialize (char const *kw, BaseObject *(*creator)(char const *name, HyPerCol *hc))

Private Attributes

ObjectCreateFn creator
char * keyword

Detailed Description

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.

Constructor & Destructor Documentation

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 21 of file KeywordHandler.cpp.

PV::KeywordHandler::~KeywordHandler ( )

The destructor for KeywordHandler.

Definition at line 44 of file KeywordHandler.cpp.

Member Function Documentation

BaseObject * PV::KeywordHandler::create ( char const *  name,
HyPerCol hc 
) const

The method that calls the function pointer with the given arguments

Definition at line 40 of file KeywordHandler.cpp.

ObjectCreateFn PV::KeywordHandler::getCreator ( ) const

A get-method for the handler's creator function pointer.

Definition at line 62 of file KeywordHandler.hpp.

const char* PV::KeywordHandler::getKeyword ( ) const

A get-method for the handler's keyword.

Definition at line 57 of file KeywordHandler.hpp.

int PV::KeywordHandler::initialize ( char const *  kw,
BaseObject *(*)(char const *name, HyPerCol *hc)  creator 

A method used internally by the constructors and copy assignment operator to set the initialize the KeywordHandler object.

Definition at line 31 of file KeywordHandler.cpp.

KeywordHandler & PV::KeywordHandler::operator= ( KeywordHandler const &  orig)

The copy assignment operator for KeywordHandler

Definition at line 25 of file KeywordHandler.cpp.

The documentation for this class was generated from the following files: