fawkes::BlackBoardInterfaceManager Class Reference

BlackBoard interface manager. More...

#include <blackboard/internal/interface_manager.h>

Inheritance diagram for fawkes::BlackBoardInterfaceManager:

[legend]
List of all members.

Public Member Functions

 BlackBoardInterfaceManager (BlackBoardMemoryManager *bb_memmgr, BlackBoardMessageManager *bb_msgmgr, BlackBoardNotifier *bb_notifier)
 Constructor.
virtual ~BlackBoardInterfaceManager ()
 Destructor.
Interfaceopen_for_reading (const char *interface_type, const char *identifier)
 Open interface for reading.
Interfaceopen_for_writing (const char *interface_type, const char *identifier)
 Open interface for writing.
void close (Interface *interface)
 Close interface.
InterfaceInfoListlist_all () const
 Get a list of interfaces.
std::list< Interface * > open_multiple_for_reading (const char *interface_type, const char *id_pattern="*")
 Open all interfaces of the given type for reading.
virtual bool exists_writer (const Interface *interface) const
 Check if a writer exists for the given interface.
virtual unsigned int num_readers (const Interface *interface) const
 Get number of readers.
virtual void notify_of_data_change (const Interface *interface)
 Notify of data change.

Friends

class BlackBoardMessageManager

Detailed Description

BlackBoard interface manager.

This class is used by the BlackBoard to manage interfaces stored in the shared memory.

Author:
Tim Niemueller

Definition at line 47 of file interface_manager.h.


Constructor & Destructor Documentation

fawkes::BlackBoardInterfaceManager::BlackBoardInterfaceManager ( BlackBoardMemoryManager bb_memmgr,
BlackBoardMessageManager bb_msgmgr,
BlackBoardNotifier bb_notifier 
)

Constructor.

The shared memory segment is created with data from bbconfig.h.

Parameters:
bb_memmgr BlackBoard memory manager to use
bb_msgmgr BlackBoard message manager to use
bb_notifier BlackBoard notifier to all for events
See also:
bbconfig.h

Definition at line 67 of file interface_manager.cpp.

fawkes::BlackBoardInterfaceManager::~BlackBoardInterfaceManager (  )  [virtual]

Destructor.

Definition at line 85 of file interface_manager.cpp.


Member Function Documentation

void fawkes::BlackBoardInterfaceManager::close ( Interface interface  ) 

Close interface.

Parameters:
interface interface to close

Definition at line 439 of file interface_manager.cpp.

References fawkes::Interface::__id, fawkes::Interface::__mem_real_ptr, fawkes::Interface::__mem_serial, fawkes::Interface::__type, fawkes::Interface::__write_access, fawkes::interface_header_t::flag_writer_active, fawkes::BlackBoardMemoryManager::free(), fawkes::Mutex::lock(), fawkes::BlackBoardNotifier::notify_of_interface_destroyed(), fawkes::BlackBoardNotifier::notify_of_reader_removed(), fawkes::BlackBoardNotifier::notify_of_writer_removed(), fawkes::interface_header_t::num_readers, fawkes::interface_header_t::refcount, fawkes::Interface::serial(), and fawkes::Mutex::unlock().

Referenced by fawkes::LocalBlackBoard::close().

bool fawkes::BlackBoardInterfaceManager::exists_writer ( const Interface interface  )  const [virtual]

Check if a writer exists for the given interface.

Parameters:
interface interface to check
Returns:
true, if there is any writer for the given interface, false otherwise

Implements fawkes::InterfaceMediator.

Definition at line 529 of file interface_manager.cpp.

References fawkes::Interface::__mem_serial.

InterfaceInfoList * fawkes::BlackBoardInterfaceManager::list_all (  )  const

Get a list of interfaces.

Returns:
list of currently existing interfaces. List may be outdated on return since there maybe concurrent actions.

Definition at line 485 of file interface_manager.cpp.

References fawkes::InterfaceInfoList::append(), fawkes::BlackBoardMemoryManager::begin(), fawkes::BlackBoardMemoryManager::end(), fawkes::interface_header_t::flag_writer_active, fawkes::interface_header_t::hash, fawkes::interface_header_t::id, fawkes::BlackBoardMemoryManager::lock(), fawkes::interface_header_t::num_readers, fawkes::interface_header_t::serial, fawkes::interface_header_t::type, and fawkes::BlackBoardMemoryManager::unlock().

Referenced by fawkes::LocalBlackBoard::list_all().

