Krotos Modules 3
Loading...
Searching...
No Matches
PresetEventMiddleware.h
Go to the documentation of this file.
1namespace krotos
2{
7 {
11 ValueTree newState;
13 };
14
19 {
24 bool success{true};
25
29 String message{""};
30 };
31
36 {
40 ValueTree kwidgetTree;
41 };
42
47 {
52 bool success{true};
53
57 String message{""};
58 };
59
65 {
71 virtual void onPresetLoad(PresetLoadRequest& request, PresetLoadResponse& response) = 0;
72
78 virtual void onKwidgetLoad(KwidgetLoadRequest& request, KwidgetLoadResponse& response) = 0;
79
83 virtual ~PresetEventHook() = default;
84 };
85
101 {
102 public:
107 void addHook(std::unique_ptr<PresetEventHook> hook);
108
114 bool removeHook(PresetEventHook* hook);
115
122
129
130 private:
131 std::vector<std::unique_ptr<PresetEventHook>> m_hooks;
132 };
133
134} // namespace krotos
Middleware class for managing preset events and hooks.
Definition PresetEventMiddleware.h:101
bool removeHook(PresetEventHook *hook)
Removes a hook from the middleware.
Definition PresetEventMiddleware.cpp:5
void addHook(std::unique_ptr< PresetEventHook > hook)
Adds a new hook to the middleware.
Definition PresetEventMiddleware.cpp:3
KwidgetLoadResponse processKwidgetLoad(KwidgetLoadRequest &request)
Processes a Kwidget load request through all registered hooks.
Definition PresetEventMiddleware.cpp:33
PresetLoadResponse processPresetLoad(PresetLoadRequest &request)
Processes a preset load request through all registered hooks.
Definition PresetEventMiddleware.cpp:18
std::vector< std::unique_ptr< PresetEventHook > > m_hooks
Definition PresetEventMiddleware.h:131
Definition AirAbsorptionFilter.cpp:2
A middleware request object for a Kwidget load event.
Definition PresetEventMiddleware.h:36
ValueTree kwidgetTree
The value tree representing the state of the Kwidget to be loaded.
Definition PresetEventMiddleware.h:40
A middleware response object for the Kwidget load operation.
Definition PresetEventMiddleware.h:47
String message
A message describing the result of the middleware operation.
Definition PresetEventMiddleware.h:57
bool success
Indicates whether the middleware operation was successful. Also returns true by default,...
Definition PresetEventMiddleware.h:52
An abstract base class for preset event hooks. These can be used to intercept and modify preset and K...
Definition PresetEventMiddleware.h:65
virtual void onKwidgetLoad(KwidgetLoadRequest &request, KwidgetLoadResponse &response)=0
Called when a Kwidget is being loaded.
virtual ~PresetEventHook()=default
Virtual destructor for proper cleanup of derived classes.
virtual void onPresetLoad(PresetLoadRequest &request, PresetLoadResponse &response)=0
Called when a preset is being loaded.
A middleware request object for a preset load event.
Definition PresetEventMiddleware.h:7
File presetFile
Definition PresetEventMiddleware.h:12
ValueTree newState
The new preset state value tree.
Definition PresetEventMiddleware.h:11
A simple middleware response object containing the success status and a message.
Definition PresetEventMiddleware.h:19
String message
A message describing the result of the middleware operation.
Definition PresetEventMiddleware.h:29
bool success
Indicates whether the middleware was successful in processing the preset load request,...
Definition PresetEventMiddleware.h:24