35 #include "core/GpgFrontendCore.h"
36 #include "core/model/DataObject.h"
37 #include "module/sdk/GFSDKModule.h"
43 using EventRefrernce = std::shared_ptr<Event>;
44 using EventIdentifier = QString;
45 using EventTriggerIdentifier = QString;
46 using Evnets = std::vector<Event>;
48 class GPGFRONTEND_CORE_EXPORT
Event {
50 using ParameterValue = std::any;
51 using EventIdentifier = QString;
52 using ListenerIdentifier = QString;
54 std::function<void(EventIdentifier, ListenerIdentifier, DataObjectPtr)>;
60 explicit Event(
const QString&,
61 std::initializer_list<ParameterInitializer> = {},
62 EventCallback =
nullptr);
66 auto operator[](
const QString& key)
const -> std::optional<ParameterValue>;
68 auto operator==(
const Event& other)
const -> bool;
70 auto operator!=(
const Event& other)
const -> bool;
72 auto operator<(
const Event& other)
const -> bool;
74 auto operator<=(
const Event& other)
const -> bool;
76 explicit operator QString()
const;
78 auto GetIdentifier() -> EventIdentifier;
80 auto GetTriggerIdentifier() -> EventTriggerIdentifier;
82 void AddParameter(
const QString& key,
const QString& value);
84 void ExecuteCallback(ListenerIdentifier, DataObjectPtr);
90 SecureUniquePtr<Impl> p_;
93 template <
typename... Args>
94 auto MakeEvent(
const EventIdentifier& event_id, Args&&... args,
95 Event::EventCallback e_cb) -> EventRefrernce {
96 std::initializer_list<Event::ParameterInitializer> params = {
97 Event::ParameterInitializer{std::forward<Args>(args)}...};
98 return GpgFrontend::SecureCreateSharedObject<Event>(event_id, params, e_cb);
Definition: GFSDKModule.h:49