Fawkes API
Fawkes Development Version
|
Local BlackBoard. More...
#include <>>
Public Member Functions | |
LocalBlackBoard (size_t memsize) | |
Heap Memory Constructor. More... | |
LocalBlackBoard (size_t memsize, const char *magic_token, bool master=true) | |
Shared Memory Constructor. More... | |
virtual | ~LocalBlackBoard () |
Destructor. More... | |
virtual Interface * | open_for_reading (const char *interface_type, const char *identifier, const char *owner=NULL) |
Open interface for reading. More... | |
virtual Interface * | open_for_writing (const char *interface_type, const char *identifier, const char *owner=NULL) |
Open interface for writing. More... | |
virtual void | close (Interface *interface) |
Close interface. More... | |
virtual InterfaceInfoList * | list_all () |
Get list of all currently existing interfaces. More... | |
virtual InterfaceInfoList * | list (const char *type_pattern, const char *id_pattern) |
Get list of interfaces matching type and ID patterns. More... | |
virtual bool | is_alive () const throw () |
Check if the BlackBoard is still alive. More... | |
virtual bool | try_aliveness_restore () throw () |
Try to restore the aliveness of the BlackBoard instance. More... | |
virtual std::list< Interface * > | open_multiple_for_reading (const char *type_pattern, const char *id_pattern="*", const char *owner=NULL) |
Open multiple interfaces for reading. More... | |
virtual void | start_nethandler (FawkesNetworkHub *hub) |
Start network handler. More... | |
const BlackBoardMemoryManager * | memory_manager () const |
Get memory manager. More... | |
![]() | |
virtual | ~BlackBoard () |
Destructor. More... | |
virtual Interface * | open_for_reading_f (const char *interface_type, const char *identifier,...) |
Open interface for reading with identifier format string. More... | |
virtual Interface * | open_for_writing_f (const char *interface_type, const char *identifier,...) |
Open interface for writing with identifier format string. More... | |
template<class InterfaceType > | |
std::list< InterfaceType * > | open_multiple_for_reading (const char *id_pattern="*", const char *owner=NULL) |
Open all interfaces of given type for reading. More... | |
template<class InterfaceType > | |
InterfaceType * | open_for_reading (const char *identifier, const char *owner=NULL) |
Get interface of given type. More... | |
template<class InterfaceType > | |
InterfaceType * | open_for_writing (const char *identifier, const char *owner=NULL) |
Get writer interface of given type. More... | |
template<class InterfaceType > | |
InterfaceType * | open_for_reading_f (const char *identifier,...) |
Get interface of given type with identifier format string. More... | |
template<class InterfaceType > | |
InterfaceType * | open_for_writing_f (const char *identifier,...) |
Get writer interface of given type with identifier format string. More... | |
virtual void | register_listener (BlackBoardInterfaceListener *listener, ListenerRegisterFlag flag=BBIL_FLAG_ALL) |
Register BB event listener. More... | |
virtual void | update_listener (BlackBoardInterfaceListener *listener, ListenerRegisterFlag flag=BBIL_FLAG_ALL) |
Update BB event listener. More... | |
virtual void | unregister_listener (BlackBoardInterfaceListener *listener) |
Unregister BB interface listener. More... | |
virtual void | register_observer (BlackBoardInterfaceObserver *observer) |
Register BB interface observer. More... | |
virtual void | unregister_observer (BlackBoardInterfaceObserver *observer) |
Unregister BB interface observer. More... | |
std::string | demangle_fawkes_interface_name (const char *type) |
Produce interface name from C++ signature. More... | |
std::string | format_identifier (const char *identifier_format, va_list arg) |
Get formatted identifier string. More... | |
Static Public Member Functions | |
static void | cleanup (const char *magic_token, bool use_lister=false) |
Cleanup orphaned BlackBoard segments. More... | |
Additional Inherited Members | |
![]() | |
enum | ListenerRegisterFlag { BBIL_FLAG_DATA = 1, BBIL_FLAG_MESSAGES = 2, BBIL_FLAG_READER = 4, BBIL_FLAG_WRITER = 8, BBIL_FLAG_ALL = 15 } |
Flags to constrain listener registration/updates. More... | |
![]() | |
BlackBoard (bool create_notifier=true) | |
Constructor. More... | |
![]() | |
BlackBoardNotifier * | __notifier |
Notifier for BB events. More... | |
fawkes::LocalBlackBoard::LocalBlackBoard | ( | size_t | memsize | ) |
Heap Memory Constructor.
memsize | size of memory in bytes |
Definition at line 73 of file local.cpp.
References fawkes::BlackBoard::__notifier.
fawkes::LocalBlackBoard::LocalBlackBoard | ( | size_t | memsize, |
const char * | magic_token, | ||
bool | master = true |
||
) |
Shared Memory Constructor.
memsize | size of memory in bytes |
magic_token | magic token used for shared memory segment |
master | true to operate in master mode, false otherwise |
Definition at line 56 of file local.cpp.
References fawkes::BlackBoard::__notifier.
|
virtual |
Destructor.
Definition at line 87 of file local.cpp.
References fawkes::Thread::cancel(), and fawkes::Thread::join().
|
static |
Cleanup orphaned BlackBoard segments.
This erase orphaned shared memory segments that belonged to a BlackBoard.
magic_token | magic token of shared memory segments |
use_lister | true to use a lister with console output |
Definition at line 177 of file local.cpp.
References fawkes::SharedMemory::erase_orphaned().
|
virtual |
Close interface.
interface | interface to close |
Implements fawkes::BlackBoard.
Definition at line 136 of file local.cpp.
References fawkes::BlackBoardInterfaceManager::close().
|
virtual |
Check if the BlackBoard is still alive.
Implements fawkes::BlackBoard.
|
virtual |
Get list of interfaces matching type and ID patterns.
See the fnmatch() documentation for possible patterns.
type_pattern | pattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface type. |
id_pattern | pattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface ID. |
Implements fawkes::BlackBoard.
Definition at line 150 of file local.cpp.
References fawkes::BlackBoardInterfaceManager::list().
|
virtual |
Get list of all currently existing interfaces.
Implements fawkes::BlackBoard.
Definition at line 143 of file local.cpp.
References fawkes::BlackBoardInterfaceManager::list_all().
const BlackBoardMemoryManager * fawkes::LocalBlackBoard::memory_manager | ( | ) | const |
Get memory manager.
CAUTION: This is NOT meant to be used in your application. This returns a pointer to the used memory manager. The return type is declared const. Use this only for debugging purposes to output info about the BlackBoard memory.
|
virtual |
Open interface for reading.
This will create a new interface instance of the given type. The result can be casted to the appropriate type.
type | type of the interface |
identifier | identifier of the interface |
owner | name of entity which opened this interface. If using the BlackBoardAspect to access the blackboard leave this untouched unless you have a good reason. |
OutOfMemoryException | thrown if there is not enough free space for the requested interface. |
Implements fawkes::BlackBoard.
Definition at line 101 of file local.cpp.
References fawkes::BlackBoardInterfaceManager::open_for_reading().
|
virtual |
Open interface for writing.
This will create a new interface instance of the given type. The result can be casted to the appropriate type. This will only succeed if there is not already a writer for the given interface type/id!
type | type of the interface |
identifier | identifier of the interface |
owner | name of entity which opened this interface. If using the BlackBoardAspect to access the blackboard leave this untouched unless you have a good reason. |
OutOfMemoryException | thrown if there is not enough free space for the requested interface. |
BlackBoardWriterActiveException | thrown if there is already a writing instance with the same type/id |
Implements fawkes::BlackBoard.
Definition at line 112 of file local.cpp.
References fawkes::BlackBoardInterfaceManager::open_for_writing().
|
virtual |
Open multiple interfaces for reading.
This will create interface instances for currently registered interfaces of the given type that match the given ID pattern. The result can be casted to the appropriate type.
type_pattern | pattern of interface types to open, supports wildcards similar to filenames (*, ?, []), see "man fnmatch" for all supported. |
id_pattern | pattern of interface IDs to open, supports wildcards similar to filenames (*, ?, []), see "man fnmatch" for all supported. |
owner | name of entity which opened this interface. If using the BlackBoardAspect to access the blackboard leave this untouched unless you have a good reason. |
Implements fawkes::BlackBoard.
Definition at line 123 of file local.cpp.
References fawkes::BlackBoardInterfaceManager::open_multiple_for_reading().
|
virtual |
Start network handler.
This will start the network handler thread and register it with the given hub.
hub | hub to use and to register with |
Definition at line 209 of file local.cpp.
References fawkes::Thread::start().
|
virtual |
Try to restore the aliveness of the BlackBoard instance.
Note that even though the aliveness of the BlackBoard is restored single interfaces may still be invalid. That can for instance happen if a remote connection is re-established and a writer has been created during the downtime and an own writer instance of that very interface cannot be restored.
Implements fawkes::BlackBoard.