ECF 1.5
PrimitiveSetAP.h
1#ifndef PrimitiveSetAP_h
2#define PrimitiveSetAP_h
3#include <vector>
4#include <ECF/ECF.h>
5#include "../../ECF/tree/Primitive.h"
6
7
8namespace Tree
9{
10
18 class PrimitiveSetAP
19 {
20
21 public:
22 PrimitiveSetAP();
23 virtual ~PrimitiveSetAP();
24
25 bool initialize(StateP state);
26
27 //void addFunction(PrimitiveP functionPrimitive);
28 bool addFunction(std::string name);
29 void addTerminal(PrimitiveP terminalPrimitive);
30
31 PrimitiveP getTerminalByName(std::string name);
32 PrimitiveP getGFSOneByName(std::string name);
33 PrimitiveP getGFSTwoByName(std::string name);
34 PrimitiveP getPrimitiveByName(std::string name);
35
36 PrimitiveP getTerminalByIndex(uint index);
37 PrimitiveP getGFSOneByIndex(uint index);
38 PrimitiveP getGFSTwoByIndex(uint index);
39 PrimitiveP getPrimitiveByIndex(uint index);
40
41 uint getGFSOneSetSize();
42 uint getGFSTwoSetSize();
43 uint getFunctionSetSize();
44 uint getTerminalSetSize();
45 uint getPrimitivesSize();
46
47 std::map <std::string, PrimitiveP> mAllPrimitives_;
48 std::map <std::string, Primitives::terminal_type> mTypeNames_;
49
50 protected:
51 StateP state_;
52
53 std::vector<PrimitiveP> terminalSet_;
54 std::map <std::string, PrimitiveP> mTerminalSet_;
55 std::vector<PrimitiveP> GFSOneSet_;
56 std::map <std::string, PrimitiveP> mGFSOneSet_;
57 std::vector<PrimitiveP> GFSTwoSet_;
58 std::map <std::string, PrimitiveP> mGFSTwoSet_;
59 std::vector<PrimitiveP> primitives_;
60 std::map <std::string, PrimitiveP> mPrimitiveSet_;
61 };
62 typedef boost::shared_ptr<PrimitiveSetAP> PrimitiveSetAPP;
63
64 typedef std::map <std::string, PrimitiveP>::iterator prim_iter;
65 typedef std::map <std::string, Primitives::terminal_type>::iterator type_iter;
66
67}
68#endif
std::vector< PrimitiveP > GFSOneSet_
vector of active (actual used) functions
PrimitiveP getTerminalByName(std::string name)
Access terminal by name (active terminals only).
std::map< std::string, PrimitiveP > mAllPrimitives_
map of all registered primitive functions
std::vector< PrimitiveP > primitives_
vector of active (actual used) primitives
void addTerminal(PrimitiveP terminalPrimitive)
Add a terminal primitive to the set of active primitives.
std::vector< PrimitiveP > GFSTwoSet_
vector of active (actual used) functions
uint getTerminalSetSize()
Get the number of active terminals.
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).
PrimitiveP getGFSTwoByName(std::string name)
Access function by name (active functions only).
std::map< std::string, PrimitiveP > mPrimitiveSet_
map of active (actual used) primitives
uint getPrimitivesSize()
Get the number of active primitives (functions and terminals).
std::vector< PrimitiveP > terminalSet_
vector of active (actual used) terminals
std::map< std::string, PrimitiveP > mGFSTwoSet_
map of active (actual used) functions
std::map< std::string, PrimitiveP > mTerminalSet_
map of active (actual used) terminals
PrimitiveP getGFSOneByName(std::string name)
Access function by name (active functions only).
std::map< std::string, PrimitiveP > mGFSOneSet_
map of active (actual used) functions