Fawkes API Fawkes Development Version
|
The workhorse of the ProtoBuf to Blackboard conversion. More...
#include <protobuf_to_bb.h>
Public Types | |
typedef ProtoT | input_type |
The ProtoBuf message type that goes in. More... | |
typedef IfaceT | output_type |
The blackboard interface type that the ProtoBuf contents are written to. More... | |
Public Member Functions | |
pb_converter () | |
Empty-init. More... | |
pb_converter (const pb_converter< ProtoT, IfaceT > &)=delete | |
Copying this is prohibited. More... | |
pb_converter< ProtoT, IfaceT > & | operator= (const pb_converter< ProtoT, IfaceT > &)=delete |
Copying this is prohibited. More... | |
pb_converter (pb_converter< ProtoT, IfaceT > &&o) | |
Move construction. More... | |
pb_converter< ProtoT, IfaceT > & | operator= (pb_converter< ProtoT, IfaceT > &&o) |
Move assignment. More... | |
virtual | ~pb_converter () |
Close blackboard interface on destruction. More... | |
virtual void | init (fawkes::BlackBoard *blackboard, fawkes::Logger *logger, const std::string &id="") override |
Deferred initialization, coincides with main thread initialization. More... | |
virtual void | handle (const google::protobuf::Message &msg) override |
Handle a ProtoBuf message by reference. More... | |
virtual void | handle (const ProtoT &msg) |
Handle a ProtoBuf message with known type. More... | |
virtual bool | is_open () |
virtual void | close () |
Give up the current blackboard interface (closes it) More... | |
IfaceT * | interface () |
const char * | name () |
![]() | |
pb_convert () | |
Empty-init constructor. More... | |
pb_convert (const pb_convert &)=default | |
Default copy constructor. More... | |
virtual | ~pb_convert () |
Destructor. Does nothing since members aren't owned by this class. More... | |
pb_convert & | operator= (const pb_convert &)=default |
Default copy assignment. More... | |
virtual void | init (fawkes::BlackBoard *blackboard, fawkes::Logger *logger, const std::string &="") |
Deferred initialization. More... | |
virtual void | handle (std::shared_ptr< google::protobuf::Message > msg) |
Dereference msg and pass it on to handle it by reference. More... | |
virtual void | handle (const google::protobuf::Message &msg) |
Handle a ProtoBuf message by reference. More... | |
Static Public Member Functions | |
static std::string | get_sequence_id (const ProtoT &) |
Protected Member Functions | |
virtual void | handle (const ProtoT &msg, IfaceT *iface) |
Write the contents of a ProtoBuf message into the appropriate blackboard interface. More... | |
Additional Inherited Members | |
![]() | |
fawkes::BlackBoard * | blackboard_ |
Blackboard used by the main thread. More... | |
fawkes::Logger * | logger_ |
Logger from the main thread. More... | |
The workhorse of the ProtoBuf to Blackboard conversion.
A | concrete ProtoBuf message type |
The | BlackBoard interface type that the ProtoBuf type should be mapped to |
Definition at line 99 of file protobuf_to_bb.h.
typedef ProtoT protoboard::pb_converter< ProtoT, IfaceT >::input_type |
The ProtoBuf message type that goes in.
Definition at line 103 of file protobuf_to_bb.h.
typedef IfaceT protoboard::pb_converter< ProtoT, IfaceT >::output_type |
The blackboard interface type that the ProtoBuf contents are written to.
Definition at line 105 of file protobuf_to_bb.h.
|
inline |
Empty-init.
Definition at line 108 of file protobuf_to_bb.h.
|
delete |
Copying this is prohibited.
"" | deleted |
|
inline |
Move construction.
o | Another pb_converter to move from |
Definition at line 124 of file protobuf_to_bb.h.
|
inlinevirtual |
Close blackboard interface on destruction.
Definition at line 146 of file protobuf_to_bb.h.
References protoboard::pb_converter< ProtoT, IfaceT >::close().
|
inlinevirtual |
Give up the current blackboard interface (closes it)
Definition at line 196 of file protobuf_to_bb.h.
References protoboard::pb_convert::blackboard_, fawkes::BlackBoard::close(), and protoboard::pb_converter< ProtoT, IfaceT >::is_open().
Referenced by protoboard::pb_converter< ProtoT, IfaceT >::~pb_converter().
|
inlinestatic |
Definition at line 215 of file protobuf_to_bb.h.
|
inlineoverridevirtual |
Handle a ProtoBuf message by reference.
Overridden in pb_converter
msg | Reference to a generic ProtoBuf message |
Reimplemented from protoboard::pb_convert.
Definition at line 172 of file protobuf_to_bb.h.
References protoboard::pb_converter< ProtoT, IfaceT >::handle().
Referenced by protoboard::pb_converter< ProtoT, IfaceT >::handle().
|
inlinevirtual |
Handle a ProtoBuf message with known type.
Just delegates to a user-definable method where the ProtoBuf message is matched up with the appropriate blackboard interface.
msg | The incoming ProtoBuf message |
Definition at line 181 of file protobuf_to_bb.h.
References protoboard::pb_converter< ProtoT, IfaceT >::handle().
|
protectedvirtual |
Write the contents of a ProtoBuf message into the appropriate blackboard interface.
Must be specialized by the user for each ProtoBuf message -> blackboard interface pair
msg | The message received |
iface | The appropriate interface |
|
inlineoverridevirtual |
Deferred initialization, coincides with main thread initialization.
blackboard | Initialized blackboard |
logger | Logger used by the main thread |
id | Blackboard interface ID to open |
Reimplemented from protoboard::pb_convert.
Definition at line 156 of file protobuf_to_bb.h.
References protoboard::pb_convert::blackboard_, protoboard::pb_convert::init(), fawkes::MultiLogger::log_info(), protoboard::pb_converter< ProtoT, IfaceT >::name(), and fawkes::BlackBoard::open_for_writing().
|
inline |
Definition at line 206 of file protobuf_to_bb.h.
|
inlinevirtual |
Definition at line 189 of file protobuf_to_bb.h.
Referenced by protoboard::pb_converter< ProtoT, IfaceT >::close().
|
inline |
Definition at line 222 of file protobuf_to_bb.h.
Referenced by protoboard::pb_converter< ProtoT, IfaceT >::init().
|
delete |
Copying this is prohibited.
"" | deleted |
|
inline |
Move assignment.
o | Another pb_converter to move from |
Definition at line 136 of file protobuf_to_bb.h.
References protoboard::pb_convert::operator=().