Multi interface copy fuser. More...
#include <multi_copy.h>
Public Member Functions | |
WorldModelMultiCopyFuser (fawkes::BlackBoard *blackboard, const char *type, const char *from_id_pattern, const char *to_id_format) | |
Constructor. | |
~WorldModelMultiCopyFuser () | |
Destructor. | |
virtual void | fuse () |
The single function that makes fusers work. | |
virtual void | bb_interface_created (const char *type, const char *id) throw () |
BlackBoard interface created notification. |
Multi interface copy fuser.
This fuser simply copies the data of a number of interfaces to another set (of the same size) of interfaces. The source interfaces are given as pattern with shell wildcards like * and ?. The destination IDs is a pattern that contains exactly one "%u". This is replaced with a running number for the destination interfaces. The fuser registers as an observer and opens any newly created interfaces that match the given pattern and creates a write with the ID like the given format for it. It accounts for the case where pattern and format are similar and avoids opening it's own interfaces causing an infinite loop. Interfaces are never closed.
Definition at line 38 of file multi_copy.h.
WorldModelMultiCopyFuser::WorldModelMultiCopyFuser | ( | fawkes::BlackBoard * | blackboard, | |
const char * | type, | |||
const char * | from_id_pattern, | |||
const char * | to_id_format | |||
) |
Constructor.
blackboard | BlackBoard | |
type | interface type of both interfaces | |
from_id_pattern | pattern for ID of the interfaces to copy from | |
to_id_format | format for ID of the interfaces to copy to |
Definition at line 56 of file multi_copy.cpp.
References fawkes::BlackBoardInterfaceObserver::bbio_add_observed_create(), fawkes::BlackBoard::close(), fawkes::BlackBoard::open_for_writing(), fawkes::BlackBoard::open_multiple_for_reading(), and fawkes::BlackBoard::register_observer().
WorldModelMultiCopyFuser::~WorldModelMultiCopyFuser | ( | ) |
Destructor.
Definition at line 104 of file multi_copy.cpp.
References fawkes::BlackBoard::close(), fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), fawkes::LockMap< KeyType, ValueType, LessKey >::unlock(), and fawkes::BlackBoard::unregister_observer().
void WorldModelMultiCopyFuser::bb_interface_created | ( | const char * | type, | |
const char * | id | |||
) | throw () [virtual] |
BlackBoard interface created notification.
This is called whenever an interface is created for a type that you registered for.
type | type of the interface. If you want to store this make a copy as it is not guaranteed that the supplied string exists for longer than the duration of the method call | |
id | ID of the newly created interface. If you want to store this make a copy as it is not guaranteed that the supplied string exists for longer than the duration of the method call |
Reimplemented from fawkes::BlackBoardInterfaceObserver.
Definition at line 119 of file multi_copy.cpp.
References fawkes::Exception::print_trace().
void WorldModelMultiCopyFuser::fuse | ( | ) | [virtual] |
The single function that makes fusers work.
In this method fusers shall read from their source interfaces, process the data and write to their output interfaces.
Implements WorldModelFuser.
Definition at line 155 of file multi_copy.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::mutex().