-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathState.hpp
49 lines (37 loc) · 977 Bytes
/
State.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// Copyright © 2017 Lennart Oymanns. All rights reserved.
//
#ifndef State_hpp
#define State_hpp
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "NumberRepr.hpp"
namespace Equation {
class UserFunction;
class Node;
typedef std::shared_ptr<Node> NodePtr;
class State {
public:
bool IsFunction(const std::string &name);
bool IsVariable(const std::string &name);
NodePtr EvalFunction(const std::string &name, const std::list<NodePtr> &x,
bool numeric);
NodePtr GetVariable(const std::string &name);
void SetVariable(const std::string &name, NodePtr value) {
variables[name] = value;
}
protected:
std::map<std::string, std::shared_ptr<UserFunction>> funcs;
std::map<std::string, NodePtr> variables;
};
class DefaultState : public State {
public:
DefaultState();
};
typedef std::shared_ptr<State> StatePtr;
} // namespace Equation
#endif /* State_hpp */