summaryrefslogtreecommitdiffstats
path: root/src/uscxml/messages/Event.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/messages/Event.h')
-rw-r--r--src/uscxml/messages/Event.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/uscxml/messages/Event.h b/src/uscxml/messages/Event.h
index f40a672..c4d818b 100644
--- a/src/uscxml/messages/Event.h
+++ b/src/uscxml/messages/Event.h
@@ -107,8 +107,8 @@ public:
PLATFORM = 3
};
- Event() : eventType(INTERNAL), hideSendId(false), uuid(UUID::getUUID()) {}
- explicit Event(const std::string& name, Type type = INTERNAL) : name(name), eventType(type), hideSendId(false) {}
+ Event();
+ explicit Event(const std::string& name, Type type = INTERNAL);
static Event fromData(const Data& data);
bool operator< (const Event& other) const {
@@ -197,6 +197,14 @@ public:
return false;
}
+ const std::string& getUUID() const {
+ // this is expensive - lazy initialization
+ if (uuid.length() == 0) {
+ uuid = UUID::getUUID();
+ }
+ return uuid;
+ }
+
std::string raw;
std::string name;
Type eventType;
@@ -208,7 +216,9 @@ public:
Data data;
std::map<std::string, Data> namelist;
std::multimap<std::string, Data> params;
- std::string uuid; // the sendid is not necessarily unique!
+
+private:
+ mutable std::string uuid; // the sendid is not necessarily unique!
friend USCXML_API std::ostream& operator<< (std::ostream& os, const Event& event);
};