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_;
Changed(Interface *interface)
Constructor.
A new interface was created.
An interface was destroyed.
Abstract superclass for blackboard events.
std::string uid()
Return the UID (i.e.
string type
Triggering interface's type name.
Event(const std::string &type, const std::string &id)
Constructor.
string id
Triggering interface's ID.
Keeps a queue of subscribed blackboard events that can be queried in a thread-safe manner.
virtual void bb_interface_data_changed(Interface *interface) noexcept override
Called by the BlackBoardInterfaceListener when an interface changes.
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.
static void cleanup_instance()
Delete singleton instance, e.g.
bool event_pending()
Test whether any events are in the queue.
static BlackboardListenerThread * instance()
Get the singleton instance of this thread.
virtual void bb_interface_destroyed(const char *type, const char *id) noexcept override
Called by the BlackBoardInterfaceObserver when an interface is destroyed.
shared_ptr< Event > event_pop()
Return and remove the next event in the queue.
void listen_for_change(Interface *interface) noexcept
Register.
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 aspect to access to BlackBoard.
BlackBoard interface listener.
BlackBoard interface observer.
Thread aspect to access configuration data.
Base class for all Fawkes BlackBoard interfaces.
Thread aspect to log output.
Mutex mutual exclusion lock.
Thread class encapsulation of pthreads.