1#include "../ECF_base.h"
8PrimitiveSet::PrimitiveSet()
12PrimitiveSet::~PrimitiveSet()
16bool PrimitiveSet::initialize(StateP state)
21 PrimitiveP prim = (PrimitiveP) (
new Primitives::Add);
23 prim = (PrimitiveP) (
new Primitives::Sub);
25 prim = (PrimitiveP) (
new Primitives::Mul);
27 prim = (PrimitiveP) (
new Primitives::Div);
29 prim = (PrimitiveP) (
new Primitives::Sin);
31 prim = (PrimitiveP) (
new Primitives::Cos);
33 prim = (PrimitiveP) (
new Primitives::Pos);
35 prim = (PrimitiveP) (
new Primitives::Neg);
37 prim = (PrimitiveP) (
new Primitives::Max);
39 prim = (PrimitiveP) (
new Primitives::Min);
44 primIter->second->initialize(state);
47 mTypeNames_.insert(std::pair<std::string, Primitives::terminal_type>(
"DOUBLE", Primitives::Double));
48 mTypeNames_.insert(std::pair<std::string, Primitives::terminal_type>(
"INT", Primitives::Int));
49 mTypeNames_.insert(std::pair<std::string, Primitives::terminal_type>(
"BOOL", Primitives::Bool));
50 mTypeNames_.insert(std::pair<std::string, Primitives::terminal_type>(
"CHAR", Primitives::Char));
51 mTypeNames_.insert(std::pair<std::string, Primitives::terminal_type>(
"STRING", Primitives::String));
137 if(iter->second->getNumberOfArguments() == 0) {
159 mTerminalSet_[terminalPrimitive->getName()] = terminalPrimitive;
PrimitiveP getRandomFunction()
Get random function from the set of active functions.
uint getPrimitivesSize()
Get the number of active primitives (functions and terminals).
std::vector< PrimitiveP > primitives_
vector of active (actual used) primitives
PrimitiveP getTerminalByName(std::string name)
Access terminal by name (active terminals only).
std::map< std::string, PrimitiveP > mTerminalSet_
map of active (actual used) terminals
void addTerminal(PrimitiveP terminalPrimitive)
Add a terminal primitive to the set of active primitives.
PrimitiveP getRandomPrimitive()
Get random primitive (function or terminal) from the set of active primitives.
std::map< std::string, PrimitiveP > mPrimitiveSet_
map of active (actual used) primitives
uint getTerminalSetSize()
Get the number of active terminals.
uint getFunctionSetSize()
Get the number of active functions.
std::map< std::string, PrimitiveP > mFunctionSet_
map of active (actual used) functions
bool addFunction(std::string name)
Add a function primitive to the set of active primitives - if found by name in collection of all prim...
PrimitiveP getPrimitiveByName(std::string name)
Access primitive by name (active functions or terminals only).
std::vector< PrimitiveP > terminalSet_
vector of active (actual used) terminals
PrimitiveP getFunctionByName(std::string name)
Access function by name (active functions only).
std::vector< PrimitiveP > functionSet_
vector of active (actual used) functions
std::map< std::string, PrimitiveP > mAllPrimitives_
map of all registered primitive functions
PrimitiveP getRandomTerminal()
Get random terminal from the set of active terminals.