#ifndef POSTPONEELEMENT_H_WN8EIYYI #define POSTPONEELEMENT_H_WN8EIYYI #include #include #ifdef BUILD_AS_PLUGINS #include "uscxml/plugins/Plugins.h" #endif namespace uscxml { class PostponeElement : public ExecutableContentImpl { public: struct Postponed { Postponed(const Event& event, const std::string& until, long timeout, bool chaining = false) : event(event), until(until), timeout(timeout), chaining(chaining) {} Event event; std::string until; uint64_t timeout; bool chaining; }; PostponeElement() {} virtual ~PostponeElement() {} boost::shared_ptr create(InterpreterImpl* interpreter); std::string getLocalName() { return "postpone"; } std::string getNamespace() { return "http://www.w3.org/2005/07/scxml"; } bool processChildren() { return false; } void enterElement(const Arabica::DOM::Node& node); void exitElement(const Arabica::DOM::Node& node); protected: // once per interpreter class Resubmitter : public InterpreterMonitor { public: Resubmitter(InterpreterImpl* interpreter) { interpreter->addMonitor(this); } static Resubmitter* getInstance(InterpreterImpl* interpreter); static void postpone(const Event& event, std::string until, uint64_t timeout, bool chained, InterpreterImpl* interpreter); // InterpreterMonitor void onStableConfiguration(Interpreter interpreter); void afterCompletion(Interpreter interpreter); std::list _postponedEvents; static std::map _instances; static tthread::recursive_mutex _accessLock; }; }; #ifdef BUILD_AS_PLUGINS PLUMA_INHERIT_PROVIDER(PostponeElement, ExecutableContentImpl); #endif } #endif /* end of include guard: POSTPONEELEMENT_H_WN8EIYYI */