Make CustomEvents more useful by adding the payload as a string

This commit is contained in:
Alexander Bock
2022-04-14 15:57:40 +02:00
parent 80d3efd64c
commit c84c3e4f67
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -401,10 +401,10 @@ struct EventPointJwstRequested : public Event {
struct CustomEvent : public Event {
static const Type Type = Event::Type::Custom;
CustomEvent(std::string_view subtype_, const void* payload_);
CustomEvent(std::string_view subtype_, std::string_view payload_);
const tstring subtype;
const void* payload = nullptr;
const tstring payload;
};
} // namespace openspace::events
+4 -1
View File
@@ -428,6 +428,9 @@ ghoul::Dictionary toParameter(const Event& e) {
d.setValue(
"Subtype", std::string(static_cast<const CustomEvent&>(e).subtype)
);
d.setValue(
"Payload", std::string(static_cast<const CustomEvent&>(e).payload)
);
break;
default:
break;
@@ -608,7 +611,7 @@ EventPointJwstRequested::EventPointJwstRequested(double ra_, double dec_)
, dec(dec_)
{}
CustomEvent::CustomEvent(std::string_view subtype_, const void* payload_)
CustomEvent::CustomEvent(std::string_view subtype_, std::string_view payload_)
: Event(Type)
, subtype(subtype_)
, payload(payload_)