#pragma once #include #include #include #include #include "common.hpp" POLYBAR_NS class signal_receiver_interface { public: using prio = unsigned int; using prio_map = std::multimap; virtual ~signal_receiver_interface() {} virtual prio priority() const = 0; template bool on(const Signal& signal); }; template class signal_receiver_impl { public: virtual ~signal_receiver_impl() {} virtual bool on(const Signal&) = 0; }; template bool signal_receiver_interface::on(const Signal& s) { auto event_sink = dynamic_cast*>(this); if (event_sink != nullptr && event_sink->on(s)) { return true; } else { return false; } } template class signal_receiver : public signal_receiver_interface, public signal_receiver_impl, public signal_receiver_impl... { public: prio priority() const { return Priority; } }; using signal_receivers_t = std::unordered_map; POLYBAR_NS_END