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 
34 
35 namespace uscxml {
36 
37 class InterpreterMonitor;
38 class InterpreterImpl;
39 class InterpreterIssue;
40 
45 class USCXML_API InterpreterOptions {
46 public:
48  verbose(false),
49  validate(false),
50  withHTTP(true),
51  withHTTPS(true),
52  withWS(true),
53  logLevel(0),
54  httpPort(5080),
55  httpsPort(5443),
56  wsPort(5081) {
57  }
58 
59  bool verbose;
60  bool validate;
61  bool withHTTP;
62  bool withHTTPS;
63  bool withWS;
64  int logLevel;
65  unsigned short httpPort;
66  unsigned short httpsPort;
67  unsigned short wsPort;
68  std::string pluginPath;
69  std::string certificate;
70  std::string privateKey;
71  std::string publicKey;
72  std::vector<std::pair<std::string, InterpreterOptions*> > interpreters;
73  std::map<std::string, std::string> additionalParameters;
74 
75  std::string error;
76 
77  operator bool() {
78  return error.length() == 0;
79  }
80 
81  static void printUsageAndExit(const char* progName);
82  static InterpreterOptions fromCmdLine(int argc, char** argv);
83 
84 };
85 
90 class USCXML_API ActionLanguage {
91 public:
95 };
96 
112 class USCXML_API Interpreter {
113 public:
114 
121  static Interpreter fromDocument(XERCESC_NS::DOMDocument* dom,
122  const std::string& baseURL,
123  bool copy = true);
130  static Interpreter fromElement(XERCESC_NS::DOMElement* element,
131  const std::string& baseURL);
137  static Interpreter fromXML(const std::string& xml,
138  const std::string& baseURL);
143  static Interpreter fromURL(const std::string& url);
144 
149  static Interpreter fromClone(const Interpreter& other);
150 
155 
163  InterpreterState step(bool blocking = false);
164 
168  void cancel();
169 
173  void reset();
174 
179  std::list<XERCESC_NS::DOMElement*> getConfiguration();
180 
186  bool isInState(const std::string& stateId);
187 
192  InterpreterState getState();
193 
198  std::list<InterpreterIssue> validate();
199 
204  void receive(const Event& event);
205 
209  void setActionLanguage(ActionLanguage actionLanguage);
210 
214  void setMonitor(InterpreterMonitor* monitor);
215 
219  std::shared_ptr<InterpreterImpl> getImpl() const {
220  return _impl;
221  }
222 
223 protected:
224  std::shared_ptr<InterpreterImpl> _impl;
225 
226 };
227 
228 }
229 
230 #endif /* end of include guard: INTERPRETER_H_6CD5A168 */
Definition: InterpreterIssue.cpp:33
Definition: InterpreterMonitor.h:46
#define PIMPL_OPERATORS(type)
The usual operators as required for the PIMPL pattern.
Definition: Common.h:60
Central class to interpret and process SCXML documents.
Definition: Interpreter.h:112
MicroStep microStepper
The microstepper instance to use.
Definition: Interpreter.h:92
Collection of instances for interpreter that constitute its action language.
Definition: Interpreter.h:90
DataModel dataModel
The datamodel to uses.
Definition: Interpreter.h:93
std::shared_ptr< InterpreterImpl > getImpl() const
Return the actual implementation of the Interperter.
Definition: Interpreter.h:219
Options to pass into an interpreter.
Definition: Interpreter.h:45
ContentExecutor execContent
To process executable content elements.
Definition: Interpreter.h:94
Definition: Event.h:84
Definition: MicroStep.h:47
The facade for data-models.
Definition: DataModel.h:40
Definition: ContentExecutor.h:43