/*
 * Context.h
 *
 *  Created on: Dec 7, 2012
 *      Author: attero
 */

#ifndef CONTEXT_H_
#define CONTEXT_H_
#include <map>
#include "AST/SenchaObject.h"
#include <string>
#include <iostream>

typedef unsigned long ObjectIndex;
typedef unsigned long FunctionIndex;

class Context {
public:
	Context();
	typedef unsigned long ObjectIndex;
	ObjectIndex index;

	std::map<ObjectIndex, SenchaObject> object_store;
	ObjectIndex add_to_store(SenchaObject & object);
	SenchaObject get_from_store(ObjectIndex index);

	//Overload it to use contexts
	void add(std::string name, SenchaObject object);
	void set(std::string name, SenchaObject object);
	SenchaObject get(std::string name);
	typedef std::map<std::string, ObjectIndex> ExecutionContext;
	ExecutionContext interpreter_context;

	std::string debug() ;



	ExecutionContext global_context;
	std::map<FunctionIndex , ExecutionContext *> function_contexts;
	virtual ~Context();
};

#endif /* CONTEXT_H_ */
