fawkes::Interface Class Reference
Base class for all Fawkes BlackBoard interfaces. More...
#include <interface/interface.h>

Classes | |
| struct | interface_messageinfo_t |
| Message info list. More... | |
Public Member Functions | |
| virtual | ~Interface () |
| Destructor. | |
| bool | oftype (const char *interface_type) const |
| Check if interface is of given type. | |
| const void * | datachunk () const |
| Get data chunk. | |
| unsigned int | datasize () const |
| Get data size. | |
| const char * | type () const |
| Get type of interface. | |
| const char * | id () const |
| Get identifier of interface. | |
| const char * | uid () const |
| Get unique identifier of interface. | |
| unsigned short | serial () const |
| Get instance serial of interface. | |
| unsigned int | mem_serial () const |
| Get memory serial of interface. | |
| bool | operator== (Interface &comp) const |
| Check equality of two interfaces. | |
| const unsigned char * | hash () const |
| Get interface hash. | |
| size_t | hash_size () const |
| Get size of interface hash. | |
| const char * | hash_printable () const |
| Get printable interface hash. | |
| bool | is_writer () const |
| Check if this is a writing instance. | |
| void | set_validity (bool valid) |
| Mark this interface invalid. | |
| bool | is_valid () const |
| Check validity of interface. | |
| void | set_from_chunk (void *chunk) |
| Set from a raw data chunk. | |
| virtual Message * | create_message (const char *type) const =0 |
| Create message based on type name. | |
| virtual void | copy_values (const Interface *interface)=0 |
| Copy values from another interface. | |
| void | read () |
| Read from BlackBoard into local copy. | |
| void | write () |
| Write from local copy into BlackBoard memory. | |
| bool | has_writer () const |
| Check if there is a writer for the interface. | |
| unsigned int | num_readers () const |
| Get the number of readers. | |
| std::list< const char * > | get_message_types () |
| Obtain a list of textual representations of the message types available for this interface. | |
| unsigned int | msgq_enqueue (Message *message) |
| Enqueue message at end of queue. | |
| unsigned int | msgq_enqueue_copy (Message *message) |
| Enqueue copy of message at end of queue. | |
| void | msgq_remove (Message *message) |
| Remove message from queue. | |
| void | msgq_remove (unsigned int message_id) |
| Remove message from queue. | |
| unsigned int | msgq_size () |
| Get size of message queue. | |
| void | msgq_flush () |
| Flush all messages. | |
| void | msgq_lock () |
| Lock message queue. | |
| bool | msgq_try_lock () |
| Try to lock message queue. | |
| void | msgq_unlock () |
| Unlock message queue. | |
| void | msgq_pop () |
| Erase first message from queue. | |
| Message * | msgq_first () |
| Get the first message from the message queue. | |
| bool | msgq_empty () |
| Check if queue is empty. | |
| template<class MessageType > | |
| bool | msgq_first_is () |
| Check if first message has desired type. | |
| template<class MessageType > | |
| MessageType * | msgq_first () |
| Get first message casted to the desired type. | |
| template<class MessageType > | |
| MessageType * | msgq_first (MessageType *&msg) |
| Get first message casted to the desired type. | |
| MessageQueue::MessageIterator | msgq_begin () |
| Get start iterator for message queue. | |
| MessageQueue::MessageIterator | msgq_end () |
| Get end iterator for message queue. | |
| InterfaceFieldIterator | fields () |
| Get iterator over all fields of this interface instance. | |
| InterfaceFieldIterator | fields_end () |
| Invalid iterator. | |
| unsigned int | num_fields () |
| Get the number of fields in the interface. | |
Protected Member Functions | |
| Interface () | |
| Constructor. | |
| virtual bool | message_valid (const Message *message) const =0 |
| Check if the message is valid and can be enqueued. | |
| void | set_hash (unsigned char *ihash) |
| Set hash. | |
| void | add_fieldinfo (interface_fieldtype_t type, const char *name, size_t length, void *value) |
| Add an entry to the field info list. | |
| void | add_messageinfo (const char *name) |
| Add an entry to the message info list. | |
Protected Attributes | |
| void * | data_ptr |
| Pointer to local memory storage. | |
| unsigned int | data_size |
| Minimal data size to hold data storage. | |
Friends | |
| class | BlackBoardInterfaceManager |
| class | BlackBoardInstanceFactory |
| class | BlackBoardMessageManager |
| class | BlackBoardInterfaceProxy |
Detailed Description
Base class for all Fawkes BlackBoard interfaces.Never use directly. Use interface generator to create interfaces.
Interfaces are identified by a type and an ID. The type is just a textual representation of the class name. The ID identifies a specific instance of this interface type. Additionally each interface has a hash. The hash is an MD5 digest of the XML config file that was fed to the interface generator to create the interface. It is used to detect incompatible versions of the same interface type.
Definition at line 75 of file interface.h.
Constructor & Destructor Documentation
| fawkes::Interface::~Interface | ( | ) | [virtual] |
Destructor.
Definition at line 174 of file interface.cpp.
References fawkes::Interface::interface_messageinfo_t::next, fawkes::interface_fieldinfo_t::next, and fawkes::RefCount::unref().
| fawkes::Interface::Interface | ( | ) | [protected] |
Member Function Documentation
| void fawkes::Interface::add_fieldinfo | ( | interface_fieldtype_t | type, | |
| const char * | name, | |||
| size_t | length, | |||
| void * | value | |||
| ) | [protected] |
Add an entry to the field info list.
Never use directly, use the interface generator instead. The info list is used for introspection purposes to allow for iterating over all fields of an interface.
- Parameters:
-
type field type name name of the field, this is referenced, not copied length length of the field value pointer to the value in the data struct
Definition at line 240 of file interface.cpp.
References fawkes::interface_fieldinfo_t::length, fawkes::interface_fieldinfo_t::name, fawkes::interface_fieldinfo_t::next, fawkes::interface_fieldinfo_t::type, and fawkes::interface_fieldinfo_t::value.
| void fawkes::Interface::add_messageinfo | ( | const char * | type | ) | [protected] |
Add an entry to the message info list.
Never use directly, use the interface generator instead. The info list is used for introspection purposes to allow for iterating over all message types of an interface.
- Parameters:
-
type the type of the message
Definition at line 274 of file interface.cpp.
References fawkes::Interface::interface_messageinfo_t::next, and fawkes::Interface::interface_messageinfo_t::type.
| void fawkes::Interface::copy_values | ( | const Interface * | interface | ) | [pure virtual] |
Copy values from another interface.
The operation will only succeed if the supplied interface is of the same type as this instance.
- Parameters:
-
interface interface to copy from
Implemented in fawkes::BatteryInterface, fawkes::FacerInterface, fawkes::FacialExpressionInterface, fawkes::GameStateInterface, fawkes::HumanoidMotionInterface, fawkes::JoystickInterface, fawkes::KatanaInterface, fawkes::KickerInterface, fawkes::Laser360Interface, fawkes::Laser720Interface, fawkes::LedInterface, fawkes::LocalizerControlInterface, fawkes::MotorInterface, fawkes::NavigatorInterface, fawkes::ObjectPositionInterface, fawkes::PanTiltInterface, fawkes::Position2DTrackInterface, fawkes::SkillerDebugInterface, fawkes::SkillerInterface, fawkes::SpeechRecognitionInterface, fawkes::SpeechSynthInterface, fawkes::SwitchInterface, and fawkes::TestInterface.
Referenced by WorldModelSingleCopyFuser::fuse(), and WorldModelSingleCopyFuser::WorldModelSingleCopyFuser().
| bool fawkes::Interface::create_message | ( | const char * | type | ) | const [pure virtual] |
Create message based on type name.
This will create a new message of the given type. The type must be given without the InterfaceName:: prefix but just the plain class name of the message.
- Parameters:
-
type message type
- Returns:
- message of the given type, empty
- Exceptions:
-
UnknownTypeException thrown if this interface cannot create a message of the given type.
Implemented in fawkes::BatteryInterface, fawkes::FacerInterface, fawkes::FacialExpressionInterface, fawkes::GameStateInterface, fawkes::HumanoidMotionInterface, fawkes::JoystickInterface, fawkes::KatanaInterface, fawkes::KickerInterface, fawkes::Laser360Interface, fawkes::Laser720Interface, fawkes::LedInterface, fawkes::LocalizerControlInterface, fawkes::MotorInterface, fawkes::NavigatorInterface, fawkes::ObjectPositionInterface, fawkes::PanTiltInterface, fawkes::Position2DTrackInterface, fawkes::SkillerDebugInterface, fawkes::SkillerInterface, fawkes::SpeechRecognitionInterface, fawkes::SpeechSynthInterface, fawkes::SwitchInterface, and fawkes::TestInterface.
Referenced by fawkes::BlackBoardInterfaceProxy::process_interface_message().
| const void * fawkes::Interface::datachunk | ( | ) | const |
Get data chunk.
Use sparsely
- Returns:
- const pointer to the data chunk
Definition at line 330 of file interface.cpp.
References data_ptr.
Referenced by fawkes::BlackBoardInterfaceProxy::notify_of_data_change().
| unsigned int fawkes::Interface::datasize | ( | ) | const |
Get data size.
- Returns:
- size in bytes of data segment
Definition at line 415 of file interface.cpp.
References data_size.
Referenced by fawkes::BlackBoardInterfaceProxy::BlackBoardInterfaceProxy(), fawkes::BlackBoardInterfaceProxy::notify_of_data_change(), and WebBlackBoardRequestProcessor::process_request().
| InterfaceFieldIterator fawkes::Interface::fields | ( | ) |
Get iterator over all fields of this interface instance.
- Returns:
- field iterator pointing to the very first value
Definition at line 914 of file interface.cpp.
Referenced by XabslEngineThread::init(), and WebBlackBoardRequestProcessor::process_request().
| InterfaceFieldIterator fawkes::Interface::fields_end | ( | ) |
Invalid iterator.
- Returns:
- invalid iterator reprensenting the end.
Definition at line 924 of file interface.cpp.
Referenced by XabslEngineThread::init(), and WebBlackBoardRequestProcessor::process_request().
| std::list< const char * > fawkes::Interface::get_message_types | ( | ) |
Obtain a list of textual representations of the message types available for this interface.
- Returns:
- the message types
Definition at line 300 of file interface.cpp.
References fawkes::Interface::interface_messageinfo_t::next, and fawkes::Interface::interface_messageinfo_t::type.
| bool fawkes::Interface::has_writer | ( | ) | const |
Check if there is a writer for the interface.
Use this method to determine if there is any open instance of the interface that is writing to the interface. This can also be the queried interface instance.
Definition at line 589 of file interface.cpp.
References fawkes::InterfaceMediator::exists_writer().
Referenced by LaserDrawingArea::draw_persons_legs(), LaserDrawingArea::draw_segments(), LuaAgentExecutionThread::finalize(), WorldModelSingleCopyFuser::fuse(), WorldModelObjPosAverageFuser::fuse(), LaserDeadSpotCalibrator::LaserDeadSpotCalibrator(), WorldModelThread::loop(), LaserDrawingArea::on_expose_event(), and WebBlackBoardRequestProcessor::process_request().
| const unsigned char * fawkes::Interface::hash | ( | ) | const |
Get interface hash.
The interface is a unique version identifier of an interface. It is the has of the input XML file during the generation of the interface. It is meant to be used to ensure that all sides are using the exact same version of an interface.
- Returns:
- constant byte string containing the hash value of hash_size() length
Definition at line 201 of file interface.cpp.
Referenced by fawkes::BlackBoardInterfaceProxy::BlackBoardInterfaceProxy(), fawkes::BlackBoardNetworkHandler::loop(), fawkes::BlackBoardInterfaceManager::open_for_reading(), fawkes::BlackBoardInterfaceManager::open_for_writing(), and fawkes::BlackBoardInterfaceManager::open_multiple_for_reading().
| const char * fawkes::Interface::hash_printable | ( | ) | const |
Get printable interface hash.
- Returns:
- printable version of hash()
Definition at line 211 of file interface.cpp.
Referenced by WebBlackBoardRequestProcessor::process_request().
| size_t fawkes::Interface::hash_size | ( | ) | const |
Get size of interface hash.
Returns the size in bytes of the interface hash. This depends on the used hash.
- Returns:
- size of interface hash string
Definition at line 319 of file interface.cpp.
Referenced by fawkes::BlackBoardInterfaceManager::open_for_reading(), fawkes::BlackBoardInterfaceManager::open_for_writing(), and fawkes::BlackBoardInterfaceManager::open_multiple_for_reading().
| const char * fawkes::Interface::id | ( | ) | const |
Get identifier of interface.
- Returns:
- string with the identifier of the interface.
Definition at line 526 of file interface.cpp.
Referenced by fawkes::BlackBoardInterfaceProxy::BlackBoardInterfaceProxy(), WebBlackBoardRequestProcessor::process_request(), and fawkes::BlackBoardMessageManager::transmit().
| bool fawkes::Interface::is_valid | ( | ) | const |
Check validity of interface.
- Returns:
- true if interface is valid, false otherwise
Reimplemented in fawkes::ObjectPositionInterface, and fawkes::Position2DTrackInterface.
Definition at line 365 of file interface.cpp.
| bool fawkes::Interface::is_writer | ( | ) | const |
Check if this is a writing instance.
- Returns:
- true if this is a writing instance, false otherwise
Definition at line 340 of file interface.cpp.
Referenced by fawkes::LuaInterfaceImporter::add_interface(), fawkes::BlackBoardInterfaceListener::bbil_add_message_interface(), fawkes::BlackBoardInterfaceListener::bbil_remove_message_interface(), fawkes::BlackBoardNetHandlerInterfaceListener::BlackBoardNetHandlerInterfaceListener(), fawkes::InterfaceDispatcher::InterfaceDispatcher(), and fawkes::BlackBoardInterfaceProxy::process_interface_message().
| unsigned int fawkes::Interface::mem_serial | ( | ) | const |
Get memory serial of interface.
- Returns:
- memory serial of interface
Definition at line 560 of file interface.cpp.
| bool fawkes::Interface::message_valid | ( | const Message * | message | ) | const [protected, pure virtual] |
Check if the message is valid and can be enqueued.
- Parameters:
-
message The message to check
- Returns:
- true, if the message is valid and may be enqueued, false otherwise
Implemented in fawkes::BatteryInterface, fawkes::FacerInterface, fawkes::FacialExpressionInterface, fawkes::GameStateInterface, fawkes::HumanoidMotionInterface, fawkes::JoystickInterface, fawkes::KatanaInterface, fawkes::KickerInterface, fawkes::Laser360Interface, fawkes::Laser720Interface, fawkes::LedInterface, fawkes::LocalizerControlInterface, fawkes::MotorInterface, fawkes::NavigatorInterface, fawkes::ObjectPositionInterface, fawkes::PanTiltInterface, fawkes::Position2DTrackInterface, fawkes::SkillerDebugInterface, fawkes::SkillerInterface, fawkes::SpeechRecognitionInterface, fawkes::SpeechSynthInterface, fawkes::SwitchInterface, and fawkes::TestInterface.
Referenced by msgq_enqueue(), and msgq_enqueue_copy().
| MessageQueue::MessageIterator fawkes::Interface::msgq_begin | ( | ) |
Get start iterator for message queue.
Not that you must have locked the queue before this operation! This can only be called on a writing interface instance.
- Returns:
- iterator to begin of message queue.
- Exceptions:
-
NotLockedException thrown if message queue is not locked during this operation.
Definition at line 851 of file interface.cpp.
References fawkes::MessageQueue::begin().
| bool fawkes::Interface::msgq_empty | ( | ) |
Check if queue is empty.
This can only be called on a writing interface instance.
- Returns:
- true if queue is empty, false otherwise
Definition at line 768 of file interface.cpp.
References fawkes::MessageQueue::empty().
Referenced by RefBoxCommThread::loop(), AgentControlThread::loop(), PanTiltSonyEviD100PThread::loop(), PanTiltRX28Thread::loop(), PanTiltDirectedPerceptionThread::loop(), SkillerExecutionThread::loop(), KatanaActThread::loop(), FliteSynthThread::loop(), FestivalSynthThread::loop(), and PlayerMotorPositionMapper::sync_fawkes_to_player().
| MessageQueue::MessageIterator fawkes::Interface::msgq_end | ( | ) |
Get end iterator for message queue.
Not that you must have locked the queue before this operation! This can only be called on a writing interface instance.
- Returns:
- iterator beyond end of message queue.
- Exceptions:
-
NotLockedException thrown if message queue is not locked during this operation.
Definition at line 869 of file interface.cpp.
References fawkes::MessageQueue::end().
| unsigned int fawkes::Interface::msgq_enqueue | ( | Message * | message | ) |
Enqueue message at end of queue.
This appends the given message to the queue and transmits the message via the message mediator. The message is afterwards owned by the other side and will be unrefed and freed as soon as it has been processed. If you want to keep this message to read a feedback status you have to reference it _before_ enqueuing it! This can only be called on a reading interface instance.
- Parameters:
-
message Message to enqueue.
- Returns:
- message id after message has been queued
- Exceptions:
-
MessageAlreadyQueuedException thrown if the message has already been enqueued to an interface.
Definition at line 634 of file interface.cpp.
References fawkes::Message::id(), message_valid(), fawkes::Message::set_id(), fawkes::MessageMediator::transmit(), and fawkes::RefCount::unref().
Referenced by LuaAgentExecutionThread::finalize(), LuaAgentExecutionThread::init(), XabslEngineThread::loop(), SkillShellThread::loop(), LaserDrawingArea::on_expose_event(), XabslEngineThread::once(), and SkillShellThread::~SkillShellThread().
| unsigned int fawkes::Interface::msgq_enqueue_copy | ( | Message * | message | ) |
Enqueue copy of message at end of queue.
This method creates a copy of the message and enqueues it. Note that this way you cannot receive status message in the message, because the other side will not use your message instance but a copy instead.
This is particularly useful if you call from an environment with automatic garbage collection that does not honor the referencing feature of message but rather just deletes it. This can only be called on a reading interface instance.
- Parameters:
-
message Message to enqueue.
- Returns:
- message id after message has been queued
- Exceptions:
-
MessageAlreadyQueuedException thrown if the message has already been enqueued to an interface.
Definition at line 669 of file interface.cpp.
References fawkes::Message::clone(), fawkes::Message::id(), message_valid(), fawkes::Message::set_id(), fawkes::MessageMediator::transmit(), and fawkes::RefCount::unref().
| MessageType * fawkes::Interface::msgq_first | ( | MessageType *& | msg | ) | [inline] |
Get first message casted to the desired type.
- Parameters:
-
msg reference to pointer to message of desired type, upon successful return points to the message.
- Returns:
- message casted to desired type (same as msg parameter)
- Exceptions:
-
TypeMismatchException thrown if message is not of desired type
Definition at line 235 of file interface.h.
| MessageType* fawkes::Interface::msgq_first | ( | ) | [inline] |
Get first message casted to the desired type.
- Returns:
- message casted to desired type
- Exceptions:
-
TypeMismatchException thrown if message is not of desired type
| MessageType * fawkes::Interface::msgq_first | ( | ) | [inline] |
Get the first message from the message queue.
This can only be called on a writing interface instance.
- Returns:
- first message in queue or NULL if there is none
Definition at line 885 of file interface.cpp.
References fawkes::MessageQueue::first().
Referenced by RefBoxCommThread::loop(), AgentControlThread::loop(), PanTiltSonyEviD100PThread::loop(), PanTiltRX28Thread::loop(), PanTiltDirectedPerceptionThread::loop(), SkillerExecutionThread::loop(), KatanaActThread::loop(), FliteSynthThread::loop(), FestivalSynthThread::loop(), and PlayerMotorPositionMapper::sync_fawkes_to_player().
| bool fawkes::Interface::msgq_first_is | ( | ) | [inline] |
Check if first message has desired type.
- Returns:
- true, if message has desired type, false otherwise
Definition at line 247 of file interface.h.
References fawkes::MessageQueue::first().
Referenced by RefBoxCommThread::loop(), AgentControlThread::loop(), PanTiltSonyEviD100PThread::loop(), PanTiltRX28Thread::loop(), PanTiltDirectedPerceptionThread::loop(), SkillerExecutionThread::loop(), KatanaActThread::loop(), FliteSynthThread::loop(), FestivalSynthThread::loop(), and PlayerMotorPositionMapper::sync_fawkes_to_player().
| void fawkes::Interface::msgq_flush | ( | ) |
Flush all messages.
Deletes all messages from the queue. This can only be called on a writing interface instance.
Definition at line 784 of file interface.cpp.
References fawkes::MessageQueue::flush().
| void fawkes::Interface::msgq_lock | ( | ) |
Lock message queue.
Lock the message queue. You have to do this before using the iterator safely. This can only be called on a writing interface instance.
Definition at line 800 of file interface.cpp.
References fawkes::MessageQueue::lock().
| void fawkes::Interface::msgq_pop | ( | ) |
Erase first message from queue.
This can only be called on a writing interface instance.
Definition at line 899 of file interface.cpp.
References fawkes::MessageQueue::pop().
Referenced by RefBoxCommThread::loop(), AgentControlThread::loop(), PanTiltSonyEviD100PThread::loop(), PanTiltRX28Thread::loop(), PanTiltDirectedPerceptionThread::loop(), SkillerExecutionThread::loop(), KatanaActThread::loop(), FliteSynthThread::loop(), FestivalSynthThread::loop(), and PlayerMotorPositionMapper::sync_fawkes_to_player().
| void fawkes::Interface::msgq_remove | ( | unsigned int | message_id | ) |
Remove message from queue.
Removes message with the given ID from the queue.
- Parameters:
-
message_id Message ID to remove. This can only be called on a writing interface instance.
Definition at line 736 of file interface.cpp.
References fawkes::MessageQueue::remove().
| void fawkes::Interface::msgq_remove | ( | Message * | message | ) |
Remove message from queue.
Removes the given message from the queue. Note that if you unref()ed the message after insertion this will most likely delete the object. It is not safe to use the message after removing it from the queue in general. Know what you are doing if you want to use it. This can only be called on a writing interface instance.
- Parameters:
-
message Message to remove.
Definition at line 719 of file interface.cpp.
References fawkes::MessageQueue::remove().
| unsigned int fawkes::Interface::msgq_size | ( | ) |
Get size of message queue.
This can only be called on a writing interface instance.
- Returns:
- number of messages in queue.
Definition at line 752 of file interface.cpp.
References fawkes::MessageQueue::size().
| bool fawkes::Interface::msgq_try_lock | ( | ) |
Try to lock message queue.
Try to lock the message queue. Returns immediately and does not wait for lock.
- Returns:
- true, if the lock has been aquired, false otherwise.
- See also:
- lock() This can only be called on a writing interface instance.
Definition at line 818 of file interface.cpp.
References fawkes::MessageQueue::try_lock().
| void fawkes::Interface::msgq_unlock | ( | ) |
Unlock message queue.
Give free the lock on the message queue. This can only be called on a writing interface instance.
Definition at line 834 of file interface.cpp.
References fawkes::MessageQueue::unlock().
| unsigned int fawkes::Interface::num_fields | ( | ) |
Get the number of fields in the interface.
- Returns:
- the number of fields
Definition at line 934 of file interface.cpp.
| unsigned int fawkes::Interface::num_readers | ( | ) | const |
Get the number of readers.
Use this method to determine how many reading instances of the interface currently exist. If the current instance is a reading instance it will be included in the count number. To determine if you are the last man having this interface you can use the following code:
// for a writing instance: if ( interface->num_readers == 0 ) { // we are the last one to have this interface open } // for a reading instance: if ( ! interface->has_writer() && (interface->num_readers() == 0) ) { // we are the last one to have this interface open }
Definition at line 615 of file interface.cpp.
References fawkes::InterfaceMediator::num_readers().
Referenced by WebBlackBoardRequestProcessor::process_request().
| bool fawkes::Interface::oftype | ( | const char * | interface_type | ) | const |
Check if interface is of given type.
- Parameters:
-
interface_type type to query
- Returns:
- true, if current instance is of given type, false otherwise
Definition at line 506 of file interface.cpp.
| bool fawkes::Interface::operator== | ( | Interface & | comp | ) | const |
Check equality of two interfaces.
Two interfaces are the same if their types and identifiers are equal. This does not mean that both interfaces are the very same instance for accessing the BlackBoard. Instead this just means that both instances will access the same chunk of memory in the BlackBoard and the instances MAY be the same. If you want to know if two instances are exactly the same compare the instance serials using the serial() method.
- Parameters:
-
comp interface to compare current instance with
- Returns:
- true, if interfaces point to the same data, false otherwise
Definition at line 494 of file interface.cpp.
| void fawkes::Interface::read | ( | ) |
Read from BlackBoard into local copy.
- Exceptions:
-
InterfaceInvalidException thrown if the interface has been marked invalid
Definition at line 375 of file interface.cpp.
References data_ptr, data_size, fawkes::ReadWriteLock::lock_for_read(), and fawkes::ReadWriteLock::unlock().
Referenced by JoystickBlackBoardLogger::bb_interface_data_changed(), LaserDrawingArea::draw_persons_legs(), LaserDrawingArea::draw_segments(), WorldModelSingleCopyFuser::fuse(), WorldModelObjPosAverageFuser::fuse(), LuaAgentExecutionThread::init(), JoystickBlackBoardLogger::JoystickBlackBoardLogger(), XabslEngineThread::loop(), WorldModelThread::loop(), AgentControlThread::loop(), LuaAgentExecutionThread::loop(), BallPosLogThread::loop(), LaserDrawingArea::on_expose_event(), WebBlackBoardRequestProcessor::process_request(), and WorldModelSingleCopyFuser::WorldModelSingleCopyFuser().
| unsigned short fawkes::Interface::serial | ( | ) | const |
Get instance serial of interface.
- Returns:
- instance serial of the interface.
Definition at line 550 of file interface.cpp.
Referenced by fawkes::RemoteBlackBoard::close(), fawkes::BlackBoardInterfaceManager::close(), fawkes::BlackBoardNetworkHandler::loop(), fawkes::BlackBoardInterfaceProxy::notify_of_data_change(), fawkes::BlackBoardNotifier::notify_of_reader_removed(), fawkes::BlackBoardNotifier::notify_of_writer_removed(), fawkes::BlackBoardInterfaceManager::open_for_reading(), fawkes::BlackBoardInterfaceManager::open_for_writing(), WebBlackBoardRequestProcessor::process_request(), and fawkes::BlackBoardInterfaceProxy::transmit().
| void fawkes::Interface::set_from_chunk | ( | void * | chunk | ) |
Set from a raw data chunk.
This allows for setting the interface data from a raw chunk. This is not useful in general but only in rare situations like network transmission. Do not use it unless you really know what you are doing. The method expects the chunk to be exactly of the size returned by datasize(). No check is done, a segfault will most likely occur if you provide invalid data.
- Parameters:
-
chunk data chunk, must be exactly of the size that is returned by datasize()
Definition at line 575 of file interface.cpp.
| void fawkes::Interface::set_hash | ( | unsigned char * | ihash | ) | [protected] |
Set hash.
Never use directly.
- Parameters:
-
ihash interface hash
Definition at line 221 of file interface.cpp.
| void fawkes::Interface::set_validity | ( | bool | valid | ) |
Mark this interface invalid.
An interface can become invalid, for example if the connection of a RemoteBlackBoard dies. In this case the interface becomes invalid and successive read()/write() calls will throw an InterfaceInvalidException.
- Parameters:
-
valid true to mark the interface valid or false to mark it invalid
Definition at line 353 of file interface.cpp.
References fawkes::ReadWriteLock::lock_for_write(), and fawkes::ReadWriteLock::unlock().
| const char * fawkes::Interface::type | ( | ) | const |
Get type of interface.
- Returns:
- string with the type of the interface.
Definition at line 516 of file interface.cpp.
Referenced by fawkes::BlackBoardInterfaceProxy::BlackBoardInterfaceProxy(), fawkes::SkillerDebugInterface::copy_values(), fawkes::PanTiltInterface::copy_values(), fawkes::KatanaInterface::copy_values(), fawkes::TestInterface::copy_values(), fawkes::SwitchInterface::copy_values(), fawkes::SpeechSynthInterface::copy_values(), fawkes::SpeechRecognitionInterface::copy_values(), fawkes::SkillerInterface::copy_values(), fawkes::Position2DTrackInterface::copy_values(), fawkes::ObjectPositionInterface::copy_values(), fawkes::NavigatorInterface::copy_values(), fawkes::MotorInterface::copy_values(), fawkes::LocalizerControlInterface::copy_values(), fawkes::LedInterface::copy_values(), fawkes::Laser720Interface::copy_values(), fawkes::Laser360Interface::copy_values(), fawkes::KickerInterface::copy_values(), fawkes::JoystickInterface::copy_values(), fawkes::HumanoidMotionInterface::copy_values(), fawkes::GameStateInterface::copy_values(), fawkes::FacialExpressionInterface::copy_values(), fawkes::FacerInterface::copy_values(), fawkes::BatteryInterface::copy_values(), PlayerMapperFactory::create_mapper(), WebBlackBoardRequestProcessor::process_request(), and fawkes::BlackBoardMessageManager::transmit().
| const char * fawkes::Interface::uid | ( | ) | const |
Get unique identifier of interface.
As the name suggests this ID denotes a unique memory instance of this interface in the blackboard. It is provided by the system and currently returns a string of the form "type::id", where type is replaced by the type returned by type() and id is the ID returned by id().
- Returns:
- string with the unique identifier of the interface.
Definition at line 540 of file interface.cpp.
Referenced by 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::BlackBoardInterfaceListener::bbil_remove_data_interface(), fawkes::BlackBoardInterfaceListener::bbil_remove_message_interface(), fawkes::BlackBoardInterfaceListener::bbil_remove_reader_interface(), fawkes::BlackBoardInterfaceListener::bbil_remove_writer_interface(), WorldModelObjPosAverageFuser::fuse(), fawkes::BlackBoardNotifier::notify_of_data_change(), fawkes::BlackBoardNotifier::notify_of_message_received(), and fawkes::BlackBoardInterfaceProxy::process_interface_message().
| void fawkes::Interface::write | ( | ) |
Write from local copy into BlackBoard memory.
- Exceptions:
-
InterfaceInvalidException thrown if the interface has been marked invalid
Definition at line 392 of file interface.cpp.
References data_ptr, data_size, fawkes::ReadWriteLock::lock_for_write(), fawkes::InterfaceMediator::notify_of_data_change(), and fawkes::ReadWriteLock::unlock().
Referenced by WorldModelNetworkThread::ball_pos_rcvd(), WorldModelSingleCopyFuser::fuse(), WorldModelObjPosAverageFuser::fuse(), WorldModelNetworkThread::gamestate_rcvd(), WorldModelNetworkThread::global_ball_pos_rcvd(), RefBoxCommThread::handle_refbox_state(), PanTiltSonyEviD100PThread::init(), PanTiltRX28Thread::init(), PanTiltDirectedPerceptionThread::init(), SkillerExecutionThread::init(), JoystickBlackBoardPoster::joystick_changed(), JoystickBlackBoardPoster::joystick_plugged(), JoystickBlackBoardPoster::joystick_unplugged(), RefBoxCommThread::loop(), AgentControlThread::loop(), PanTiltSonyEviD100PThread::loop(), PanTiltRX28Thread::loop(), PanTiltDirectedPerceptionThread::loop(), SkillerExecutionThread::loop(), KatanaActThread::loop(), LaserSensorThread::loop(), JoystickSensorThread::loop(), WorldModelNetworkThread::opponent_pose_rcvd(), WorldModelNetworkThread::pose_rcvd(), FliteSynthThread::say(), FestivalSynthThread::say(), RefBoxStateBBWriter::send(), PlayerPositionMapper::sync_player_to_fawkes(), PlayerMotorPositionMapper::sync_player_to_fawkes(), PlayerLaserMapper::sync_player_to_fawkes(), PanTiltSonyEviD100PThread::update_sensor_values(), PanTiltRX28Thread::update_sensor_values(), PanTiltDirectedPerceptionThread::update_sensor_values(), and WorldModelSingleCopyFuser::WorldModelSingleCopyFuser().
Member Data Documentation
fawkes::Interface::data_ptr [protected] |
Pointer to local memory storage.
Definition at line 175 of file interface.h.
Referenced by datachunk(), Interface(), read(), set_from_chunk(), and write().
fawkes::Interface::data_size [protected] |
Minimal data size to hold data storage.
Definition at line 176 of file interface.h.
Referenced by datasize(), Interface(), read(), set_from_chunk(), and write().
The documentation for this class was generated from the following files:
- src/libs/interface/interface.h
- src/libs/interface/interface.cpp

