Fawkes API
Fawkes Development Version
|
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
An interface was destroyed.
string id
Triggering interface's ID.
static BlackboardListenerThread * instance()
Get the singleton instance of this thread.
A new interface was created.
Event(const std::string &type, const std::string &id)
Constructor.
virtual void bb_interface_destroyed(const char *type, const char *id) noexcept override
Called by the BlackBoardInterfaceObserver when an interface is destroyed.
void observe_pattern(const char *type_pattern, const char *id_pattern) noexcept
Trigger events if an interface matching the pattern is created or destroyed.
shared_ptr< Event > event_pop()
Return and remove the next event in the queue.
static void cleanup_instance()
Delete singleton instance, e.g.
Keeps a queue of subscribed blackboard events that can be queried in a thread-safe manner.
Abstract superclass for blackboard events.
string type
Triggering interface's type name.
virtual void bb_interface_data_changed(Interface *interface) noexcept override
Called by the BlackBoardInterfaceListener when an interface changes.
void listen_for_change(Interface *interface) noexcept
Register.
std::string uid()
Return the UID (i.e.
Changed(Interface *interface)
Constructor.
bool event_pending()
Test whether any events are in the queue.
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.