Interpreter.h
Go to the documentation of this file.
1 
20 #ifndef INTERPRETER_H_6CD5A168
21 #define INTERPRETER_H_6CD5A168
22 
23 
24 #include "Common.h"
25 
26 #include <map>
27 #include <string>
28 #include <vector>
29 
33 #include "uscxml/plugins/Factory.h"
37 
38 #ifdef max
39 #error define NOMINMAX or undefine the max macro please (https://support.microsoft.com/en-us/kb/143208)
40 #endif
41 
42 namespace uscxml {
43 
44 class InterpreterMonitor;
45 class InterpreterImpl;
46 class InterpreterIssue;
47 
48 
53 class USCXML_API ActionLanguage {
54 public:
62 };
63 
79 class USCXML_API Interpreter {
80 public:
81 
88  static Interpreter fromDocument(XERCESC_NS::DOMDocument* dom,
89  const std::string& baseURL,
90  bool copy = true);
97  static Interpreter fromElement(XERCESC_NS::DOMElement* element,
98  const std::string& baseURL);
104  static Interpreter fromXML(const std::string& xml,
105  const std::string& baseURL);
110  static Interpreter fromURL(const std::string& url);
111 
116  static Interpreter fromClone(const Interpreter& other);
117 
122 
136  InterpreterState step(size_t blockMs = std::numeric_limits<size_t>::max());
137 
141  void cancel();
142 
146  void reset();
147 
151  void deserialize(const std::string& encodedState);
152 
156  std::string serialize();
157 
162  std::list<XERCESC_NS::DOMElement*> getConfiguration();
163 
169  bool isInState(const std::string& stateId);
170 
175  InterpreterState getState();
176 
181  std::list<InterpreterIssue> validate();
182 
187  void receive(const Event& event);
188 
192  void setActionLanguage(ActionLanguage actionLanguage);
193 
197  ActionLanguage* getActionLanguage();
198 
202  void setFactory(Factory* factory);
203 
207  void addMonitor(InterpreterMonitor* monitor);
208 
212  void removeMonitor(InterpreterMonitor* monitor);
213 
217  Logger getLogger();
218 
222  std::shared_ptr<InterpreterImpl> getImpl() const {
223  return _impl;
224  }
225 
226 protected:
227  std::shared_ptr<InterpreterImpl> _impl;
228 
229 };
230 
231 }
232 
233 #endif /* end of include guard: INTERPRETER_H_6CD5A168 */
EventQueue internalQueue
The queue where internal events will be enqueued.
Definition: Interpreter.h:59
Definition: Factory.h:48
Definition: Breakpoint.cpp:26
Definition: InterpreterMonitor.h:57
#define PIMPL_OPERATORS(type)
The usual operators as required for the PIMPL pattern.
Definition: Common.h:68
Definition: EventQueue.h:35
Central class to interpret and process SCXML documents.
Definition: Interpreter.h:79
EventQueue externalQueue
The queue for external events.
Definition: Interpreter.h:60
MicroStep microStepper
The microstepper instance to use.
Definition: Interpreter.h:56
Definition: EventQueue.h:57
Collection of instances for interpreter that constitute its action language.
Definition: Interpreter.h:53
DataModel dataModel
The datamodel to use.
Definition: Interpreter.h:57
std::shared_ptr< InterpreterImpl > getImpl() const
Return the actual implementation of the Interperter.
Definition: Interpreter.h:222
ContentExecutor execContent
To process executable content elements.
Definition: Interpreter.h:58
Definition: Event.h:94
Definition: MicroStep.h:46
Logger logger
The logger instance to use for messages.
Definition: Interpreter.h:55
The facade for data-models.
Definition: DataModel.h:40
DelayedEventQueue delayQueue
The queue for delayed events.
Definition: Interpreter.h:61
Definition: Logging.h:69
Definition: ContentExecutor.h:42