USCXMLInvoker.h
Go to the documentation of this file.
1 
20 #ifndef USCXMLINVOKER_H_OQFA21IO
21 #define USCXMLINVOKER_H_OQFA21IO
22 
23 #include "uscxml/config.h"
26 
28 
29 #ifdef BUILD_AS_PLUGINS
30 #include "uscxml/plugins/Plugins.h"
31 #endif
32 
33 #define USCXML_INVOKER_SCXML_TYPE "http://www.w3.org/TR/scxml"
34 
35 namespace uscxml {
36 
42  public InvokerImpl,
43  public std::enable_shared_from_this<USCXMLInvoker> {
44 public:
46  public:
47  ParentQueueImpl(USCXMLInvoker* invoker) : _invoker(invoker) {}
48  virtual void enqueue(const Event& event);
49  USCXMLInvoker* _invoker;
50  };
51 
52  USCXMLInvoker();
53  virtual ~USCXMLInvoker();
54  virtual std::shared_ptr<InvokerImpl> create(InvokerCallbacks* callbacks);
55 
56  virtual std::list<std::string> getNames() {
57  std::list<std::string> names;
58  names.push_back("scxml");
59  names.push_back("uscxml");
60  names.push_back(USCXML_INVOKER_SCXML_TYPE);
61  names.push_back("http://www.w3.org/TR/scxml/");
62  return names;
63  }
64 
65  virtual void eventFromSCXML(const Event& event);
66 
67  virtual Data getDataModelVariables();
68  virtual void invoke(const std::string& source, const Event& invokeEvent);
69  virtual void uninvoke();
70 
71  virtual void deserialize(const Data& encodedState);
72  virtual Data serialize();
73 
74 protected:
75 
76  void start();
77  void stop();
78  static void run(void* instance);
79 
80  bool _isActive;
81  bool _isStarted;
82  std::thread* _thread;
83  EventQueue _parentQueue;
84  Interpreter _invokedInterpreter;
85 
86  std::recursive_mutex _mutex;
87  std::condition_variable_any _cond;
88 
89 };
90 
91 #ifdef BUILD_AS_PLUGINS
92 PLUMA_INHERIT_PROVIDER(USCXMLInvoker, InvokerImpl)
93 #endif
94 
95 }
96 
97 #endif /* end of include guard: USCXMLINVOKER_H_OQFA21IO */
virtual void invoke(const std::string &source, const Event &invokeEvent)
Invoker's parent state became active at the end of a macro-step.
Definition: USCXMLInvoker.cpp:154
Definition: Breakpoint.cpp:26
virtual void eventFromSCXML(const Event &event)
Invoker received an event from the SCXML Interpreter.
Definition: USCXMLInvoker.cpp:106
virtual Data serialize()
Save our state into a Data object.
Definition: USCXMLInvoker.cpp:82
virtual std::list< std::string > getNames()
Return a list of names for types we implement.
Definition: USCXMLInvoker.h:56
Definition: USCXMLInvoker.h:45
Definition: EventQueue.h:35
void stop()
Definition: USCXMLInvoker.cpp:62
Definition: BasicEventQueue.h:37
virtual std::shared_ptr< InvokerImpl > create(InvokerCallbacks *callbacks)
Factory demands a new instance.
Definition: USCXMLInvoker.cpp:143
Central class to interpret and process SCXML documents.
Definition: Interpreter.h:79
Abstract base class for all invokers.
Definition: InvokerImpl.h:59
virtual Data getDataModelVariables()
Export a Data object for the `_x['name']` data-model namespace.
Definition: USCXMLInvoker.cpp:149
virtual void uninvoke()
The invokers's parent state was left at the end of a macro-step.
Definition: USCXMLInvoker.cpp:101
An invoker for other SCXML instances.
Definition: USCXMLInvoker.h:41
Definition: Event.h:94
Callbacks available for every invoker.
Definition: InvokerImpl.h:43
virtual void deserialize(const Data &encodedState)
Load a state from a Data object.
Definition: USCXMLInvoker.cpp:78
Definition: Data.h:44