Fawkes API Fawkes Development Version
|
BlackBoard notifier. More...
#include <>>
Public Member Functions | |
BlackBoardNotifier () | |
Constructor. More... | |
virtual | ~BlackBoardNotifier () |
Destructor. More... | |
void | register_listener (BlackBoardInterfaceListener *listener, BlackBoard::ListenerRegisterFlag flag) |
Register BB event listener. More... | |
void | update_listener (BlackBoardInterfaceListener *listener, BlackBoard::ListenerRegisterFlag flag) |
Update BB event listener. More... | |
void | unregister_listener (BlackBoardInterfaceListener *listener) |
Unregister BB interface listener. More... | |
void | register_observer (BlackBoardInterfaceObserver *observer) |
Register BB interface observer. More... | |
void | unregister_observer (BlackBoardInterfaceObserver *observer) |
Unregister BB interface observer. More... | |
void | notify_of_data_refresh (const Interface *interface, bool has_changed) |
Notify of data change. More... | |
bool | notify_of_message_received (const Interface *interface, Message *message) |
Notify of message received Notify all subscribers of the given interface of an incoming message This also influences logging and sending data over the network so it is mandatory to call this function! The interface base class write method does that for you. More... | |
void | notify_of_interface_created (const char *type, const char *id) noexcept |
Notify that an interface has been created. More... | |
void | notify_of_interface_destroyed (const char *type, const char *id) noexcept |
Notify that an interface has been destroyed. More... | |
void | notify_of_writer_added (const Interface *interface, Uuid event_instance_serial) noexcept |
Notify that writer has been added. More... | |
void | notify_of_writer_removed (const Interface *interface, Uuid event_instance_serial) noexcept |
Notify that writer has been removed. More... | |
void | notify_of_reader_added (const Interface *interface, Uuid event_instance_serial) noexcept |
Notify that reader has been added. More... | |
void | notify_of_reader_removed (const Interface *interface, Uuid event_instance_serial) noexcept |
Notify that reader has been removed. More... | |
BlackBoard notifier.
This class is used by the BlackBoard to notify listeners and observers of changes.
Definition at line 43 of file notifier.h.
fawkes::BlackBoardNotifier::BlackBoardNotifier | ( | ) |
Constructor.
Definition at line 52 of file notifier.cpp.
|
virtual |
Destructor.
Definition at line 71 of file notifier.cpp.
void fawkes::BlackBoardNotifier::notify_of_data_refresh | ( | const Interface * | interface, |
bool | has_changed | ||
) |
Notify of data change.
Notify all subscribers of the given interface of a data change. This also influences logging and sending data over the network so it is mandatory to call this function! The interface base class write method does that for you.
interface | interface whose subscribers to notify |
has_changed | whether the current data is different from the last time write() was called on the interface |
Definition at line 689 of file notifier.cpp.
References fawkes::BlackBoardInterfaceListener::bb_interface_data_changed(), fawkes::BlackBoardInterfaceListener::bb_interface_data_refreshed(), fawkes::BlackBoardInterfaceListener::bbil_data_interface(), fawkes::BlackBoardInterfaceListener::bbil_name(), fawkes::Mutex::lock(), fawkes::LibLogger::log_warn(), fawkes::Interface::uid(), and fawkes::Mutex::unlock().
Referenced by fawkes::BlackBoardInterfaceManager::notify_of_data_refresh(), and fawkes::BlackBoardInterfaceProxy::process_data_refreshed().
|
noexcept |
Notify that an interface has been created.
type | type of the interface |
id | ID of the interface |
Definition at line 401 of file notifier.cpp.
References fawkes::BlackBoardInterfaceObserver::bb_interface_created().
Referenced by fawkes::BlackBoardInterfaceManager::open_for_reading(), and fawkes::BlackBoardInterfaceManager::open_for_writing().
|
noexcept |
Notify that an interface has been destroyed.
type | type of the interface |
id | ID of the interface |
Definition at line 436 of file notifier.cpp.
References fawkes::BlackBoardInterfaceObserver::bb_interface_destroyed().
Referenced by fawkes::BlackBoardInterfaceManager::close().
bool fawkes::BlackBoardNotifier::notify_of_message_received | ( | const Interface * | interface, |
Message * | message | ||
) |
Notify of message received Notify all subscribers of the given interface of an incoming message This also influences logging and sending data over the network so it is mandatory to call this function! The interface base class write method does that for you.
interface | interface whose subscribers to notify |
message | message which is being received |
Definition at line 744 of file notifier.cpp.
References fawkes::BlackBoardInterfaceListener::bb_interface_message_received(), fawkes::BlackBoardInterfaceListener::bbil_message_interface(), fawkes::BlackBoardInterfaceListener::bbil_name(), fawkes::Mutex::lock(), fawkes::LibLogger::log_warn(), fawkes::Interface::uid(), and fawkes::Mutex::unlock().
Referenced by fawkes::BlackBoardInterfaceProxy::process_interface_message(), and fawkes::BlackBoardMessageManager::transmit().
|
noexcept |
Notify that reader has been added.
interface | interface for which the reader has been added |
event_instance_serial | instance serial of the interface that caused the event |
Definition at line 589 of file notifier.cpp.
References fawkes::BlackBoardInterfaceListener::bb_interface_reader_added(), fawkes::BlackBoardInterfaceListener::bbil_name(), fawkes::BlackBoardInterfaceListener::bbil_reader_interface(), and fawkes::LibLogger::log_warn().
Referenced by fawkes::BlackBoardInterfaceManager::open_for_reading(), fawkes::BlackBoardInterfaceManager::open_multiple_for_reading(), and fawkes::BlackBoardInterfaceProxy::reader_added().
|
noexcept |
Notify that reader has been removed.
interface | interface for which the reader has been removed |
event_instance_serial | instance serial of the interface that caused the event |
Definition at line 626 of file notifier.cpp.
References fawkes::BlackBoardInterfaceListener::bb_interface_reader_removed(), fawkes::BlackBoardInterfaceListener::bbil_name(), fawkes::BlackBoardInterfaceListener::bbil_reader_interface(), and fawkes::LibLogger::log_warn().
Referenced by fawkes::BlackBoardInterfaceManager::close(), and fawkes::BlackBoardInterfaceProxy::reader_removed().
|
noexcept |
Notify that writer has been added.
interface | the interface for which the event happened. It is not necessarily the instance which caused the event, but it must have the same mem serial. |
event_instance_serial | the instance serial of the interface that caused the event |
Definition at line 495 of file notifier.cpp.
References fawkes::BlackBoardInterfaceListener::bb_interface_writer_added(), fawkes::BlackBoardInterfaceListener::bbil_name(), fawkes::BlackBoardInterfaceListener::bbil_writer_interface(), and fawkes::LibLogger::log_warn().
Referenced by fawkes::BlackBoardInterfaceManager::open_for_writing(), and fawkes::BlackBoardInterfaceProxy::writer_added().
|
noexcept |
Notify that writer has been removed.
interface | interface for which the writer has been removed |
event_instance_serial | instance serial of the interface that caused the event |
Definition at line 532 of file notifier.cpp.
References fawkes::BlackBoardInterfaceListener::bb_interface_writer_removed(), fawkes::BlackBoardInterfaceListener::bbil_name(), fawkes::BlackBoardInterfaceListener::bbil_writer_interface(), and fawkes::LibLogger::log_warn().
Referenced by fawkes::BlackBoardInterfaceManager::close(), and fawkes::BlackBoardInterfaceProxy::writer_removed().
void fawkes::BlackBoardNotifier::register_listener | ( | BlackBoardInterfaceListener * | listener, |
BlackBoard::ListenerRegisterFlag | flag | ||
) |
Register BB event listener.
listener | BlackBoard event listener to register |
flag | concatenation of flags denoting which queue entries should be processed |
Definition at line 87 of file notifier.cpp.
References update_listener().
Referenced by fawkes::BlackBoard::register_listener().
void fawkes::BlackBoardNotifier::register_observer | ( | BlackBoardInterfaceObserver * | observer | ) |
Register BB interface observer.
observer | BlackBoard interface observer to register |
Definition at line 313 of file notifier.cpp.
References fawkes::BlackBoardInterfaceObserver::bbio_get_observed_create(), fawkes::BlackBoardInterfaceObserver::bbio_get_observed_destroy(), fawkes::Mutex::lock(), and fawkes::Mutex::unlock().
Referenced by fawkes::BlackBoard::register_observer().
void fawkes::BlackBoardNotifier::unregister_listener | ( | BlackBoardInterfaceListener * | listener | ) |
Unregister BB interface listener.
This will remove the given BlackBoard interface listener from any event that it was previously registered for.
listener | BlackBoard event listener to remove |
Definition at line 198 of file notifier.cpp.
References fawkes::BlackBoardInterfaceListener::InterfaceMaps::data, fawkes::BlackBoardInterfaceListener::InterfaceMaps::messages, fawkes::BlackBoardInterfaceListener::InterfaceMaps::reader, and fawkes::BlackBoardInterfaceListener::InterfaceMaps::writer.
Referenced by fawkes::BlackBoard::unregister_listener().
void fawkes::BlackBoardNotifier::unregister_observer | ( | BlackBoardInterfaceObserver * | observer | ) |
Unregister BB interface observer.
This will remove the given BlackBoard event listener from any event that it was previously registered for.
observer | BlackBoard event listener to remove |
Definition at line 373 of file notifier.cpp.
Referenced by fawkes::BlackBoard::unregister_observer().
void fawkes::BlackBoardNotifier::update_listener | ( | BlackBoardInterfaceListener * | listener, |
BlackBoard::ListenerRegisterFlag | flag | ||
) |
Update BB event listener.
listener | BlackBoard event listener to update subscriptions of |
flag | concatenation of flags denoting which queue entries should be processed |
Definition at line 99 of file notifier.cpp.
References fawkes::BlackBoard::BBIL_FLAG_DATA, fawkes::BlackBoard::BBIL_FLAG_MESSAGES, fawkes::BlackBoard::BBIL_FLAG_READER, fawkes::BlackBoard::BBIL_FLAG_WRITER, fawkes::BlackBoardInterfaceListener::DATA, fawkes::BlackBoardInterfaceListener::MESSAGES, fawkes::BlackBoardInterfaceListener::READER, and fawkes::BlackBoardInterfaceListener::WRITER.
Referenced by register_listener(), and fawkes::BlackBoard::update_listener().