20 #ifndef BLACKBOARD_LISTENER_THREAD_H 21 #define BLACKBOARD_LISTENER_THREAD_H 23 #include "externals/blackboard.h" 25 #include <aspect/blackboard.h> 26 #include <aspect/configurable.h> 27 #include <aspect/logging.h> 28 #include <core/threading/mutex.h> 29 #include <core/threading/thread.h> 30 #include <libs/blackboard/interface_listener.h> 31 #include <libs/blackboard/interface_observer.h> 33 #include <eclipseclass.h> 47 using string = std::string;
49 using queue = std::queue<T>;
51 using shared_ptr = std::shared_ptr<T>;
52 template <
class T1,
class T2>
53 using map = std::map<T1, T2>;
60 void observe_pattern(
const char *type_pattern,
const char *id_pattern) noexcept;
87 virtual operator EC_word() = 0;
111 virtual operator EC_word();
119 virtual operator EC_word();
133 virtual operator EC_word();
147 map<string, fawkes::Interface *> last_iface_of_type_;
148 queue<shared_ptr<Event>> iface_events_;
151 #endif // BLACKBOARD_LISTENER_THREAD_H Thread aspect to access to BlackBoard.
std::string uid()
Return the UID (i.e.
void observe_pattern(const char *type_pattern, const char *id_pattern) noexcept
Trigger events if an interface matching the pattern is created or destroyed.
Thread class encapsulation of pthreads.
Base class for all Fawkes BlackBoard interfaces.
An interface was destroyed.
bool event_pending()
Test whether any events are in the queue.
Keeps a queue of subscribed blackboard events that can be queried in a thread-safe manner.
string id
Triggering interface's ID.
shared_ptr< Event > event_pop()
Return and remove the next event in the queue.
virtual void bb_interface_destroyed(const char *type, const char *id) noexcept override
Called by the BlackBoardInterfaceObserver when an interface is destroyed.
Changed(Interface *interface)
Constructor.
Thread aspect to log output.
BlackBoard interface observer.
void listen_for_change(Interface *interface) noexcept
Register.
Thread aspect to access configuration data.
string type
Triggering interface's type name.
static void cleanup_instance()
Delete singleton instance, e.g.
virtual void bb_interface_created(const char *type, const char *id) noexcept override
Called by the BlackBoardInterfaceObserver when an interface matching a subscribed pattern is created.
Abstract superclass for blackboard events.
virtual void bb_interface_data_changed(Interface *interface) noexcept override
Called by the BlackBoardInterfaceListener when an interface changes.
static BlackboardListenerThread * instance()
Get the singleton instance of this thread.
Mutex mutual exclusion lock.
Event(const std::string &type, const std::string &id)
Constructor.
A new interface was created.
BlackBoard interface listener.