diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-05-12 13:12:33 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-05-12 13:12:33 (GMT) |
commit | b62e7979600feee23dc7cdb61042a8fc7673122b (patch) | |
tree | f7351372f37979dd2d048e0b68a16a4cd3b2aadb /src/uscxml/messages | |
parent | 1b11b310be61e51b3ac5ebb83f7c8a33aef3d6e8 (diff) | |
download | uscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.zip uscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.tar.gz uscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.tar.bz2 |
Major Refactoring v2.0
Diffstat (limited to 'src/uscxml/messages')
-rw-r--r-- | src/uscxml/messages/Blob.h | 33 | ||||
-rw-r--r-- | src/uscxml/messages/Data.cpp | 115 | ||||
-rw-r--r-- | src/uscxml/messages/Data.h | 88 | ||||
-rw-r--r-- | src/uscxml/messages/Event.cpp | 107 | ||||
-rw-r--r-- | src/uscxml/messages/Event.h | 145 | ||||
-rw-r--r-- | src/uscxml/messages/InvokeRequest.cpp | 93 | ||||
-rw-r--r-- | src/uscxml/messages/InvokeRequest.h | 73 | ||||
-rw-r--r-- | src/uscxml/messages/MMIMessages.cpp | 549 | ||||
-rw-r--r-- | src/uscxml/messages/MMIMessages.h | 414 | ||||
-rw-r--r-- | src/uscxml/messages/SendRequest.cpp | 135 | ||||
-rw-r--r-- | src/uscxml/messages/SendRequest.h | 73 |
11 files changed, 81 insertions, 1744 deletions
diff --git a/src/uscxml/messages/Blob.h b/src/uscxml/messages/Blob.h index 835c73a..9bbf0f7 100644 --- a/src/uscxml/messages/Blob.h +++ b/src/uscxml/messages/Blob.h @@ -21,7 +21,7 @@ #define BLOB_H_E1B6D2C3 #include <string> -#include <boost/shared_ptr.hpp> +#include <memory> #include "uscxml/Common.h" @@ -65,36 +65,17 @@ protected: class USCXML_API Blob { public: - Blob() : _impl() {} - Blob(const boost::shared_ptr<BlobImpl> impl) : _impl(impl) { } - Blob(const Blob& other) : _impl(other._impl) { } - Blob(size_t size) : _impl(boost::shared_ptr<BlobImpl>(new BlobImpl(size))) {} + PIMPL_OPERATORS(Blob) + + Blob(size_t size) : _impl(std::shared_ptr<BlobImpl>(new BlobImpl(size))) {} Blob(const char* data, size_t size, const std::string& mimeType = "application/octet-stream", bool adopt = false) : - _impl(boost::shared_ptr<BlobImpl>(new BlobImpl(data, size, mimeType, adopt))) {} - virtual ~Blob() {}; - - operator bool() const { - return !!_impl; - } - bool operator< (const Blob& other) const { - return _impl < other._impl; - } - bool operator==(const Blob& other) const { - return _impl == other._impl; - } - bool operator!=(const Blob& other) const { - return _impl != other._impl; - } - Blob& operator= (const Blob& other) { - _impl = other._impl; - return *this; - } + _impl(std::shared_ptr<BlobImpl>(new BlobImpl(data, size, mimeType, adopt))) {} static Blob fromBase64(const std::string base64, const std::string& mimeType = "application/octet-stream") { - return Blob(boost::shared_ptr<BlobImpl>(BlobImpl::fromBase64(base64, mimeType))); + return Blob(std::shared_ptr<BlobImpl>(BlobImpl::fromBase64(base64, mimeType))); } std::string base64() const { @@ -124,7 +105,7 @@ public: #ifdef SWIGIMPORTED protected: #endif - boost::shared_ptr<BlobImpl> _impl; + std::shared_ptr<BlobImpl> _impl; }; diff --git a/src/uscxml/messages/Data.cpp b/src/uscxml/messages/Data.cpp index b555ed8..089de96 100644 --- a/src/uscxml/messages/Data.cpp +++ b/src/uscxml/messages/Data.cpp @@ -22,25 +22,21 @@ #include <boost/algorithm/string.hpp> -#include "uscxml/dom/DOMUtils.h" -#include "uscxml/dom/NameSpacingParser.h" -#include <DOM/SAX2DOM/SAX2DOM.hpp> -#include <SAX/helpers/DefaultHandler.hpp> -#include <SAX/helpers/CatchErrorHandler.hpp> +#include "uscxml/util/DOM.h" -#include "glog/logging.h" +#include "easylogging++.h" #ifdef HAS_STRING_H #include <string.h> #endif extern "C" { -#include "jsmn.h" // minimal json parser +#include "jsmn/jsmn.h" // minimal json parser } namespace uscxml { -Data::Data(const char* data, size_t size, const std::string& mimeType, bool adopt) : binary(data, size, mimeType, adopt) {} +Data::Data(const char* data, size_t size, const std::string& mimeType, bool adopt) : node(NULL), binary(data, size, mimeType, adopt) {} void Data::merge(const Data& other) { if (other.compound.size() > 0) { @@ -76,103 +72,6 @@ void Data::merge(const Data& other) { } } -Data::Data(const Arabica::DOM::Node<std::string>& dom) { - // we may need to convert some keys to arrays if we have the same name as an element - std::map<std::string, std::list<Data> > arrays; -// Interpreter::dump(dom); - - if (dom.hasAttributes()) { - Arabica::DOM::NamedNodeMap<std::string> attributes = dom.getAttributes(); - for (size_t i = 0; i < attributes.getLength(); i++) { - Arabica::DOM::Node<std::string> attribute = attributes.item(i); -// Interpreter::dump(attribute); - - assert(attribute.getNodeType() == Arabica::DOM::Node_base::ATTRIBUTE_NODE); - std::string key = attribute.getLocalName(); - std::string value = attribute.getNodeValue(); - compound[key] = Data(value, VERBATIM); - } - } - - if (dom.hasChildNodes()) { - Arabica::DOM::NodeList<std::string> children = dom.getChildNodes(); - for (size_t i = 0; i < children.getLength(); i++) { - Arabica::DOM::Node<std::string> child = children.item(i); -// Interpreter::dump(child); - std::string key; - switch (child.getNodeType()) { - case Arabica::DOM::Node_base::ELEMENT_NODE: - key = TAGNAME_CAST(child); - break; - case Arabica::DOM::Node_base::ATTRIBUTE_NODE: - key = ((Arabica::DOM::Attr<std::string>)child).getName(); - break; - case Arabica::DOM::Node_base::TEXT_NODE: - default: - break; - } - if (key.length() == 0) - continue; - - if (compound.find(key) != compound.end()) { - // we already have such a key .. make it an array after we processed all children - arrays[key].push_back(Data(child)); - } else { - compound[key] = Data(child); - } - } - } else { - atom = dom.getNodeValue(); - type = VERBATIM; - } - - std::map<std::string, std::list<Data> >::iterator arrayIter = arrays.begin(); - while(arrayIter != arrays.end()) { - assert(compound.find(arrayIter->first) != compound.end()); - Data arrayData; - arrays[arrayIter->first].push_front(compound[arrayIter->first]); - arrayData.array = arrays[arrayIter->first]; - compound[arrayIter->first] = arrayData; - } -} - -Arabica::DOM::Document<std::string> Data::toDocument() { - Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation(); - Arabica::DOM::Document<std::string> document = domFactory.createDocument("http://www.w3.org/2005/07/scxml", "message", 0); - Arabica::DOM::Element<std::string> scxmlMsg = document.getDocumentElement(); - scxmlMsg.setPrefix("scxml"); - scxmlMsg.setAttribute("version", "1.0"); - - if (compound.size() > 0 || array.size() > 0) { - Arabica::DOM::Element<std::string> payloadElem = document.createElementNS("http://www.w3.org/2005/07/scxml", "payload"); - payloadElem.setPrefix("scxml"); - - scxmlMsg.appendChild(payloadElem); - - // we do not support nested attibutes - if (compound.size() > 0) { - std::map<std::string, Data>::iterator compoundIter = compound.begin(); - while(compoundIter != compound.end()) { - if (compoundIter->second.atom.size() > 0) { - Arabica::DOM::Element<std::string> propertyElem = document.createElementNS("http://www.w3.org/2005/07/scxml", "property"); - propertyElem.setPrefix("scxml"); - - propertyElem.setAttribute("name", compoundIter->first); - Arabica::DOM::Text<std::string> textElem = document.createTextNode(compoundIter->second.atom); - propertyElem.appendChild(textElem); - payloadElem.appendChild(propertyElem); - } - compoundIter++; - } - } - } - return document; -} - -Data Data::fromXML(const std::string& xmlString) { - return Data(); -} - Data Data::fromJSON(const std::string& jsonString) { Data data; @@ -300,10 +199,14 @@ Data Data::fromJSON(const std::string& jsonString) { } std::ostream& operator<< (std::ostream& os, const Data& data) { - os << Data::toJSON(data); + os << data.asJSON(); return os; } +std::string Data::asJSON() const { + return Data::toJSON(*this); +} + std::string Data::toJSON(const Data& data) { std::stringstream os; std::string indent; diff --git a/src/uscxml/messages/Data.h b/src/uscxml/messages/Data.h index c2e7dcf..55b9f64 100644 --- a/src/uscxml/messages/Data.h +++ b/src/uscxml/messages/Data.h @@ -22,13 +22,13 @@ #include <list> #include <map> - -#include <boost/shared_ptr.hpp> +#include <memory> #include "uscxml/Common.h" -#include "uscxml/Convenience.h" +#include "uscxml/util/Convenience.h" #include "uscxml/messages/Blob.h" -#include <DOM/Document.hpp> + +#include <xercesc/dom/DOMDocument.hpp> namespace uscxml { @@ -41,22 +41,12 @@ public: INTERPRETED, }; - Data() : type(INTERPRETED) {} + Data() : node(NULL), type(INTERPRETED) {} - // TODO: default INTERPRETED is unfortunate - Data(const std::string& atom, Type type) : atom(atom), type(type) {} Data(const char* data, size_t size, const std::string& mimeType, bool adopt = false); // convenience constructors - Data(short atom) : atom(toStr(atom)), type(INTERPRETED) {} - Data(int atom) : atom(toStr(atom)), type(INTERPRETED) {} - Data(unsigned int atom) : atom(toStr(atom)), type(INTERPRETED) {} - Data(long atom) : atom(toStr(atom)), type(INTERPRETED) {} - Data(unsigned long atom) : atom(toStr(atom)), type(INTERPRETED) {} - Data(long long int atom) : atom(toStr(atom)), type(INTERPRETED) {} - Data(float atom) : atom(toStr(atom)), type(INTERPRETED) {} - Data(double atom) : atom(toStr(atom)), type(INTERPRETED) {} - Data(bool atom) : type(INTERPRETED) { + Data(bool atom) : node(NULL), type(VERBATIM) { if (atom) { this->atom = "true"; } else { @@ -64,18 +54,18 @@ public: } } - template <typename T> Data(T value, Type type) : atom(toStr(value)), type(type) {} + Data(xercesc::DOMNode* node) : node(node), type(VERBATIM) {} + + // template <typename T> Data(T value, Type type = INTERPRETED) : atom(toStr(value)), type(type) {} -#if 0 - // constructor for arbitrary types, skip if type is subclass though (C++11) // we will have to drop this constructor as it interferes with operator Data() and requires C++11 template <typename T> Data(T value, typename std::enable_if<! std::is_base_of<Data, T>::value>::type* = nullptr) - : atom(toStr(value)), type(INTERPRETED) {} -#endif - + : node(NULL), atom(toStr(value)), type(VERBATIM) {} + template <typename T> + Data(T value, Type type, typename std::enable_if<! std::is_base_of<Data, T>::value>::type* = nullptr) + : node(NULL), atom(toStr(value)), type(type) {} - explicit Data(const Arabica::DOM::Node<std::string>& dom); ~Data() {} bool empty() const { @@ -84,9 +74,20 @@ public: } bool operator<(const Data& other) const { - std::string thisJSON = Data::toJSON(*this); - std::string otherJSON = Data::toJSON(other); - return (thisJSON < otherJSON); + if (other.atom != atom) + return other.atom < atom; + if (other.array != array) + return other.array < array; + if (other.compound != compound) + return other.compound < compound; + if (other.node != node) + return other.node < node; + if (other.binary != binary) + return other.binary < binary; + if (other.type != type) + return other.type < type; + + return false; } void merge(const Data& other); @@ -150,27 +151,7 @@ public: } bool operator==(const Data &other) const { - if (other.atom.size() != atom.size()) - return false; - if (other.type != type) - return false; - if (other.binary != binary) - return false; - if (other.array.size() != array.size()) - return false; - if (other.compound.size() != compound.size()) - return false; - - if (other.atom != atom) - return false; - if (other.array != array) - return false; - if (other.compound != compound) - return false; - if (other.node != node) - return false; - - return true; + return (*this < other || other < *this); } bool operator!=(const Data &other) const { @@ -191,13 +172,8 @@ public: static Data fromJSON(const std::string& jsonString); static std::string toJSON(const Data& data); - static Data fromXML(const std::string& xmlString); - Arabica::DOM::Document<std::string> toDocument(); - std::string toXMLString() { - std::stringstream ss; - ss << toDocument(); - return ss.str(); - } + std::string asJSON() const; + std::map<std::string, Data> getCompound() { return compound; @@ -238,7 +214,8 @@ public: protected: #endif - Arabica::DOM::Node<std::string> node; + xercesc::DOMNode* node; + std::shared_ptr<xercesc::DOMDocument*> adoptedDoc; std::map<std::string, Data> compound; std::list<Data> array; std::string atom; @@ -246,7 +223,6 @@ protected: Type type; protected: - Arabica::DOM::Document<std::string> toNode(const Arabica::DOM::Document<std::string>& factory, const Data& data); friend USCXML_API std::ostream& operator<< (std::ostream& os, const Data& data); }; diff --git a/src/uscxml/messages/Event.cpp b/src/uscxml/messages/Event.cpp index f247542..c4aa642 100644 --- a/src/uscxml/messages/Event.cpp +++ b/src/uscxml/messages/Event.cpp @@ -18,116 +18,17 @@ */ #include "uscxml/messages/Event.h" -#include "uscxml/dom/DOMUtils.h" -#include <DOM/SAX2DOM/SAX2DOM.hpp> -#include <SAX/helpers/DefaultHandler.hpp> -#include <SAX/helpers/CatchErrorHandler.hpp> +#include "uscxml/util/DOM.h" namespace uscxml { -//Arabica::DOM::Node<std::string> Event::getFirstDOMElement() const { -// return getFirstDOMElement(dom); -//} -// -//Arabica::DOM::Document<std::string> Event::getStrippedDOM() const { -// return getStrippedDOM(dom); -//} - -//Arabica::DOM::Node<std::string> Event::getFirstDOMElement(const Arabica::DOM::Document<std::string> dom) { -// Arabica::DOM::Node<std::string> data = dom.getDocumentElement().getFirstChild(); -// while (data) { -// if (data.getNodeType() == Arabica::DOM::Node_base::TEXT_NODE) { -// std::string trimmed = boost::trim_copy(data.getNodeValue()); -// if (trimmed.length() == 0) { -// data = data.getNextSibling(); -// continue; -// } -// } -// break; -// } -// return data; -//} -// -//Arabica::DOM::Document<std::string> Event::getStrippedDOM(const Arabica::DOM::Document<std::string> dom) { -// Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation(); -// Arabica::DOM::Document<std::string> document = domFactory.createDocument("", "", 0); -// if (dom) { -// document.getDocumentElement().appendChild(document.importNode(getFirstDOMElement(dom), true)); -// } -// return document; -//} - -std::string Event::toXMLString() { - std::stringstream ss; - ss << toDocument(); - return ss.str(); -} - -Arabica::DOM::Document<std::string> Event::toDocument() { - Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation(); - Arabica::DOM::Document<std::string> document = data.toDocument(); - Arabica::DOM::Element<std::string> scxmlMsg = document.getDocumentElement(); - - - scxmlMsg.setAttribute("source", origin); - scxmlMsg.setAttribute("name", name); - - return document; -} - - -Event Event::fromXML(const std::string& xmlString) { - Arabica::SAX2DOM::Parser<std::string> eventParser; - Arabica::SAX::CatchErrorHandler<std::string> errorHandler; - eventParser.setErrorHandler(errorHandler); - - std::istringstream is(xmlString); - Arabica::SAX::InputSource<std::string> inputSource; - inputSource.setByteStream(is); - - Event event; - if(eventParser.parse(inputSource) && eventParser.getDocument().hasChildNodes()) { - Arabica::DOM::Element<std::string> scxmlMsg = eventParser.getDocument().getDocumentElement(); - if (HAS_ATTR(scxmlMsg, "name")) - event.name = ATTR(scxmlMsg, "name"); - if (HAS_ATTR(scxmlMsg, "sendid")) - event.sendid = ATTR(scxmlMsg, "sendid"); - - Arabica::DOM::NodeList<std::string> payloads = scxmlMsg.getElementsByTagName("scxml:payload"); - if (payloads.getLength() > 0) { - Arabica::DOM::Node<std::string> payload = payloads.item(0); - if (payload.getNodeType() == Arabica::DOM::Node_base::ELEMENT_NODE) { - Arabica::DOM::Element<std::string> payloadElem = (Arabica::DOM::Element<std::string>)payload; - Arabica::DOM::NodeList<std::string> properties = payloadElem.getElementsByTagName("scxml:property"); - if (properties.getLength() > 0) { - for (size_t i = 0; i < properties.getLength(); i++) { - if (HAS_ATTR_CAST(properties.item(i), "name")) { - std::string key = ATTR_CAST(properties.item(i), "name"); - std::string value; - Arabica::DOM::NodeList<std::string> childs = properties.item(i).getChildNodes(); - for (size_t j = 0; j < childs.getLength(); j++) { - if (childs.item(j).getNodeType() == Arabica::DOM::Node_base::TEXT_NODE) { - value = childs.item(j).getNodeValue(); - break; - } - } - event.data.compound[key] = Data(value, Data::VERBATIM); - } - } - } - } - } - } - return event; -} - std::ostream& operator<< (std::ostream& os, const Event& event) { std::string indent; for (size_t i = 0; i < _dataIndentation; i++) { indent += " "; } - os << indent << (event.eventType == Event::EXTERNAL ? "External" : "Internal") << " Event " << (event.dom ? "with DOM attached" : "") << std::endl; +// os << indent << (event.eventType == Event::EXTERNAL ? "External" : "Internal") << " Event " << (event.dom ? "with DOM attached" : "") << std::endl; if (event.name.size() > 0) os << indent << " name: " << event.name << std::endl; @@ -135,8 +36,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.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 94bc386..8b7bb91 100644 --- a/src/uscxml/messages/Event.h +++ b/src/uscxml/messages/Event.h @@ -21,28 +21,35 @@ #define EVENT_H_6174D929 #include "uscxml/messages/Data.h" +#include "uscxml/util/UUID.h" + +#define ERROR_PLATFORM_THROW(msg) \ + ErrorEvent e; \ + e.name = "error.platform"; \ + e.data.compound["cause"] = Data(msg, Data::VERBATIM); \ + throw e; \ #define ERROR_EXECUTION(identifier, cause) \ - uscxml::Event identifier; \ + uscxml::ErrorEvent 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; \ + uscxml::ErrorEvent 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; \ + uscxml::ErrorEvent 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; \ + uscxml::ErrorEvent 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); \ @@ -82,9 +89,8 @@ public: PLATFORM = 3 }; - Event() : eventType(INTERNAL), hideSendId(false) {} + Event() : eventType(INTERNAL), hideSendId(false), uuid(UUID::getUUID()) {} Event(const std::string& name, Type type = INTERNAL) : name(name), eventType(type), hideSendId(false) {} - Event(const Arabica::DOM::Node<std::string>& xmlString) : eventType(INTERNAL), hideSendId(false) {}; bool operator< (const Event& other) const { return this < &other; } @@ -99,105 +105,8 @@ public: return !(*this == other); } - std::string getName() const { - return name; - } - void setName(const std::string& name) { - this->name = name; - } - - Type getEventType() const { - return eventType; - } - void setEventType(const Type type) { - this->eventType = type; - } - - std::string getOrigin() const { - return origin; - } - void setOrigin(const std::string& origin) { - this->origin = origin; - } - - std::string getOriginType() const { - return origintype; - } - void setOriginType(const std::string& originType) { - this->origintype = originType; - } - - Arabica::DOM::Node<std::string> getDOM() const { - return dom; - } - void setDOM(const Arabica::DOM::Node<std::string>& dom) { - this->dom = dom; - } - -// Arabica::DOM::Node<std::string> getFirstDOMElement() const; -// Arabica::DOM::Document<std::string> getStrippedDOM() const; -// -// static Arabica::DOM::Node<std::string> getFirstDOMElement(const Arabica::DOM::Document<std::string> dom); -// static Arabica::DOM::Document<std::string> getStrippedDOM(const Arabica::DOM::Document<std::string> dom); - - std::string getRaw() const { - return raw; - } - void setRaw(const std::string& raw) { - this->raw = raw; - } - - std::string getContent() const { - return content; - } - void setContent(const std::string& content) { - this->content = content; - } - - std::string getXML() const { - return xml; - } - void setXML(const std::string& xml) { - this->xml = xml; - } - - std::string getSendId() const { - return sendid; - } - void setSendId(const std::string& sendId) { - this->sendid = sendId; - } - - std::string getInvokeId() const { - return invokeid; - } - void setInvokeId(const std::string& invokeId) { - this->invokeid = invokeId; - } - - Data getData() const { - return data; - } - void setData(const Data& data) { - this->data = data; - } - - static Event fromXML(const std::string& xmlString); - Arabica::DOM::Document<std::string> toDocument(); - std::string toXMLString(); - - std::map<std::string, Data>& getNameList() { - return namelist; - } - std::multimap<std::string, Data>& getParams() { - 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; + operator bool() { + return name.size() > 0; } typedef std::multimap<std::string, Data> params_t; @@ -225,7 +134,7 @@ public: template <typename T> static bool getParam(const params_t& params, const std::string& name, T& target) { if (params.find(name) != params.end()) { - target = boost::lexical_cast<T>(params.find(name)->second.atom); + target = strTo<T>(params.find(name)->second.atom); return true; } return false; @@ -252,7 +161,7 @@ public: if (params.find(name) != params.end()) { std::pair<params_t::const_iterator, params_t::const_iterator> rangeIter = params.equal_range(name); while(rangeIter.first != rangeIter.second) { - target.push_back(boost::lexical_cast<T>(rangeIter.first->second.atom)); + target.push_back(strTo<T>(rangeIter.first->second.atom)); rangeIter.first++; } return true; @@ -260,31 +169,35 @@ public: return false; } - -#ifdef SWIGIMPORTED -protected: -#endif - std::string raw; - std::string xml; std::string name; Type eventType; std::string origin; std::string origintype; - Arabica::DOM::Node<std::string> dom; std::string sendid; - bool hideSendId; + bool hideSendId; // sendid is assumed to be undef with some ecma tests std::string invokeid; Data data; - std::string content; std::map<std::string, Data> namelist; std::multimap<std::string, Data> params; + std::string uuid; // the sendid is not necessarily unique! friend USCXML_API std::ostream& operator<< (std::ostream& os, const Event& event); }; USCXML_API std::ostream& operator<< (std::ostream& os, const Event& event); + +class USCXML_API ErrorEvent : public Event { +public: + ErrorEvent() : Event() {} + ErrorEvent(const std::string& msg) : Event("error.platform") { + data.compound["msg"] = msg; + } +}; + } + + #endif /* end of include guard: EVENT_H_6174D929 */ diff --git a/src/uscxml/messages/InvokeRequest.cpp b/src/uscxml/messages/InvokeRequest.cpp deleted file mode 100644 index e56a6ff..0000000 --- a/src/uscxml/messages/InvokeRequest.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @file - * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) - * @copyright Simplified BSD - * - * @cond - * This program is free software: you can redistribute it and/or modify - * it under the terms of the FreeBSD license as published by the FreeBSD - * project. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the FreeBSD license along with this - * program. If not, see <http://www.opensource.org/licenses/bsd-license>. - * @endcond - */ - -#include "uscxml/messages/InvokeRequest.h" -#include <DOM/Simple/DOMImplementation.hpp> -#include <DOM/Document.hpp> -#include <DOM/io/Stream.hpp> - -namespace uscxml { - -std::string InvokeRequest::toXMLString() { - std::stringstream ss; - ss << toDocument(); - return ss.str(); -} - -Arabica::DOM::Document<std::string> InvokeRequest::toDocument() { - Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation(); - Arabica::DOM::Document<std::string> document = Event::toDocument(); - Arabica::DOM::Element<std::string> scxmlMsg = document.getDocumentElement(); - - scxmlMsg.setAttribute("invokeid", invokeid); - - return document; -} - -InvokeRequest InvokeRequest::fromXML(const std::string& xmlString) { - Event::fromXML(xmlString); - return InvokeRequest(); -} - -std::ostream& operator<< (std::ostream& os, const InvokeRequest& invokeReq) { - - std::string indent; - for (size_t i = 0; i < _dataIndentation; i++) { - indent += " "; - } - - os << indent << "InvokeReq" << (invokeReq.autoForward ? " with autoforward" : "") << std::endl; - - if (invokeReq.type.size() > 0) - os << indent << " type: " << invokeReq.type << std::endl; - - 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(); - while(namelistIter != invokeReq.namelist.end()) { - os << indent << " " << namelistIter->first << ": " << namelistIter->second << std::endl; - namelistIter++; - } - } - - if (invokeReq.params.size() > 0) { - os << indent << " params: " << std::endl; - InvokeRequest::params_t::const_iterator paramIter = invokeReq.params.begin(); - while(paramIter != invokeReq.params.end()) { - os << indent << " " << paramIter->first << ": " << paramIter->second << std::endl; - paramIter++; - } - } - - if (invokeReq.content.size() > 0) - os << indent << " content: " << invokeReq.content << std::endl; -#endif - - _dataIndentation++; - os << (Event)invokeReq; - _dataIndentation--; - return os; - -} - -}
\ No newline at end of file diff --git a/src/uscxml/messages/InvokeRequest.h b/src/uscxml/messages/InvokeRequest.h deleted file mode 100644 index 6f597fe..0000000 --- a/src/uscxml/messages/InvokeRequest.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @file - * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) - * @copyright Simplified BSD - * - * @cond - * This program is free software: you can redistribute it and/or modify - * it under the terms of the FreeBSD license as published by the FreeBSD - * project. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the FreeBSD license along with this - * program. If not, see <http://www.opensource.org/licenses/bsd-license>. - * @endcond - */ - -#ifndef INVOKEREQUEST_H_BAF058E2 -#define INVOKEREQUEST_H_BAF058E2 - -#include "uscxml/messages/Event.h" - -namespace uscxml { - -class USCXML_API InvokeRequest : public Event { -public: - InvokeRequest(Event event) : Event(event) {} - InvokeRequest() {} - - std::string getType() { - return type; - } - void setType(const std::string& type) { - this->type = type; - } - - std::string getSource() { - return src; - } - void setSource(const std::string& src) { - this->src = src; - } - - bool isAutoForwarded() { - return autoForward; - } - void setAutoForwarded(bool autoForward) { - this->autoForward = autoForward; - } - - static InvokeRequest fromXML(const std::string& xmlString); - Arabica::DOM::Document<std::string> toDocument(); - std::string toXMLString(); - -#ifdef SWIGIMPORTED -protected: -#endif - std::string type; - std::string src; - bool autoForward; - Arabica::DOM::Element<std::string> elem; - - friend USCXML_API std::ostream& operator<< (std::ostream& os, const InvokeRequest& sendReq); - -}; - -USCXML_API std::ostream& operator<< (std::ostream& os, const InvokeRequest& invokeReq); - -} - -#endif /* end of include guard: INVOKEREQUEST_H_BAF058E2 */ diff --git a/src/uscxml/messages/MMIMessages.cpp b/src/uscxml/messages/MMIMessages.cpp deleted file mode 100644 index 814be5f..0000000 --- a/src/uscxml/messages/MMIMessages.cpp +++ /dev/null @@ -1,549 +0,0 @@ -/** - * @file - * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) - * @copyright Simplified BSD - * - * @cond - * This program is free software: you can redistribute it and/or modify - * it under the terms of the FreeBSD license as published by the FreeBSD - * project. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the FreeBSD license along with this - * program. If not, see <http://www.opensource.org/licenses/bsd-license>. - * @endcond - */ - -#include <string> // MSVC will croak with operator+ on strings if this is not first - -#include "MMIMessages.h" - -#include <DOM/Simple/DOMImplementation.hpp> -#include <DOM/io/Stream.hpp> -#include <DOM/SAX2DOM/SAX2DOM.hpp> -#include <SAX/helpers/InputSourceResolver.hpp> - -#include <uscxml/dom/DOMUtils.h> - -#include <boost/algorithm/string.hpp> - -#define TO_EVENT_OPERATOR(type, name, base)\ -type::operator Event() const { \ - Event ev = base::operator Event();\ - ev.setName(name);\ - if (representation == MMI_AS_XML) \ - ev.setDOM(toXML());\ - return ev;\ -} - -#define FIND_MSG_ELEM(elem, doc) \ -Element<std::string> elem; \ -if (encapsulateInMMI) { \ - elem = Element<std::string>(doc.getDocumentElement().getFirstChild()); \ -} else { \ - elem = Element<std::string>(doc.getDocumentElement()); \ -} - -#define FROM_XML(clazz, enumType, base) \ -clazz clazz::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) { \ - clazz event = base::fromXML(node, interpreter); \ - event.type = enumType; \ - return event; \ -} - -#define STRING_ATTR_OR_EXPR(element, name)\ -(element.hasAttributeNS(nameSpace, "name##Expr") && interpreter ? \ - interpreter->getDataModel().evalAsString(element.getAttributeNS(nameSpace, "name##Expr")) : \ - (element.hasAttributeNS(nameSpace, #name) ? element.getAttributeNS(nameSpace, #name) : "") \ -) - -#define FIND_EVENT_NODE(node)\ -if (node.getNodeType() == Node_base::DOCUMENT_NODE) \ - node = node.getFirstChild(); \ -while (node) {\ - if (node.getNodeType() == Node_base::ELEMENT_NODE) {\ - if (boost::iequals(node.getLocalName(), "MMI")) {\ - node = node.getFirstChild();\ - continue;\ - } else {\ - break;\ - }\ - }\ - node = node.getNextSibling();\ -}\ - - -namespace uscxml { - -using namespace Arabica::DOM; - -std::string MMIEvent::nameSpace = "http://www.w3.org/2008/04/mmi-arch"; - -MMIEvent::Type MMIEvent::getType(Arabica::DOM::Node<std::string> node) { - if (!node || node.getNodeType() != Arabica::DOM::Node_base::ELEMENT_NODE) - return INVALID; - - // MMI container? - if (boost::iequals(node.getLocalName(), "MMI")) { - node = node.getFirstChild(); - if (!node) - return INVALID; - while(node.getNodeType() != Arabica::DOM::Node_base::ELEMENT_NODE) { - node = node.getNextSibling(); - if (!node) - return INVALID; - } - } - - if (boost::iequals(node.getLocalName(), "NEWCONTEXTREQUEST")) - return NEWCONTEXTREQUEST; - if (boost::iequals(node.getLocalName(), "NEWCONTEXTRESPONSE")) - return NEWCONTEXTRESPONSE; - if (boost::iequals(node.getLocalName(), "PREPAREREQUEST")) - return PREPAREREQUEST; - if (boost::iequals(node.getLocalName(), "PREPARERESPONSE")) - return PREPARERESPONSE; - if (boost::iequals(node.getLocalName(), "STARTREQUEST")) - return STARTREQUEST; - if (boost::iequals(node.getLocalName(), "STARTRESPONSE")) - return STARTRESPONSE; - if (boost::iequals(node.getLocalName(), "DONENOTIFICATION")) - return DONENOTIFICATION; - if (boost::iequals(node.getLocalName(), "CANCELREQUEST")) - return CANCELREQUEST; - if (boost::iequals(node.getLocalName(), "CANCELRESPONSE")) - return CANCELRESPONSE; - if (boost::iequals(node.getLocalName(), "PAUSEREQUEST")) - return PAUSEREQUEST; - if (boost::iequals(node.getLocalName(), "PAUSERESPONSE")) - return PAUSERESPONSE; - if (boost::iequals(node.getLocalName(), "RESUMEREQUEST")) - return RESUMEREQUEST; - if (boost::iequals(node.getLocalName(), "RESUMERESPONSE")) - return RESUMERESPONSE; - if (boost::iequals(node.getLocalName(), "EXTENSIONNOTIFICATION")) - return EXTENSIONNOTIFICATION; - if (boost::iequals(node.getLocalName(), "CLEARCONTEXTREQUEST")) - return CLEARCONTEXTREQUEST; - if (boost::iequals(node.getLocalName(), "CLEARCONTEXTRESPONSE")) - return CLEARCONTEXTRESPONSE; - if (boost::iequals(node.getLocalName(), "STATUSREQUEST")) - return STATUSREQUEST; - if (boost::iequals(node.getLocalName(), "STATUSRESPONSE")) - return STATUSRESPONSE; - return INVALID; -} - -Arabica::DOM::Document<std::string> MMIEvent::toXML(bool encapsulateInMMI) const { - Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation(); - Document<std::string> doc = domFactory.createDocument(nameSpace, "", 0); - Element<std::string> msgElem = doc.createElementNS(nameSpace, tagName); - msgElem.setAttributeNS(nameSpace, "Source", source); - msgElem.setAttributeNS(nameSpace, "Target", target); - msgElem.setAttributeNS(nameSpace, "RequestID", requestId); - - if (dataDOM) { - Element<std::string> dataElem = doc.createElementNS(nameSpace, "Data"); - Node<std::string> importNode = doc.importNode(dataDOM, true); - dataElem.appendChild(importNode); - msgElem.appendChild(dataElem); - } else if (data.size() > 0) { - Element<std::string> dataElem = doc.createElementNS(nameSpace, "Data"); - Text<std::string> textElem = doc.createTextNode(data); - dataElem.appendChild(textElem); - msgElem.appendChild(dataElem); - } - - if (encapsulateInMMI) { - Element<std::string> mmiElem = doc.createElementNS(nameSpace, "mmi"); - mmiElem.appendChild(msgElem); - doc.appendChild(mmiElem); - } else { - doc.appendChild(msgElem); - } - return doc; -} - -Arabica::DOM::Document<std::string> ContentRequest::toXML(bool encapsulateInMMI) const { - Document<std::string> doc = ContextualizedRequest::toXML(encapsulateInMMI); - FIND_MSG_ELEM(msgElem, doc); - - if (contentURL.href.size() > 0) { - Element<std::string> contentURLElem = doc.createElementNS(nameSpace, "ContentURL"); - contentURLElem.setAttributeNS(nameSpace, "href", contentURL.href); - contentURLElem.setAttributeNS(nameSpace, "fetchtimeout", contentURL.fetchTimeout); - contentURLElem.setAttributeNS(nameSpace, "max-age", contentURL.maxAge); - msgElem.appendChild(contentURLElem); - } else if (contentDOM) { - Element<std::string> contentElem = doc.createElementNS(nameSpace, "Content"); - Node<std::string> importNode = doc.importNode(contentDOM, true); - contentElem.appendChild(importNode); - msgElem.appendChild(contentElem); - } else if (content.size() > 0) { - Element<std::string> contentElem = doc.createElementNS(nameSpace, "Content"); - Text<std::string> textElem = doc.createTextNode(content); - contentElem.appendChild(textElem); - msgElem.appendChild(contentElem); - } - return doc; -} - -Arabica::DOM::Document<std::string> ContextualizedRequest::toXML(bool encapsulateInMMI) const { - Document<std::string> doc = MMIEvent::toXML(encapsulateInMMI); - FIND_MSG_ELEM(msgElem, doc); - msgElem.setAttributeNS(nameSpace, "Context", context); - return doc; -} - -Arabica::DOM::Document<std::string> ExtensionNotification::toXML(bool encapsulateInMMI) const { - Document<std::string> doc = ContextualizedRequest::toXML(encapsulateInMMI); - FIND_MSG_ELEM(msgElem, doc); - msgElem.setAttributeNS(nameSpace, "Name", name); - return doc; -} - -Arabica::DOM::Document<std::string> StatusResponse::toXML(bool encapsulateInMMI) const { - Document<std::string> doc = ContextualizedRequest::toXML(encapsulateInMMI); - FIND_MSG_ELEM(msgElem, doc); - if (status == ALIVE) { - msgElem.setAttributeNS(nameSpace, "Status", "alive"); - } else if(status == DEAD) { - msgElem.setAttributeNS(nameSpace, "Status", "dead"); - } else if(status == FAILURE) { - msgElem.setAttributeNS(nameSpace, "Status", "failure"); - } else if(status == SUCCESS) { - msgElem.setAttributeNS(nameSpace, "Status", "success"); - } - return doc; -} - -Arabica::DOM::Document<std::string> StatusInfoResponse::toXML(bool encapsulateInMMI) const { - Document<std::string> doc = StatusResponse::toXML(encapsulateInMMI); - FIND_MSG_ELEM(msgElem, doc); - - Element<std::string> statusInfoElem = doc.createElementNS(nameSpace, "StatusInfo"); - Text<std::string> statusInfoText = doc.createTextNode(statusInfo); - statusInfoElem.appendChild(statusInfoText); - msgElem.appendChild(statusInfoElem); - - return doc; -} - -Arabica::DOM::Document<std::string> StatusRequest::toXML(bool encapsulateInMMI) const { - Document<std::string> doc = ContextualizedRequest::toXML(encapsulateInMMI); - FIND_MSG_ELEM(msgElem, doc); - - if (automaticUpdate) { - msgElem.setAttributeNS(nameSpace, "RequestAutomaticUpdate", "true"); - } else { - msgElem.setAttributeNS(nameSpace, "RequestAutomaticUpdate", "false"); - } - - return doc; -} - - - -MMIEvent MMIEvent::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) { - MMIEvent msg; - - FIND_EVENT_NODE(node); - - Element<std::string> msgElem(node); - msg.source = STRING_ATTR_OR_EXPR(msgElem, Source); - msg.target = STRING_ATTR_OR_EXPR(msgElem, Target); - msg.requestId = STRING_ATTR_OR_EXPR(msgElem, RequestID); - msg.tagName = msgElem.getLocalName(); - - Element<std::string> dataElem; - - // search for data element - node = msgElem.getFirstChild(); - while (node) { - if (node.getNodeType() == Node_base::ELEMENT_NODE) - dataElem = Element<std::string>(node); - if (dataElem && boost::iequals(dataElem.getLocalName(), "data")) - break; - node = node.getNextSibling(); - } - - if (dataElem && boost::iequals(dataElem.getLocalName(), "data") && dataElem.getFirstChild()) { - Arabica::DOM::Node<std::string> dataChild = dataElem.getFirstChild(); - std::stringstream ss; - - while (dataChild) { - if (dataChild.getNodeType() == Arabica::DOM::Node_base::ELEMENT_NODE) - msg.dataDOM = dataChild; - ss << dataChild; - dataChild = dataChild.getNextSibling(); - } - msg.data = ss.str(); - } - - return msg; -} - -FROM_XML(NewContextRequest, NEWCONTEXTREQUEST, MMIEvent) - -FROM_XML(PauseRequest, PAUSEREQUEST, ContextualizedRequest) -FROM_XML(ResumeRequest, RESUMEREQUEST, ContextualizedRequest) -FROM_XML(ClearContextRequest, CLEARCONTEXTREQUEST, ContextualizedRequest) -FROM_XML(CancelRequest, CANCELREQUEST, ContextualizedRequest) - -FROM_XML(PrepareRequest, PREPAREREQUEST, ContentRequest) -FROM_XML(StartRequest, STARTREQUEST, ContentRequest) - -FROM_XML(PrepareResponse, PREPARERESPONSE, StatusInfoResponse) -FROM_XML(StartResponse, STARTRESPONSE, StatusInfoResponse) -FROM_XML(CancelResponse, CANCELRESPONSE, StatusInfoResponse) -FROM_XML(PauseResponse, PAUSERESPONSE, StatusInfoResponse) -FROM_XML(ResumeResponse, RESUMERESPONSE, StatusInfoResponse) -FROM_XML(ClearContextResponse, CLEARCONTEXTRESPONSE, StatusInfoResponse) -FROM_XML(NewContextResponse, NEWCONTEXTRESPONSE, StatusInfoResponse) -FROM_XML(DoneNotification, DONENOTIFICATION, StatusInfoResponse) - - -ContextualizedRequest ContextualizedRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) { - ContextualizedRequest msg(MMIEvent::fromXML(node, interpreter)); - FIND_EVENT_NODE(node); - - Element<std::string> msgElem(node); - msg.context = STRING_ATTR_OR_EXPR(msgElem, Context); - return msg; -} - -ExtensionNotification ExtensionNotification::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) { - ExtensionNotification msg(ContextualizedRequest::fromXML(node, interpreter)); - FIND_EVENT_NODE(node); - - Element<std::string> msgElem(node); - msg.name = STRING_ATTR_OR_EXPR(msgElem, Name); - msg.type = EXTENSIONNOTIFICATION; - return msg; -} - -ContentRequest ContentRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) { - ContentRequest msg(ContextualizedRequest::fromXML(node, interpreter)); - FIND_EVENT_NODE(node); - - Element<std::string> msgElem(node); - Element<std::string> contentElem; - - node = msgElem.getFirstChild(); - while (node) { - if (node.getNodeType() == Node_base::ELEMENT_NODE) { - contentElem = Element<std::string>(node); - if (boost::iequals(contentElem.getLocalName(), "content") || - boost::iequals(contentElem.getLocalName(), "contentURL")) - break; - } - node = node.getNextSibling(); - } - - if (contentElem) { - if(boost::iequals(contentElem.getLocalName(), "content")) { - Arabica::DOM::Node<std::string> contentChild = contentElem.getFirstChild(); - std::stringstream ss; - - while (contentChild) { - if (contentChild.getNodeType() == Arabica::DOM::Node_base::ELEMENT_NODE) - msg.contentDOM = contentChild; - ss << contentChild; - contentChild = contentChild.getNextSibling(); - } - msg.content = ss.str(); - - } else if(boost::iequals(contentElem.getLocalName(), "contentURL")) { - msg.contentURL.href = STRING_ATTR_OR_EXPR(contentElem, href); - msg.contentURL.maxAge = STRING_ATTR_OR_EXPR(contentElem, max-age); - msg.contentURL.fetchTimeout = STRING_ATTR_OR_EXPR(contentElem, fetchtimeout); - } - } - - //msg.content = msgElem.getAttributeNS(nameSpace, "Context"); - return msg; -} - -StatusResponse StatusResponse::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) { - StatusResponse msg(ContextualizedRequest::fromXML(node, interpreter)); - FIND_EVENT_NODE(node); - - Element<std::string> msgElem(node); - std::string status = STRING_ATTR_OR_EXPR(msgElem, Status); - - if (boost::iequals(status, "ALIVE")) { - msg.status = ALIVE; - } else if(boost::iequals(status, "DEAD")) { - msg.status = DEAD; - } else if(boost::iequals(status, "FAILURE")) { - msg.status = FAILURE; - } else if(boost::iequals(status, "SUCCESS")) { - msg.status = SUCCESS; - } else { - msg.status = INVALID; - } - msg.type = STATUSRESPONSE; - return msg; -} - -StatusInfoResponse StatusInfoResponse::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) { - StatusInfoResponse msg(StatusResponse::fromXML(node, interpreter)); - FIND_EVENT_NODE(node); - - Element<std::string> msgElem(node); - Element<std::string> statusInfoElem; - - node = msgElem.getFirstChild(); - while (node) { - if (node.getNodeType() == Node_base::ELEMENT_NODE) { - statusInfoElem = Element<std::string>(node); - if (statusInfoElem && boost::iequals(statusInfoElem.getLocalName(), "statusInfo")) - break; - } - node = node.getNextSibling(); - } - - if (statusInfoElem && boost::iequals(statusInfoElem.getLocalName(), "statusInfo")) { - node = statusInfoElem.getFirstChild(); - while (node) { - if (node.getNodeType() == Node_base::TEXT_NODE) { - msg.statusInfo = node.getNodeValue(); - break; - } - node = node.getNextSibling(); - } - } - return msg; -} - - -StatusRequest StatusRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) { - StatusRequest msg(ContextualizedRequest::fromXML(node, interpreter)); - FIND_EVENT_NODE(node); - - Element<std::string> msgElem(node); - std::string autoUpdate = STRING_ATTR_OR_EXPR(msgElem, RequestAutomaticUpdate); - - if (boost::iequals(autoUpdate, "true")) { - msg.automaticUpdate = true; - } else if(boost::iequals(autoUpdate, "on")) { - msg.automaticUpdate = true; - } else if(boost::iequals(autoUpdate, "yes")) { - msg.automaticUpdate = true; - } else if(boost::iequals(autoUpdate, "1")) { - msg.automaticUpdate = true; - } else { - msg.automaticUpdate = false; - } - msg.type = STATUSREQUEST; - return msg; -} - - - -#ifdef MMI_WITH_OPERATOR_EVENT - -TO_EVENT_OPERATOR(NewContextRequest, "mmi.request.newcontext", MMIEvent); -TO_EVENT_OPERATOR(PauseRequest, "mmi.request.pause", ContextualizedRequest); -TO_EVENT_OPERATOR(ResumeRequest, "mmi.request.resume", ContextualizedRequest); -TO_EVENT_OPERATOR(CancelRequest, "mmi.request.cancel", ContextualizedRequest); -TO_EVENT_OPERATOR(ClearContextRequest, "mmi.request.clearcontext", ContextualizedRequest); -TO_EVENT_OPERATOR(StatusRequest, "mmi.request.status", ContextualizedRequest); - -TO_EVENT_OPERATOR(PrepareRequest, "mmi.request.prepare", ContentRequest); -TO_EVENT_OPERATOR(StartRequest, "mmi.request.start", ContentRequest); - -TO_EVENT_OPERATOR(PrepareResponse, "mmi.response.prepare", StatusInfoResponse); -TO_EVENT_OPERATOR(StartResponse, "mmi.response.start", StatusInfoResponse); -TO_EVENT_OPERATOR(CancelResponse, "mmi.response.cancel", StatusInfoResponse); -TO_EVENT_OPERATOR(PauseResponse, "mmi.response.pause", StatusInfoResponse); -TO_EVENT_OPERATOR(ResumeResponse, "mmi.response.resume", StatusInfoResponse); -TO_EVENT_OPERATOR(ClearContextResponse, "mmi.response.clearcontext", StatusInfoResponse); -TO_EVENT_OPERATOR(NewContextResponse, "mmi.response.newcontext", StatusInfoResponse); -TO_EVENT_OPERATOR(DoneNotification, "mmi.notification.done", StatusInfoResponse); - - -MMIEvent::operator Event() const { - Event ev; - ev.setOriginType("mmi.event"); - ev.setOrigin(source); - - if (representation == MMI_AS_DATA) { - if (dataDOM) { - ev.data.node = dataDOM; - } else { - ev.data = Data::fromJSON(data); - if (ev.data.empty()) { - ev.content = data; - } - } - } - return ev; -} - -ContextualizedRequest::operator Event() const { - Event ev = MMIEvent::operator Event(); - // do we want to represent the context? It's the interpreters name already - return ev; -} - -ExtensionNotification::operator Event() const { - Event ev = ContextualizedRequest::operator Event(); - if (name.length() > 0) { - ev.setName(name); - } else { - ev.setName("mmi.notification.extension"); - } - return ev; -} - -ContentRequest::operator Event() const { - Event ev = ContextualizedRequest::operator Event(); - if (representation == MMI_AS_DATA) { - if (content.length() > 0) - ev.data.compound["content"] = Data(content, Data::VERBATIM); - if (contentURL.fetchTimeout.length() > 0) - ev.data.compound["contentURL"].compound["fetchTimeout"] = Data(contentURL.fetchTimeout, Data::VERBATIM); - if (contentURL.href.length() > 0) - ev.data.compound["contentURL"].compound["href"] = Data(contentURL.href, Data::VERBATIM); - if (contentURL.maxAge.length() > 0) - ev.data.compound["contentURL"].compound["maxAge"] = Data(contentURL.maxAge, Data::VERBATIM); - } - return ev; -} - -StatusResponse::operator Event() const { - Event ev = ContextualizedRequest::operator Event(); - ev.setName("mmi.response.status"); - - if (representation == MMI_AS_DATA) { - switch (status) { - case ALIVE: - ev.data.compound["status"] = Data("alive", Data::VERBATIM); - break; - case DEAD: - ev.data.compound["status"] = Data("dead", Data::VERBATIM); - break; - case SUCCESS: - ev.data.compound["status"] = Data("success", Data::VERBATIM); - break; - case FAILURE: - ev.data.compound["status"] = Data("failure", Data::VERBATIM); - break; - default: - ev.data.compound["status"] = Data("invalid", Data::VERBATIM); - } - } else { - ev.dom = toXML(); - } - - return ev; -} - -#endif - - -}
\ No newline at end of file diff --git a/src/uscxml/messages/MMIMessages.h b/src/uscxml/messages/MMIMessages.h deleted file mode 100644 index 3538816..0000000 --- a/src/uscxml/messages/MMIMessages.h +++ /dev/null @@ -1,414 +0,0 @@ -/** - * @file - * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) - * @copyright Simplified BSD - * - * @cond - * This program is free software: you can redistribute it and/or modify - * it under the terms of the FreeBSD license as published by the FreeBSD - * project. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the FreeBSD license along with this - * program. If not, see <http://www.opensource.org/licenses/bsd-license>. - * @endcond - */ - -#ifndef MMIEVENT_H_OS0SE7H5 -#define MMIEVENT_H_OS0SE7H5 - -#define MMI_WITH_OPERATOR_EVENT 1 - -#include <iostream> -#include <DOM/Node.hpp> -#include <DOM/Document.hpp> -#include <uscxml/Interpreter.h> - -namespace uscxml { - -class MMIEvent { -public: - enum Type { - NEWCONTEXTREQUEST, - NEWCONTEXTRESPONSE, - PREPAREREQUEST, - PREPARERESPONSE, - STARTREQUEST, - STARTRESPONSE, - DONENOTIFICATION, - CANCELREQUEST, - CANCELRESPONSE, - PAUSEREQUEST, - PAUSERESPONSE, - RESUMEREQUEST, - RESUMERESPONSE, - EXTENSIONNOTIFICATION, - CLEARCONTEXTREQUEST, - CLEARCONTEXTRESPONSE, - STATUSREQUEST, - STATUSRESPONSE, - INVALID - }; - - enum RepresentationType { - MMI_AS_DATA, - MMI_AS_XML - }; - static Type getType(Arabica::DOM::Node<std::string> node); - - virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const; - static MMIEvent fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - // conversion operator - operator Event() const; -#endif - - std::string source; - std::string target; - std::string data; - Arabica::DOM::Node<std::string> dataDOM; - std::string requestId; - - std::string tagName; - Type type; - RepresentationType representation; - - static std::string nameSpace; - -protected: - MMIEvent() : representation(MMI_AS_DATA) {} -}; - -class NewContextRequest : public MMIEvent { -public: - NewContextRequest() { - tagName = "NewContextRequest"; - type = NEWCONTEXTREQUEST; - } - NewContextRequest(const MMIEvent& father) : MMIEvent(father) {} - static NewContextRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - - std::string token; ///< special token for server-less modality components -}; - -class ContextualizedRequest : public MMIEvent { -public: - virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const; - static ContextualizedRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - - std::string context; -protected: - ContextualizedRequest() {} - ContextualizedRequest(const MMIEvent& father) : MMIEvent(father) {} -}; - -class PauseRequest : public ContextualizedRequest { -public: - PauseRequest() { - tagName = "PauseRequest"; - type = PAUSEREQUEST; - } - PauseRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {} - static PauseRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - -}; -class ResumeRequest : public ContextualizedRequest { -public: - ResumeRequest() { - tagName = "ResumeRequest"; - type = RESUMEREQUEST; - } - ResumeRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {} - static ResumeRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - -}; -class CancelRequest : public ContextualizedRequest { -public: - CancelRequest() { - tagName = "CancelRequest"; - type = CANCELREQUEST; - } - CancelRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {} - static CancelRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - -}; -class ClearContextRequest : public ContextualizedRequest { -public: - ClearContextRequest() { - tagName = "ClearContextRequest"; - type = CLEARCONTEXTREQUEST; - } - ClearContextRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {} - static ClearContextRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - -}; -class StatusRequest : public ContextualizedRequest { -public: - StatusRequest() { - tagName = "StatusRequest"; - type = STARTREQUEST; - } - virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const; - static StatusRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - - bool automaticUpdate; -protected: - StatusRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {} -}; - -class ContentRequest : public ContextualizedRequest { -public: - struct ContentURL { - std::string href; - std::string maxAge; - std::string fetchTimeout; - }; - - virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const; - static ContentRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - - std::string content; - Arabica::DOM::Node<std::string> contentDOM; - ContentURL contentURL; -protected: - ContentRequest() {} - ContentRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {} -}; - -class PrepareRequest : public ContentRequest { -public: - PrepareRequest() { - tagName = "PrepareRequest"; - type = PREPAREREQUEST; - } - PrepareRequest(const ContentRequest& father) : ContentRequest(father) {} - static PrepareRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif -}; - -class StartRequest : public ContentRequest { -public: - StartRequest() { - tagName = "StartRequest"; - type = STARTREQUEST; - } - StartRequest(const ContentRequest& father) : ContentRequest(father) {} - static StartRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - -}; - -class ExtensionNotification : public ContextualizedRequest { -public: - ExtensionNotification() { - tagName = "ExtensionNotification"; - type = EXTENSIONNOTIFICATION; - } - virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const; - static ExtensionNotification fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - - std::string name; -protected: - ExtensionNotification(const ContextualizedRequest& father) : ContextualizedRequest(father) {} - -}; - -class StatusResponse : public ContextualizedRequest { -public: - enum Status { - INVALID = 0, - ALIVE = 1, - DEAD = 2, - SUCCESS = 3, - FAILURE = 4 - }; - - StatusResponse() { - tagName = "StatusResponse"; - type = STATUSRESPONSE; - status = INVALID; - } - virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const; - static StatusResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - - Status status; -protected: - StatusResponse(const ContextualizedRequest& father) : ContextualizedRequest(father) {} -}; - -class StatusInfoResponse : public StatusResponse { -public: - virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const; - StatusInfoResponse(const StatusResponse& father) : StatusResponse(father) {} - static StatusInfoResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - std::string statusInfo; -protected: - StatusInfoResponse() {} -}; - -class PrepareResponse : public StatusInfoResponse { -public: - PrepareResponse() { - tagName = "PrepareResponse"; - type = PREPARERESPONSE; - } - PrepareResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {} - static PrepareResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif - -}; - -class StartResponse : public StatusInfoResponse { -public: - StartResponse() { - tagName = "StartResponse"; - type = STARTRESPONSE; - } - StartResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {} - static StartResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif -}; - -class CancelResponse : public StatusInfoResponse { -public: - CancelResponse() { - tagName = "CancelResponse"; - type = CANCELRESPONSE; - } - CancelResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {} - static CancelResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif -}; - -class PauseResponse : public StatusInfoResponse { -public: - PauseResponse() { - tagName = "PauseResponse"; - type = PAUSERESPONSE; - } - PauseResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {} - static PauseResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif -}; - -class ResumeResponse : public StatusInfoResponse { -public: - ResumeResponse() { - tagName = "ResumeResponse"; - type = RESUMERESPONSE; - } - ResumeResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {} - static ResumeResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif -}; - -class ClearContextResponse : public StatusInfoResponse { -public: - ClearContextResponse() { - tagName = "ClearContextResponse"; - type = CLEARCONTEXTRESPONSE; - } - ClearContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {} - static ClearContextResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif -}; - -class NewContextResponse : public StatusInfoResponse { -public: - NewContextResponse() { - tagName = "NewContextResponse"; - type = NEWCONTEXTRESPONSE; - } - NewContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {} - static NewContextResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif -}; - -class DoneNotification : public StatusInfoResponse { -public: - DoneNotification() { - tagName = "DoneNotification"; - type = DONENOTIFICATION; - } - DoneNotification(const StatusInfoResponse& father) : StatusInfoResponse(father) {} - static DoneNotification fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL); - -#ifdef MMI_WITH_OPERATOR_EVENT - operator Event() const; -#endif -}; - -} - -#endif /* end of include guard: MMIEVENT_H_OS0SE7H5 */ diff --git a/src/uscxml/messages/SendRequest.cpp b/src/uscxml/messages/SendRequest.cpp deleted file mode 100644 index 4759d29..0000000 --- a/src/uscxml/messages/SendRequest.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/** - * @file - * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) - * @copyright Simplified BSD - * - * @cond - * This program is free software: you can redistribute it and/or modify - * it under the terms of the FreeBSD license as published by the FreeBSD - * project. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the FreeBSD license along with this - * program. If not, see <http://www.opensource.org/licenses/bsd-license>. - * @endcond - */ - -#include "uscxml/messages/SendRequest.h" -#include <DOM/Simple/DOMImplementation.hpp> -#include <DOM/Document.hpp> -#include <DOM/io/Stream.hpp> - -namespace uscxml { - -std::string SendRequest::toXMLString() { - std::stringstream ss; - ss << toDocument(); - return ss.str(); -} - -Arabica::DOM::Document<std::string> SendRequest::toDocument() { - Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation(); - Arabica::DOM::Document<std::string> document = Event::toDocument(); - Arabica::DOM::Element<std::string> scxmlMsg = document.getDocumentElement(); - - // add params and namelist - if (params.size() > 0 || namelist.size() > 0) { - Arabica::DOM::NodeList<std::string> payload = scxmlMsg.getElementsByTagName("scxml:payload"); - if (payload.getLength() == 0) { - Arabica::DOM::Element<std::string> payloadElem = document.createElementNS("http://www.w3.org/2005/07/scxml", "payload"); - payloadElem.setPrefix("scxml"); - - scxmlMsg.appendChild(payloadElem); - } - Arabica::DOM::Node<std::string> payloadElem = scxmlMsg.getElementsByTagName("scxml:payload").item(0); - - // add parameters - std::multimap<std::string, Data>::iterator paramIter = params.begin(); - while(paramIter != params.end()) { - Arabica::DOM::Element<std::string> propertyElem = document.createElementNS("http://www.w3.org/2005/07/scxml", "property"); - propertyElem.setPrefix("scxml"); - - propertyElem.setAttribute("name", paramIter->first); - // this is simplified - Data might be more elaborate than a simple string atom - Arabica::DOM::Text<std::string> textElem = document.createTextNode(paramIter->second.atom); - propertyElem.appendChild(textElem); - payloadElem.appendChild(propertyElem); - paramIter++; - } - - // add namelist elements - std::map<std::string, Data>::iterator namelistIter = namelist.begin(); - while(namelistIter != namelist.end()) { - Arabica::DOM::Element<std::string> propertyElem = document.createElementNS("http://www.w3.org/2005/07/scxml", "property"); - propertyElem.setPrefix("scxml"); - - propertyElem.setAttribute("name", namelistIter->first); - // this is simplified - Data might be more elaborate than a simple string atom - Arabica::DOM::Text<std::string> textElem = document.createTextNode(namelistIter->second.atom); - propertyElem.appendChild(textElem); - payloadElem.appendChild(propertyElem); - namelistIter++; - } - - } - - scxmlMsg.setAttribute("sendid", sendid); - - return document; -} - -SendRequest SendRequest::fromXML(const std::string& xmlString) { - Event::fromXML(xmlString); - return SendRequest(); -} - -std::ostream& operator<< (std::ostream& os, const SendRequest& sendReq) { - - std::string indent; - for (size_t i = 0; i < _dataIndentation; i++) { - indent += " "; - } - - os << indent << "SendReq" << std::endl; - - if (sendReq.target.size() > 0) - os << indent << " target: " << sendReq.target << std::endl; - - if (sendReq.type.size() > 0) - os << indent << " type: " << sendReq.type << std::endl; - - 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(); - while(namelistIter != sendReq.namelist.end()) { - os << indent << " " << namelistIter->first << ": " << namelistIter->second << std::endl; - namelistIter++; - } - } - - if (sendReq.params.size() > 0) { - os << indent << " params: " << std::endl; - SendRequest::params_t::const_iterator paramIter = sendReq.params.begin(); - while(paramIter != sendReq.params.end()) { - os << indent << " " << paramIter->first << ": " << paramIter->second << std::endl; - paramIter++; - } - } - - if (sendReq.content.size() > 0) - os << indent << " content: " << sendReq.content << std::endl; -#endif - _dataIndentation++; - os << (Event)sendReq; - _dataIndentation--; - return os; - -} - -}
\ No newline at end of file diff --git a/src/uscxml/messages/SendRequest.h b/src/uscxml/messages/SendRequest.h deleted file mode 100644 index 369fc65..0000000 --- a/src/uscxml/messages/SendRequest.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @file - * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) - * @copyright Simplified BSD - * - * @cond - * This program is free software: you can redistribute it and/or modify - * it under the terms of the FreeBSD license as published by the FreeBSD - * project. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the FreeBSD license along with this - * program. If not, see <http://www.opensource.org/licenses/bsd-license>. - * @endcond - */ - -#ifndef SENDREQUEST_H_86B0F6A0 -#define SENDREQUEST_H_86B0F6A0 - -#include "uscxml/messages/Event.h" - -namespace uscxml { - -class USCXML_API SendRequest : public Event { -public: - SendRequest() : delayMs(0) {} - SendRequest(Event event) : Event(event) {} - - std::string getTarget() { - return target; - } - void setTarget(const std::string& target) { - this->target = target; - } - - std::string getType() { - return type; - } - void setType(const std::string& type) { - this->type = type; - } - - uint32_t getDelayMs() { - return delayMs; - } - void setDelayMs(uint32_t delayMs) { - this->delayMs = delayMs; - } - - static SendRequest fromXML(const std::string& xmlString); - Arabica::DOM::Document<std::string> toDocument(); - std::string toXMLString(); - -#ifdef SWIGIMPORTED -protected: -#endif - std::string target; - std::string type; - uint32_t delayMs; - Arabica::DOM::Element<std::string> elem; - - friend USCXML_API std::ostream& operator<< (std::ostream& os, const SendRequest& sendReq); - -}; - -USCXML_API std::ostream& operator<< (std::ostream& os, const SendRequest& sendReq); - -} - -#endif /* end of include guard: SENDREQUEST_H_86B0F6A0 */ |