20 #ifndef EVENT_H_6174D929
21 #define EVENT_H_6174D929
26 #define ERROR_PLATFORM_THROW(msg) \
28 e.name = "error.platform"; \
29 e.data.compound["cause"] = Data(msg, Data::VERBATIM); \
32 #define ERROR_EXECUTION(identifier, cause) \
33 uscxml::ErrorEvent identifier; \
34 identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
35 identifier.name = "error.execution"; \
36 identifier.eventType = uscxml::Event::PLATFORM;
38 #define ERROR_EXECUTION2(identifier, cause, node) \
39 uscxml::ErrorEvent identifier; \
40 identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
41 identifier.name = "error.execution"; \
42 identifier.data.compound["xpath"] = uscxml::Data(DOMUtils::xPathForNode(node), uscxml::Data::VERBATIM); \
43 identifier.eventType = uscxml::Event::PLATFORM;
45 #define ERROR_COMMUNICATION(identifier, cause) \
46 uscxml::ErrorEvent identifier; \
47 identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
48 identifier.name = "error.communication"; \
49 identifier.eventType = uscxml::Event::PLATFORM;
51 #define ERROR_COMMUNICATION2(identifier, cause, node) \
52 uscxml::ErrorEvent identifier; \
53 identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
54 identifier.name = "error.communication"; \
55 identifier.data.compound["xpath"] = uscxml::Data(DOMUtils::xPathForNode(node), uscxml::Data::VERBATIM); \
56 identifier.eventType = uscxml::Event::PLATFORM;
58 #define ERROR_EXECUTION_THROW(cause) \
60 ERROR_EXECUTION(exc, cause); \
64 #define ERROR_EXECUTION_THROW2(cause, node) \
66 ERROR_EXECUTION2(exc, cause, node); \
70 #define ERROR_COMMUNICATION_THROW(cause) \
72 ERROR_COMMUNICATION(exc, cause); \
76 #define ERROR_COMMUNICATION_THROW2(cause, node) \
78 ERROR_COMMUNICATION(exc, cause, node); \
92 Event() : eventType(INTERNAL), hideSendId(
false), uuid(UUID::getUUID()) {}
93 Event(
const std::string& name, Type type = INTERNAL) : name(name), eventType(type), hideSendId(
false) {}
94 bool operator< (
const Event& other)
const {
98 bool operator==(
const Event& other)
const {
99 return (this->name == other.name &&
100 this->sendid == other.sendid &&
101 this->invokeid == other.invokeid &&
102 this->data == other.data);
104 bool operator!=(
const Event& other)
const {
105 return !(*
this == other);
109 return name.size() > 0;
112 typedef std::multimap<std::string, Data> params_t;
113 typedef std::map<std::string, Data> namelist_t;
115 static bool getParam(
const params_t& params,
const std::string& name,
Data& target) {
116 if (params.find(name) != params.end()) {
117 target = params.find(name)->second;
123 static bool getParam(
const params_t& params,
const std::string& name, std::list<Data>& target) {
124 if (params.find(name) != params.end()) {
125 std::pair<params_t::const_iterator, params_t::const_iterator> rangeIter = params.equal_range(name);
126 while(rangeIter.first != rangeIter.second) {
127 target.push_back(rangeIter.first->second);
135 template <
typename T>
static bool getParam(
const params_t& params,
const std::string& name, T& target) {
136 if (params.find(name) != params.end()) {
137 target = strTo<T>(params.find(name)->second.atom);
143 static bool getParam(
const params_t& params,
const std::string& name,
bool& target) {
144 if (params.find(name) != params.end()) {
146 if (iequals(params.find(name)->second.atom,
"false")) {
148 }
else if(iequals(params.find(name)->second.atom,
"off")) {
150 }
else if(iequals(params.find(name)->second.atom,
"no")) {
152 }
else if(iequals(params.find(name)->second.atom,
"0")) {
160 template <
typename T>
static bool getParam(
const params_t& params,
const std::string& name, std::list<T>& target) {
161 if (params.find(name) != params.end()) {
162 std::pair<params_t::const_iterator, params_t::const_iterator> rangeIter = params.equal_range(name);
163 while(rangeIter.first != rangeIter.second) {
164 target.push_back(strTo<T>(rangeIter.first->second.atom));
176 std::string origintype;
179 std::string invokeid;
181 std::map<std::string, Data> namelist;
182 std::multimap<std::string, Data> params;
185 friend USCXML_API std::ostream& operator<< (std::ostream& os,
const Event& event);
188 USCXML_API std::ostream& operator<< (std::ostream& os,
const Event& event);
195 data.compound[
"msg"] = msg;
Definition: InterpreterIssue.cpp:33