20 #include "blackboard_listener_thread.h" 22 #include <core/threading/mutex_locker.h> 29 BlackboardListenerThread::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();
118 shared_ptr<BlackboardListenerThread::Event>
122 shared_ptr<BlackboardListenerThread::Event> rv = iface_events_.front();
130 BlackboardListenerThread::Created::operator EC_word()
132 return ::term(EC_functor(
"bb_created", 1), uid().c_str());
138 BlackboardListenerThread::Destroyed::operator EC_word()
140 return ::term(EC_functor(
"bb_destroyed", 1), uid().c_str());
146 BlackboardListenerThread::Changed::operator EC_word()
148 return ::term(EC_functor(
"bb_changed", 1), uid().c_str());
Fawkes library namespace.
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.
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.
void listen_for_change(Interface *interface) noexcept
Register.
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.
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.
A new interface was created.
BlackBoard interface listener.