Files
OpenSpace/modules/server/include/topics/shortcuttopic.h
Ylva Selling 059ab70218 Add events for adding and removing actions and publishing events when an action is added (#3325)
* Remove unused shortcut manager
* Add events for adding and removing actions
* Publish event when an action is added
* Add get_action event to shortcut topic which sends requested action to the topic
* Add better comments to events
* Publish event action removed when removing an action
* Rename actions to shortcuts in the json object
* Remove subscriptions and rename action to shortcut
2024-06-14 20:48:13 +02:00

48 lines
2.7 KiB
C++

/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_SERVER___SHORTCUT_TOPIC___H__
#define __OPENSPACE_MODULE_SERVER___SHORTCUT_TOPIC___H__
#include <modules/server/include/topics/topic.h>
namespace openspace {
class ShortcutTopic : public Topic {
public:
~ShortcutTopic() override = default;
void handleJson(const nlohmann::json& input) override;
bool isDone() const override;
private:
void sendData(nlohmann::json data) const;
std::vector<nlohmann::json> shortcutsJson() const;
nlohmann::json shortcutJson(const std::string& identifier) const;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_SERVER___SHORTCUT_TOPIC___H__