blob: 5c75e4834e26a3d124d8dc25056ef1c98fa47373 (
plain)
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
50
51
52
|
#ifndef CONTEXT_H_
#define CONTEXT_H_
#include <string>
#include <vector>
#include <boost/unordered_map.hpp>
#include "value.h"
class Context
{
public:
Context(const Context *parent = NULL);
virtual ~Context();
virtual Value evaluate_function(const std::string &name, const class EvalContext *evalctx) const;
virtual class AbstractNode *evaluate_module(const class ModuleInstantiation &inst, const EvalContext *evalctx) const;
void setVariables(const std::vector<std::string> &argnames,
const std::vector<class Expression*> &argexpr,
const class EvalContext *evalctx = NULL);
void set_variable(const std::string &name, const Value &value);
void set_constant(const std::string &name, const Value &value);
Value lookup_variable(const std::string &name, bool silent = false) const;
void setDocumentPath(const std::string &path) { this->document_path = path; }
const std::string &documentPath() const { return this->document_path; }
std::string getAbsolutePath(const std::string &filename) const;
public:
const Context *parent;
static std::vector<const Context*> ctx_stack;
mutable boost::unordered_map<std::string, int> recursioncount;
protected:
typedef boost::unordered_map<std::string, Value> ValueMap;
ValueMap constants;
ValueMap variables;
ValueMap config_variables;
std::string document_path;
#ifdef DEBUG
public:
virtual void dump(const class AbstractModule *mod, const ModuleInstantiation *inst);
#endif
};
#endif
|