summaryrefslogtreecommitdiffstats
path: root/src/uscxml/messages
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-01 22:51:30 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-01 22:51:30 (GMT)
commit945160d0539ad119ffc986fac712db76c7203e84 (patch)
treec43e4a7db898026bc62cc20af5061d07736f847e /src/uscxml/messages
parentc70d02010ea99e6c8e35da3b767f41f1ee5dce56 (diff)
downloaduscxml-945160d0539ad119ffc986fac712db76c7203e84.zip
uscxml-945160d0539ad119ffc986fac712db76c7203e84.tar.gz
uscxml-945160d0539ad119ffc986fac712db76c7203e84.tar.bz2
More polishing for bindings C# and Java
Diffstat (limited to 'src/uscxml/messages')
-rw-r--r--src/uscxml/messages/Data.h8
-rw-r--r--src/uscxml/messages/Event.cpp2
-rw-r--r--src/uscxml/messages/Event.h57
-rw-r--r--src/uscxml/messages/InvokeRequest.cpp2
-rw-r--r--src/uscxml/messages/SendRequest.cpp4
5 files changed, 71 insertions, 2 deletions
diff --git a/src/uscxml/messages/Data.h b/src/uscxml/messages/Data.h
index bf13409..9b5bea7 100644
--- a/src/uscxml/messages/Data.h
+++ b/src/uscxml/messages/Data.h
@@ -141,6 +141,14 @@ public:
return data;
}
+ void put(std::string key, const Data& data) {
+ compound[key] = data;
+ }
+
+ void put(size_t index, const Data& data) {
+ this[index] = data;
+ }
+
bool operator==(const Data &other) const {
if (other.atom.size() != atom.size())
return false;
diff --git a/src/uscxml/messages/Event.cpp b/src/uscxml/messages/Event.cpp
index a3e6a20..f8a880f 100644
--- a/src/uscxml/messages/Event.cpp
+++ b/src/uscxml/messages/Event.cpp
@@ -155,6 +155,8 @@ std::ostream& operator<< (std::ostream& os, const Event& event) {
os << indent << " origin: " << event.origin << std::endl;
if (event.origintype.size() > 0)
os << indent << " origintype: " << event.origintype << std::endl;
+ if (event.content.size() > 0)
+ os << indent << " content: '" << event.content << "'" << std::endl;
if (event.params.size() > 0) {
std::multimap<std::string, Data>::const_iterator paramIter = event.params.begin();
os << indent << " params:" << std::endl;
diff --git a/src/uscxml/messages/Event.h b/src/uscxml/messages/Event.h
index 1acfce7..6697bb9 100644
--- a/src/uscxml/messages/Event.h
+++ b/src/uscxml/messages/Event.h
@@ -22,6 +22,56 @@
#include "uscxml/messages/Data.h"
+#define ERROR_EXECUTION(identifier, cause) \
+ uscxml::Event identifier; \
+ identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
+ identifier.name = "error.execution"; \
+ identifier.eventType = uscxml::Event::PLATFORM;
+
+#define ERROR_EXECUTION2(identifier, cause, node) \
+ uscxml::Event identifier; \
+ identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
+ identifier.name = "error.execution"; \
+ identifier.data.compound["xpath"] = uscxml::Data(DOMUtils::xPathForNode(node), uscxml::Data::VERBATIM); \
+ identifier.eventType = uscxml::Event::PLATFORM;
+
+#define ERROR_COMMUNICATION(identifier, cause) \
+ uscxml::Event identifier; \
+ identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
+ identifier.name = "error.communication"; \
+ identifier.eventType = uscxml::Event::PLATFORM;
+
+#define ERROR_COMMUNICATION2(identifier, cause, node) \
+ uscxml::Event identifier; \
+ identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
+ identifier.name = "error.communication"; \
+ identifier.data.compound["xpath"] = uscxml::Data(DOMUtils::xPathForNode(node), uscxml::Data::VERBATIM); \
+ identifier.eventType = uscxml::Event::PLATFORM;
+
+#define ERROR_EXECUTION_THROW(cause) \
+{\
+ ERROR_EXECUTION(exc, cause); \
+ throw exc;\
+}
+
+#define ERROR_EXECUTION_THROW2(cause, node) \
+{\
+ ERROR_EXECUTION2(exc, cause, node); \
+ throw exc;\
+}
+
+#define ERROR_COMMUNICATION_THROW(cause) \
+{\
+ ERROR_COMMUNICATION(exc, cause); \
+ throw exc;\
+}
+
+#define ERROR_COMMUNICATION_THROW2(cause, node) \
+{\
+ ERROR_COMMUNICATION(exc, cause, node); \
+ throw exc;\
+}
+
namespace uscxml {
class USCXML_API Event {
@@ -145,6 +195,13 @@ public:
return params;
}
+ void setNameList(const std::map<std::string, Data>& nameList) {
+ this->namelist = nameList;
+ }
+ void setParams(const std::multimap<std::string, Data>& params) {
+ this->params = params;
+ }
+
typedef std::multimap<std::string, Data> params_t;
typedef std::map<std::string, Data> namelist_t;
diff --git a/src/uscxml/messages/InvokeRequest.cpp b/src/uscxml/messages/InvokeRequest.cpp
index a39c8c6..26d40ce 100644
--- a/src/uscxml/messages/InvokeRequest.cpp
+++ b/src/uscxml/messages/InvokeRequest.cpp
@@ -60,6 +60,7 @@ std::ostream& operator<< (std::ostream& os, const InvokeRequest& invokeReq) {
if (invokeReq.src.size() > 0)
os<< indent << " src: " << invokeReq.src << std::endl;
+#if 0
if (invokeReq.namelist.size() > 0) {
os << indent << " namelist: " << std::endl;
InvokeRequest::namelist_t::const_iterator namelistIter = invokeReq.namelist.begin();
@@ -80,6 +81,7 @@ std::ostream& operator<< (std::ostream& os, const InvokeRequest& invokeReq) {
if (invokeReq.content.size() > 0)
os << indent << " content: " << invokeReq.content << std::endl;
+#endif
_dataIndentation++;
os << (Event)invokeReq;
diff --git a/src/uscxml/messages/SendRequest.cpp b/src/uscxml/messages/SendRequest.cpp
index a8fbe13..497182c 100644
--- a/src/uscxml/messages/SendRequest.cpp
+++ b/src/uscxml/messages/SendRequest.cpp
@@ -103,7 +103,7 @@ std::ostream& operator<< (std::ostream& os, const SendRequest& sendReq) {
if (sendReq.delayMs > 0)
os<< indent << " delay: " << sendReq.delayMs << std::endl;
-
+#if 0
if (sendReq.namelist.size() > 0) {
os << indent << " namelist: " << std::endl;
SendRequest::namelist_t::const_iterator namelistIter = sendReq.namelist.begin();
@@ -124,7 +124,7 @@ std::ostream& operator<< (std::ostream& os, const SendRequest& sendReq) {
if (sendReq.content.size() > 0)
os << indent << " content: " << sendReq.content << std::endl;
-
+#endif
_dataIndentation++;
os << (Event)sendReq;
_dataIndentation--;