summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/ContextManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'Sencha-lang/ContextManager.h')
-rw-r--r--Sencha-lang/ContextManager.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/Sencha-lang/ContextManager.h b/Sencha-lang/ContextManager.h
index 8b82342..be4ccc9 100644
--- a/Sencha-lang/ContextManager.h
+++ b/Sencha-lang/ContextManager.h
@@ -13,25 +13,35 @@
#include <stack>
#include "Context.h"
-
+/**
+ * ContextManager manages contexts.
+ */
class ContextManager {
public:
ContextManager();
+ /**
+ * execute_function(name, arguments) executes function giving her its own execution context.
+ */
+ SenchaObject execute_function(std::string name, std::vector<ASTExpression *> arguments);
- std::stack<Context *> stack;
- std::map<std::string, Context *> contexts;
+ //creation, destruction and basic access to contexts
Context * create_new_context();
void destroy_context(std::string name);
- Context * get_context(std::string name);
Context * context(std::string name);
+ //access to contexts using stack
Context * get_top();
-
- SenchaObject execute_function(std::string name, std::vector<ASTExpression *> arguments);
void pop_context();
- unsigned int index;
+
virtual ~ContextManager();
+private:
+ /**
+ * Contexts are stored both in a stack (FILO) and in a map (indexed by names).
+ */
+ std::stack<Context *> stack;
+ std::map<std::string, Context *> contexts;
+ unsigned int index;
};
#endif /* CONTEXT_MANAGER_H_ */