20#include "blackboard_listener_thread.h"
22#include <core/threading/mutex_locker.h>
29BlackboardListenerThread::BlackboardListenerThread()
30:
Thread(
"ProtoboardBlackboardManager",
Thread::OPMODE_WAITFORWAKEUP),
61 bbio_add_observed_create(type_pattern, id_pattern);
62 bbio_add_observed_destroy(type_pattern, id_pattern);
70 bbil_add_data_interface(interface);
112 return !iface_events_.empty();
118shared_ptr<BlackboardListenerThread::Event>
122 shared_ptr<BlackboardListenerThread::Event> rv = iface_events_.front();
130BlackboardListenerThread::Created::operator EC_word()
132 return ::term(EC_functor(
"bb_created", 1), uid().c_str());
138BlackboardListenerThread::Destroyed::operator EC_word()
140 return ::term(EC_functor(
"bb_destroyed", 1), uid().c_str());
146BlackboardListenerThread::Changed::operator EC_word()
148 return ::term(EC_functor(
"bb_changed", 1), uid().c_str());
A new interface was created.
An interface was destroyed.
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.
BlackBoard interface listener.
Base class for all Fawkes BlackBoard interfaces.
Thread class encapsulation of pthreads.
Fawkes library namespace.