fawkes::BlackBoardNetHandlerInterfaceListener Class Reference

Interface listener for network handler. More...

#include <blackboard/net/interface_listener.h>

Inheritance diagram for fawkes::BlackBoardNetHandlerInterfaceListener:

[legend]
List of all members.

Public Member Functions

 BlackBoardNetHandlerInterfaceListener (BlackBoard *blackboard, Interface *interface, FawkesNetworkHub *hub, unsigned int clid)
 Constructor.
virtual ~BlackBoardNetHandlerInterfaceListener ()
 Destructor.
virtual void bb_interface_data_changed (Interface *interface) throw ()
 BlackBoard data changed notification.
virtual bool bb_interface_message_received (Interface *interface, Message *message) throw ()
 BlackBoard message received notification.
virtual void bb_interface_writer_added (Interface *interface, unsigned int instance_serial) throw ()
 A writing instance has been opened for a watched interface.
virtual void bb_interface_writer_removed (Interface *interface, unsigned int instance_serial) throw ()
 A writing instance has been closed for a watched interface.
virtual void bb_interface_reader_added (Interface *interface, unsigned int instance_serial) throw ()
 A reading instance has been opened for a watched interface.
virtual void bb_interface_reader_removed (Interface *interface, unsigned int instance_serial) throw ()
 A reading instance has been closed for a watched interface.

Detailed Description

Interface listener for network handler.

This class is used by the BlackBoardNetworkHandler to track interface changes and send out notifications timely.

Author:
Tim Niemueller

Definition at line 34 of file interface_listener.h.


Constructor & Destructor Documentation

fawkes::BlackBoardNetHandlerInterfaceListener::BlackBoardNetHandlerInterfaceListener ( BlackBoard blackboard,
Interface interface,
FawkesNetworkHub hub,
unsigned int  clid 
)

Constructor.

Parameters:
blackboard local BlackBoard
interface interface to care about
hub Fawkes network hub to use to send messages
clid client ID of the client which opened this interface

Definition at line 55 of file interface_listener.cpp.

References fawkes::BlackBoardInterfaceListener::bbil_add_data_interface(), fawkes::BlackBoardInterfaceListener::bbil_add_message_interface(), fawkes::BlackBoardInterfaceListener::bbil_add_reader_interface(), fawkes::BlackBoardInterfaceListener::bbil_add_writer_interface(), fawkes::BlackBoard::BBIL_FLAG_ALL, fawkes::Interface::is_writer(), and fawkes::BlackBoard::register_listener().

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

Destructor.

Definition at line 78 of file interface_listener.cpp.

References fawkes::BlackBoard::unregister_listener().


Member Function Documentation

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_data_changed ( Interface interface  )  throw () [virtual]

BlackBoard data changed notification.

This is called whenever the data in an interface that you registered for is modified. This happens if a writer calls the Interface::write() method.

Parameters:
interface interface instance that you supplied to bbil_add_data_interface()

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 85 of file interface_listener.cpp.

References fawkes::bb_idata_msg_t::data_size, fawkes::LibLogger::log_warn(), and fawkes::bb_idata_msg_t::serial.

bool fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_message_received ( Interface interface,
Message message 
) throw () [virtual]

BlackBoard message received notification.

This is called whenever a message is received for this interface. This method is only called for writing instances of an interface, never on reading instances. If you have processed the message already, you can order that the message is not enqueued by returning false. Returning true will enqueue the message as usual. You should only do very (very!) quick tasks directly in this method, as it is out of the regular thread context and can harm performance of other plugins and the system as a whole. Note that if you decide to return false the message is not referenced. If you want to keep it longer you have to ref() it by yourself. An example where this would really make sense is a "STOP" message for the motor, which needs to be processed ASAP and maybe even waiting a couple of miliseconds for the next cycle is not acceptable.

Parameters:
interface interface instance that you supplied to bbil_add_message_interface()
message the message that was sent
Returns:
true to get the message enqueued afterwards as usual, false to prevent queuing of the message.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 108 of file interface_listener.cpp.

References fawkes::bb_imessage_msg_t::data_size, fawkes::bb_imessage_msg_t::hops, fawkes::LibLogger::log_warn(), fawkes::bb_imessage_msg_t::msg_type, fawkes::bb_imessage_msg_t::msgid, and fawkes::bb_imessage_msg_t::serial.

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_reader_added ( Interface interface,
unsigned int  instance_serial 
) throw () [virtual]

A reading instance has been opened for a watched interface.

This is called whenever a reading instance of the interface you are watching is opened.

Parameters:
interface interface instance that you supplied to bbil_add_reader_interface()
instance_serial the instance serial of the reading instance that has just been added.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 170 of file interface_listener.cpp.

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_reader_removed ( Interface interface,
unsigned int  instance_serial 
) throw () [virtual]

A reading instance has been closed for a watched interface.

This is called whenever a reading instance of an interface you are watching is closed.

Parameters:
interface interface instance that you supplied to bbil_add_reader_interface()
instance_serial the instance serial of the reading instance that has just been removed.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 178 of file interface_listener.cpp.

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_writer_added ( Interface interface,
unsigned int  instance_serial 
) throw () [virtual]

A writing instance has been opened for a watched interface.

This is called whenever a writing instance of the interface you are watching is opened.

Parameters:
interface interface instance that you supplied to bbil_add_writer_interface()
instance_serial the instance serial of the writing instance that has just been added.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 154 of file interface_listener.cpp.

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_writer_removed ( Interface interface,
unsigned int  instance_serial 
) throw () [virtual]

A writing instance has been closed for a watched interface.

This is called whenever a writing instance of an interface you are watching is closed.

Parameters:
interface interface instance that you supplied to bbil_add_writer_interface()
instance_serial the instance serial of the writing instance that has just been removed.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 162 of file interface_listener.cpp.


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