void fawkes::BlackBoardInterfaceManager::notify_of_data_change ( const Interface interface  )  [virtual]

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.

Parameters:
interface interface whose subscribers to notify
See also:
Interface::write()

Implements fawkes::InterfaceMediator.

Definition at line 522 of file interface_manager.cpp.

References fawkes::BlackBoardNotifier::notify_of_data_change().

unsigned int fawkes::BlackBoardInterfaceManager::num_readers ( const Interface interface  )  const [virtual]

Get number of readers.

Get the number of readers that the given interface has.

Parameters:
interface interface to check
Returns:
number of readers currently registered for the given interface.

Implements fawkes::InterfaceMediator.

Definition at line 536 of file interface_manager.cpp.

References fawkes::Interface::__mem_real_ptr, and fawkes::interface_header_t::num_readers.

Interface * fawkes::BlackBoardInterfaceManager::open_for_reading ( const char *  type,
const char *  identifier 
)

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:
type type of the interface
identifier identifier of the interface
Returns:
new fully initialized interface instance of requested type
Exceptions:
OutOfMemoryException thrown if there is not enough free space for the requested interface.

Definition at line 239 of file interface_manager.cpp.

References fawkes::interface_header_t::hash, fawkes::Interface::hash(), fawkes::Interface::hash_size(), fawkes::BlackBoardMemoryManager::lock(), fawkes::Mutex::lock(), fawkes::BlackBoardNotifier::notify_of_interface_created(), fawkes::BlackBoardNotifier::notify_of_reader_added(), fawkes::interface_header_t::num_readers, fawkes::interface_header_t::refcount, fawkes::Interface::serial(), fawkes::interface_header_t::serial, fawkes::Interface::set_memory(), fawkes::Interface::set_readwrite(), fawkes::Mutex::unlock(), and fawkes::BlackBoardMemoryManager::unlock().

Referenced by fawkes::LocalBlackBoard::open_for_reading().

Interface * fawkes::BlackBoardInterfaceManager::open_for_writing ( const char *  type,
const char *  identifier 
)

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:
type type of the interface
identifier identifier of the interface
Returns:
new fully initialized interface instance of requested type
Exceptions:
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

Definition at line 378 of file interface_manager.cpp.

References fawkes::interface_header_t::flag_writer_active, fawkes::interface_header_t::hash, fawkes::Interface::hash(), fawkes::Interface::hash_size(), fawkes::BlackBoardMemoryManager::lock(), fawkes::Mutex::lock(), fawkes::BlackBoardNotifier::notify_of_interface_created(), fawkes::BlackBoardNotifier::notify_of_writer_added(), fawkes::interface_header_t::refcount, fawkes::Interface::serial(), fawkes::interface_header_t::serial, fawkes::Interface::set_memory(), fawkes::Interface::set_readwrite(), fawkes::Mutex::unlock(), and fawkes::BlackBoardMemoryManager::unlock().

Referenced by fawkes::LocalBlackBoard::open_for_writing().

std::list< Interface * > fawkes::BlackBoardInterfaceManager::open_multiple_for_reading ( const char *  type,
const char *  id_pattern = "*" 
)

Open all interfaces of the given type for reading.

This will create interface instances for all currently registered interfaces of the given type. The result can be casted to the appropriate type.

Parameters:
type type of the interface
id_pattern pattern of interface IDs to open, supports wildcards similar to filenames (*, ?, []), see "man fnmatch" for all supported.
Returns:
list of new fully initialized interface instances of requested type. The is allocated using new and you have to free it using delete after you are done with it!

Definition at line 302 of file interface_manager.cpp.

References fawkes::BlackBoardMemoryManager::begin(), fawkes::BlackBoardMemoryManager::end(), fawkes::interface_header_t::hash, fawkes::Interface::hash(), fawkes::Interface::hash_size(), fawkes::interface_header_t::id, fawkes::BlackBoardMemoryManager::lock(), fawkes::Mutex::lock(), fawkes::BlackBoardNotifier::notify_of_reader_added(), fawkes::interface_header_t::num_readers, fawkes::interface_header_t::refcount, fawkes::interface_header_t::serial, fawkes::Interface::set_memory(), fawkes::Interface::set_readwrite(), fawkes::interface_header_t::type, fawkes::BlackBoardMemoryManager::unlock(), and fawkes::Mutex::unlock().

Referenced by fawkes::LocalBlackBoard::open_multiple_for_reading().


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:31:37 2011 for Fawkes API by  doxygen 1.4.7