Fawkes API  Fawkes Development Version
WorldModelMultiCopyFuser Class Reference

Multi interface copy fuser. More...

#include "multi_copy.h"

Inheritance diagram for WorldModelMultiCopyFuser:

Public Member Functions

 WorldModelMultiCopyFuser (fawkes::BlackBoard *blackboard, const char *type, const char *from_id_pattern, const char *to_id_format)
 Constructor. More...
 
 ~WorldModelMultiCopyFuser ()
 Destructor. More...
 
virtual void fuse ()
 The single function that makes fusers work. More...
 
virtual void bb_interface_created (const char *type, const char *id) throw ()
 BlackBoard interface created notification. More...
 
- Public Member Functions inherited from WorldModelFuser
virtual ~WorldModelFuser ()
 Virtual empty destructor. More...
 
- Public Member Functions inherited from fawkes::BlackBoardInterfaceObserver
 BlackBoardInterfaceObserver ()
 Empty constructor. More...
 
virtual ~BlackBoardInterfaceObserver ()
 Destructor. More...
 
virtual void bb_interface_destroyed (const char *type, const char *id) throw ()
 BlackBoard interface destroyed notification. More...
 

Additional Inherited Members

- Protected Types inherited from fawkes::BlackBoardInterfaceObserver
typedef LockMap< std::string, std::list< std::string > > ObservedInterfaceLockMap
 Type for lockable interface type hash sets. More...
 
typedef ObservedInterfaceLockMap::iterator ObservedInterfaceLockMapIterator
 Type for iterator of lockable interface type hash sets. More...
 
- Protected Member Functions inherited from fawkes::BlackBoardInterfaceObserver
void bbio_add_observed_create (const char *type_pattern, const char *id_pattern="*") throw ()
 Add interface creation type to watch list. More...
 
void bbio_add_observed_destroy (const char *type_pattern, const char *id_pattern="*") throw ()
 Add interface destruction type to watch list. More...
 
ObservedInterfaceLockMapbbio_get_observed_create () throw ()
 Get interface creation type watch list. More...
 
ObservedInterfaceLockMapbbio_get_observed_destroy () throw ()
 Get interface destriction type watch list. More...
 

Detailed Description

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.

Author
Tim Niemueller

Definition at line 38 of file multi_copy.h.

Constructor & Destructor Documentation

WorldModelMultiCopyFuser::WorldModelMultiCopyFuser ( fawkes::BlackBoard blackboard,
const char *  type,
const char *  from_id_pattern,
const char *  to_id_format 
)

Constructor.

Parameters
blackboardBlackBoard
typeinterface type of both interfaces
from_id_patternpattern for ID of the interfaces to copy from
to_id_formatformat for ID of the interfaces to copy to

Definition at line 56 of file multi_copy.cpp.

References 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.

Member Function Documentation

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.

Parameters
typetype 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
idID 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.


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