|
PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
|
#include <FunctionMap.h>
Public Member Functions | |
| FunctionMap () | |
| The Standard constructor. | |
| ~FunctionMap () | |
| The Standard destructor. | |
| void | AddFunction (std::string funcname, OpNode *node) |
| PNode * | GetFunction (const std::string &funcname) |
| bool | IsFunction (const std::string &funcname) |
| void | Erase (const std::string &funcname) |
| void | DumpValues () |
| void | Destroy () |
This is the primary structure for holding user-defined functions. It is an STL map that takes a string-based function name and stores a PNode. FunctionMap uses an STL multimap, which allows us to have many functions with the same name. The most recently loaded function blocks earlier ones, but earlier ones can be access if the later ones are deleted.
Definition at line 45 of file FunctionMap.h.
| FunctionMap::FunctionMap | ( | ) |
The Standard constructor.
This class stores pointers to user-defined pnode-parsed functions, which can be accessed by name. This includes the main function of the PEBL program.
Definition at line 53 of file FunctionMap.cpp.
| FunctionMap::~FunctionMap | ( | ) |
The Standard destructor.
Definition at line 59 of file FunctionMap.cpp.
References Destroy().
| void FunctionMap::AddFunction | ( | std::string | funcname, |
| OpNode * | node | ||
| ) |
This method will add a new variable with name varname and value val to the variable map, or (if it already exists) change its value to val.
Definition at line 94 of file FunctionMap.cpp.
References PEBLUtility::ToUpper().
Referenced by Loader::LoadLibraryFunctions(), Loader::LoadUserFunctions(), and main().
| void FunctionMap::Destroy | ( | ) |
Definition at line 69 of file FunctionMap.cpp.
References NULL.
Referenced by CaptureSignal(), PEBLInterpret(), and ~FunctionMap().
| void FunctionMap::DumpValues | ( | ) |
This method is primarily for debugging purposes. It will iterate through the entire variable map, and Display each of the values held in the map.
Definition at line 212 of file FunctionMap.cpp.
Referenced by GetFunction(), Loader::LoadLibraryFunctions(), main(), and PEBLInterpret().
| void FunctionMap::Erase | ( | const std::string & | funcname | ) |
This will erase the topmost value stored in varname
Definition at line 200 of file FunctionMap.cpp.
References PEBLUtility::ToUpper().
Referenced by main().
| PNode * FunctionMap::GetFunction | ( | const std::string & | funcname | ) |
This method will add a new function with name and code associated with the OpNode node, which is of type PEBL_FUNCTION. This method will retrieve the value designated by funcname. If funcname doesn't exist, it will return a null pointer.
Definition at line 140 of file FunctionMap.cpp.
References DumpValues(), NULL, PEBL_DATA_NODE, PEBL_OP_NODE, PError::SignalFatalError(), and PEBLUtility::ToUpper().
Referenced by Evaluator::CallFunction(), Evaluator::Evaluate1(), Loader::GetMainPEBLFunction(), and main().
| bool FunctionMap::IsFunction | ( | const std::string & | funcname | ) |
This function just determines whether there is a function of the given name. It is useful because GetFunction() may behave badly when the function doesn't exist. It converts the query to uppercase, because everything in the functionmap should be uppercase.
Definition at line 182 of file FunctionMap.cpp.
References PEBLUtility::ToUpper().