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 explicit 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 operator std::string() {
113 std::stringstream ss;
118 typedef std::multimap<std::string, Data> params_t;
119 typedef std::map<std::string, Data> namelist_t;
121 static bool getParam(
const params_t& params,
const std::string& name,
Data& target) {
122 if (params.find(name) != params.end()) {
123 target = params.find(name)->second;
129 static bool getParam(
const params_t& params,
const std::string& name, std::list<Data>& target) {
130 if (params.find(name) != params.end()) {
131 std::pair<params_t::const_iterator, params_t::const_iterator> rangeIter = params.equal_range(name);
132 while(rangeIter.first != rangeIter.second) {
133 target.push_back(rangeIter.first->second);
141 template <
typename T>
static bool getParam(
const params_t& params,
const std::string& name, T& target) {
142 if (params.find(name) != params.end()) {
143 target = strTo<T>(params.find(name)->second.atom);
149 static bool getParam(
const params_t& params,
const std::string& name,
bool& target) {
150 if (params.find(name) != params.end()) {
152 if (iequals(params.find(name)->second.atom,
"false")) {
154 }
else if(iequals(params.find(name)->second.atom,
"off")) {
156 }
else if(iequals(params.find(name)->second.atom,
"no")) {
158 }
else if(iequals(params.find(name)->second.atom,
"0")) {
166 template <
typename T>
static bool getParam(
const params_t& params,
const std::string& name, std::list<T>& target) {
167 if (params.find(name) != params.end()) {
168 std::pair<params_t::const_iterator, params_t::const_iterator> rangeIter = params.equal_range(name);
169 while(rangeIter.first != rangeIter.second) {
170 target.push_back(strTo<T>(rangeIter.first->second.atom));
182 std::string origintype;
185 std::string invokeid;
187 std::map<std::string, Data> namelist;
188 std::multimap<std::string, Data> params;
191 friend USCXML_API std::ostream& operator<< (std::ostream& os,
const Event& event);
194 USCXML_API std::ostream& operator<< (std::ostream& os,
const Event& event);
201 data.compound[
"msg"] =
Data(msg, Data::VERBATIM);
Definition: Breakpoint.cpp:26