/* * Context.h * * Created on: Dec 7, 2012 * Author: attero */ #ifndef CONTEXT_MANAGER_H_ #define CONTEXT_MANAGER_H_ #include #include #include #include #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 arguments); //creation, destruction and basic access to contexts Context * create_new_context(); void destroy_context(std::string name); Context * context(std::string name); //access to contexts using stack Context * get_top(); void pop_context(); virtual ~ContextManager(); private: /** * Contexts are stored both in a stack (FILO) and in a map (indexed by names). */ std::stack stack; std::map contexts; unsigned int index; }; #endif /* CONTEXT_MANAGER_H_ */