summaryrefslogtreecommitdiff
path: root/src/evalcontext.h
blob: 34f339afd08100829e35666fb852e00531f4f000 (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
#ifndef EVALCONTEXT_H_
#define EVALCONTEXT_H_

#include "context.h"

/*!
  This hold the evaluation context (the parameters actually sent
	when calling a module or function, including the children).
*/
class EvalContext : public Context
{
public:
	typedef std::vector<class ModuleInstantiation *> InstanceList;

	EvalContext(const Context *parent, 
							const AssignmentList &args, const class LocalScope *const scope = NULL)
		: Context(parent), eval_arguments(args), scope(scope) {}
	virtual ~EvalContext() {}

	size_t numArgs() const { return this->eval_arguments.size(); }
	const std::string &getArgName(size_t i) const;
	Value getArgValue(size_t i, const Context *ctx = NULL) const;

	size_t numChildren() const;
	ModuleInstantiation *getChild(size_t i) const;

#ifdef DEBUG
	virtual void dump(const class AbstractModule *mod, const ModuleInstantiation *inst);
#endif

private:
	const AssignmentList &eval_arguments;
	std::vector<std::pair<std::string, Value> > eval_values;
	const LocalScope *const scope;
};

#endif
contact: Jan Huwald // Impressum