/* * Author: Patrick-Christopher Mattulat * Company: Lynar Studios * E-Mail: webmaster@lynarstudios.com * Created: 2024-05-16 * Changed: 2024-05-31 * * */ #ifndef LS_STD_EVENT_LISTENER_HPP #define LS_STD_EVENT_LISTENER_HPP #include "Event.hpp" #include "EventParameter.hpp" #include #include #include namespace ls::std::event { ls_std_class EventListener : public ::std::enable_shared_from_this, public core::Class { public: explicit EventListener(); ~EventListener() noexcept override; [[nodiscard]] type::listener_id getId() const; void setId(type::listener_id _id); void setParameter(const EventParameter &_parameter); [[maybe_unused]] bool subscribe(const Event &_event, const type::event_action &_action); [[maybe_unused]] bool unsubscribe(const Event &_event); protected: EventParameter parameter{}; private: type::listener_id id{}; void _requestListenerId(const ::std::shared_ptr &_manager); [[nodiscard]] bool _subscribe(const Event &_event, const type::event_action &_action); [[nodiscard]] bool _unsubscribe(const Event &_event); }; } #endif