#ifndef EVENT_H_XZAQ4HR #define EVENT_H_XZAQ4HR #include #include #include #include #include #include #include #define TAGNAME(elem) ((Arabica::DOM::Element)elem).getTagName() #define LOCALNAME(elem) ((Arabica::DOM::Element)elem).getLocalName() #define ATTR(elem, attr) ((Arabica::DOM::Element)elem).getAttribute(attr) #define HAS_ATTR(elem, attr) ((Arabica::DOM::Element)elem).hasAttribute(attr) namespace uscxml { class Data { public: enum Type { VERBATIM, INTERPRETED }; Data() {} Data(const std::string& atom_, Type type_ = INTERPRETED) : atom(atom_), type(type_) {} Data(const Arabica::DOM::Node& dom); virtual ~Data() {} static Data fromXML(const std::string& xmlString); Arabica::DOM::Document toDocument(); std::string toXMLString() { std::stringstream ss; ss << toDocument(); return ss.str(); } std::map compound; std::list array; std::string atom; Type type; protected: Arabica::DOM::Document toNode(const Arabica::DOM::Document& factory, const Data& data); #ifndef SWIGJAVA friend std::ostream& operator<< (std::ostream& os, const Data& data); #endif }; class Event : public Data { public: enum Type { PLATFORM, INTERNAL, EXTERNAL }; Event() : type(INTERNAL) {} Event(const Arabica::DOM::Node& xmlString) : type(INTERNAL) {}; std::string name; Type type; std::string origin; std::string origintype; Arabica::DOM::Node dom; std::string sendid; std::string invokeid; static Event fromXML(const std::string& xmlString); Arabica::DOM::Document toDocument(); std::string toXMLString() { std::stringstream ss; ss << toDocument(); return ss.str(); } #ifndef SWIGJAVA friend std::ostream& operator<< (std::ostream& os, const Event& event); #endif }; class InvokeRequest : public Event { public: std::string type; std::string src; std::string namelist; typedef std::map namelist_t; bool autoForward; std::multimap params; typedef std::multimap params_t; std::string content; static InvokeRequest fromXML(const std::string& xmlString); Arabica::DOM::Document toDocument(); std::string toXMLString() { std::stringstream ss; ss << toDocument(); return ss.str(); } }; class SendRequest : public Event { public: std::string target; std::string type; uint32_t delayMs; std::map namelist; typedef std::map namelist_t; std::multimap params; typedef std::multimap params_t; std::string content; static SendRequest fromXML(const std::string& xmlString); Arabica::DOM::Document toDocument(); std::string toXMLString() { std::stringstream ss; ss << toDocument(); // std::cout << ss.str() << std::endl; return ss.str(); } }; } #endif /* end of include guard: EVENT_H_XZAQ4HR */