Fawkes API  Fawkes Development Version
fawkes::BlackBoardWithOwnership Class Reference

BlackBoard that traces interface ownership. More...

#include <>>

Inheritance diagram for fawkes::BlackBoardWithOwnership:

Public Member Functions

 BlackBoardWithOwnership (BlackBoard *parent, const char *owner)
 Constructor. More...
 
virtual ~BlackBoardWithOwnership ()
 Destructor. More...
 
virtual Interfaceopen_for_reading (const char *interface_type, const char *identifier, const char *owner=NULL)
 Open interface for reading. More...
 
virtual Interfaceopen_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 InterfaceInfoListlist_all ()
 Get list of all currently existing interfaces. More...
 
virtual InterfaceInfoListlist (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 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...
 
- Public Member Functions inherited from fawkes::BlackBoard
virtual ~BlackBoard ()
 Destructor. More...
 
virtual Interfaceopen_for_reading_f (const char *interface_type, const char *identifier,...)
 Open interface for reading with identifier format string. More...
 
virtual Interfaceopen_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...
 
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...
 

Additional Inherited Members

- Public Types inherited from fawkes::BlackBoard
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...
 
- Protected Member Functions inherited from fawkes::BlackBoard
 BlackBoard (bool create_notifier=true)
 Constructor. More...
 
- Protected Attributes inherited from fawkes::BlackBoard
BlackBoardNotifier__notifier
 Notifier for BB events. More...
 

Detailed Description

BlackBoard that traces interface ownership.

See also
Interface
Message
Author
Tim Niemueller

Definition at line 34 of file ownership.h.

Constructor & Destructor Documentation

◆ BlackBoardWithOwnership()

fawkes::BlackBoardWithOwnership::BlackBoardWithOwnership ( fawkes::BlackBoard parent,
const char *  owner 
)

Constructor.

Parameters
parentparent blackboard to use as actual blackboard
ownerowner name to record in newly created interfaces

Definition at line 47 of file ownership.cpp.

◆ ~BlackBoardWithOwnership()

fawkes::BlackBoardWithOwnership::~BlackBoardWithOwnership ( )
virtual

Destructor.

Definition at line 60 of file ownership.cpp.

Member Function Documentation

◆ close()

void fawkes::BlackBoardWithOwnership::close ( Interface interface)
virtual

Close interface.

Parameters
interfaceinterface to close

Implements fawkes::BlackBoard.

Definition at line 92 of file ownership.cpp.

References fawkes::BlackBoard::close().

◆ is_alive()

bool fawkes::BlackBoardWithOwnership::is_alive ( ) const
throw (
)
virtual

Check if the BlackBoard is still alive.

Returns
true, if the BlackBoard is still alive and may be used, false otherwise.

Implements fawkes::BlackBoard.

Definition at line 113 of file ownership.cpp.

References fawkes::BlackBoard::is_alive().

◆ list()

InterfaceInfoList * fawkes::BlackBoardWithOwnership::list ( const char *  type_pattern,
const char *  id_pattern 
)
virtual

Get list of interfaces matching type and ID patterns.

See the fnmatch() documentation for possible patterns.

Parameters
type_patternpattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface type.
id_patternpattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface ID.
Returns
list of interfaces

Implements fawkes::BlackBoard.

Definition at line 106 of file ownership.cpp.

References fawkes::BlackBoard::list().

◆ list_all()

InterfaceInfoList * fawkes::BlackBoardWithOwnership::list_all ( )
virtual

Get list of all currently existing interfaces.

Returns
list of interfaces

Implements fawkes::BlackBoard.

Definition at line 99 of file ownership.cpp.

References fawkes::BlackBoard::list_all().

◆ open_for_reading()

Interface * fawkes::BlackBoardWithOwnership::open_for_reading ( const char *  type,
const char *  identifier,
const char *  owner = NULL 
)
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.

Parameters
typetype of the interface
identifieridentifier of the interface
ownername of entity which opened this interface. If using the BlackBoardAspect to access the blackboard leave this untouched unless you have a good reason.
Returns
new fully initialized interface instance of requested type
Exceptions
OutOfMemoryExceptionthrown if there is not enough free space for the requested interface.

Implements fawkes::BlackBoard.

Definition at line 66 of file ownership.cpp.

References fawkes::BlackBoard::open_for_reading().

◆ open_for_writing()

Interface * fawkes::BlackBoardWithOwnership::open_for_writing ( const char *  type,
const char *  identifier,
const char *  owner = NULL 
)
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!

Parameters
typetype of the interface
identifieridentifier of the interface
ownername of entity which opened this interface. If using the BlackBoardAspect to access the blackboard leave this untouched unless you have a good reason.
Returns
new fully initialized interface instance of requested type
Exceptions
OutOfMemoryExceptionthrown if there is not enough free space for the requested interface.
BlackBoardWriterActiveExceptionthrown if there is already a writing instance with the same type/id

Implements fawkes::BlackBoard.

Definition at line 74 of file ownership.cpp.

References fawkes::BlackBoard::open_for_writing().

◆ open_multiple_for_reading()

std::list< Interface * > fawkes::BlackBoardWithOwnership::open_multiple_for_reading ( const char *  type_pattern,
const char *  id_pattern = "*",
const char *  owner = NULL 
)
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.

Parameters
type_patternpattern of interface types to open, supports wildcards similar to filenames (*, ?, []), see "man fnmatch" for all supported.
id_patternpattern of interface IDs to open, supports wildcards similar to filenames (*, ?, []), see "man fnmatch" for all supported.
ownername of entity which opened this interface. If using the BlackBoardAspect to access the blackboard leave this untouched unless you have a good reason.
Returns
list of new fully initialized interface instances of requested type. You have to close all interfaces on your own when done with the list!

Implements fawkes::BlackBoard.

Definition at line 82 of file ownership.cpp.

References fawkes::BlackBoard::open_multiple_for_reading().

◆ register_listener()

void fawkes::BlackBoardWithOwnership::register_listener ( BlackBoardInterfaceListener listener,
ListenerRegisterFlag  flag = BBIL_FLAG_ALL 
)
virtual

Register BB event listener.

Parameters
listenerBlackBoard event listener to register
flagflags what to register for

Reimplemented from fawkes::BlackBoard.

Definition at line 126 of file ownership.cpp.

References fawkes::BlackBoard::register_listener().

◆ register_observer()

void fawkes::BlackBoardWithOwnership::register_observer ( BlackBoardInterfaceObserver observer)
virtual

Register BB interface observer.

Parameters
observerBlackBoard interface observer to register

Reimplemented from fawkes::BlackBoard.

Definition at line 149 of file ownership.cpp.

References fawkes::BlackBoard::register_observer().

◆ try_aliveness_restore()

bool fawkes::BlackBoardWithOwnership::try_aliveness_restore ( )
throw (
)
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.

Returns
true if the aliveness could be restored and the BlackBoard is operational again, false otherwise.

Implements fawkes::BlackBoard.

Definition at line 120 of file ownership.cpp.

References fawkes::BlackBoard::try_aliveness_restore().

◆ unregister_listener()

void fawkes::BlackBoardWithOwnership::unregister_listener ( BlackBoardInterfaceListener listener)
virtual

Unregister BB interface listener.

This will remove the given BlackBoard interface listener from any event that it was previously registered for.

Parameters
listenerBlackBoard event listener to remove

Reimplemented from fawkes::BlackBoard.

Definition at line 142 of file ownership.cpp.

References fawkes::BlackBoard::unregister_listener().

◆ unregister_observer()

void fawkes::BlackBoardWithOwnership::unregister_observer ( BlackBoardInterfaceObserver observer)
virtual

Unregister BB interface observer.

This will remove the given BlackBoard event listener from any event that it was previously registered for.

Parameters
observerBlackBoard event listener to remove

Reimplemented from fawkes::BlackBoard.

Definition at line 157 of file ownership.cpp.

References fawkes::BlackBoard::unregister_observer().

◆ update_listener()

void fawkes::BlackBoardWithOwnership::update_listener ( BlackBoardInterfaceListener listener,
ListenerRegisterFlag  flag = BBIL_FLAG_ALL 
)
virtual

Update BB event listener.

Parameters
listenerBlackBoard event listener to update
flagflags what to update for

Reimplemented from fawkes::BlackBoard.

Definition at line 133 of file ownership.cpp.

References fawkes::BlackBoard::update_listener().


The documentation for this class was generated from the following files: