ROSaic
|
Represents ensemble of (to be constructed) ROS messages, to be handled at once by this class. More...
#include <callbackhandlers.hpp>
Public Types | |
typedef std::multimap< std::string, boost::shared_ptr< AbstractCallbackHandler > > | CallbackMap |
Key is std::string and represents the ROS message key, value is boost::shared_ptr<CallbackHandler> More... | |
Public Member Functions | |
CallbackHandlers ()=default | |
template<typename T > | |
CallbackMap | Insert (std::string message_key, typename CallbackHandler< T >::Callback callback) |
void | Handle (mosaicMessage &mMessage) |
void | ReadCallback (const uint8_t *data, std::size_t &size) |
Searches for mosaic messages that could potentially be decoded/parsed/published. More... | |
Data Fields | |
CallbackMap | callbackmap_ |
Static Private Attributes | |
static boost::mutex | callback_mutex_ |
Represents ensemble of (to be constructed) ROS messages, to be handled at once by this class.
Definition at line 178 of file callbackhandlers.hpp.
typedef std::multimap<std::string, boost::shared_ptr<AbstractCallbackHandler> > io_comm_mosaic::CallbackHandlers::CallbackMap |
Key is std::string and represents the ROS message key, value is boost::shared_ptr<CallbackHandler>
Definition at line 184 of file callbackhandlers.hpp.
|
default |
|
inline |
This method is called every time mMessage is found to contain some potentially useful message. The for loop forwards to a ROS message specific handle if the latter was added via callbackmap_.insert at some earlier point.
Definition at line 203 of file callbackhandlers.hpp.
References io_comm_mosaic::mosaicMessage::MessageID(), publish_gpsfix, publish_gpst, publish_navsatfix, and publish_posewithcovariancestamped.
|
inline |
Insert adds a pair to our multimap, with the message_ID being the key; this method is called by handlers_ in rosaic_node.cpp T would be a (custom or not) ROS message, e.g. rosaic::PVTGeodetic, or nmea_msgs::GPGGA
Definition at line 191 of file callbackhandlers.hpp.
Referenced by rosaic_node::ROSaicNode::DefineMessages().
|
inline |
Searches for mosaic messages that could potentially be decoded/parsed/published.
[in] | data | Buffer passed on from AsyncManager class |
[in] | size | Size of the buffer |
Definition at line 332 of file callbackhandlers.hpp.
References io_comm_mosaic::mosaicMessage::BlockLength(), cd_condition, cd_count, cd_mutex, cd_received, io_comm_mosaic::mosaicMessage::End(), io_comm_mosaic::mosaicMessage::Found(), io_comm_mosaic::AbstractCallbackHandler::Handle(), io_comm_mosaic::mosaicMessage::IsConnectionDescriptor(), io_comm_mosaic::mosaicMessage::IsErrorMessage(), io_comm_mosaic::mosaicMessage::IsNMEA(), io_comm_mosaic::mosaicMessage::IsResponse(), io_comm_mosaic::mosaicMessage::IsSBF(), io_comm_mosaic::mosaicMessage::MessageID(), mosaic_tcp_port, io_comm_mosaic::mosaicMessage::Pos(), response_condition, response_mutex, response_received, io_comm_mosaic::mosaicMessage::Search(), and io_comm_mosaic::mosaicMessage::SegmentEnd().
Referenced by io_comm_mosaic::Comm_IO::SetManager().
|
staticprivate |
The "static" keyword resolves construct-by-copying issues related to this mutex by making it available throughout the code. The mutex constructor list contains "mutex (const mutex&) = delete", hence construct-by-copying a mutex is explicitly prohibited.
The get_handlers() method of the Comm_IO class forces us to make this mutex static, since otherwise, the method would need to construct-by-copy the mutex, which is strictly prohibited.
Definition at line 409 of file callbackhandlers.hpp.
CallbackMap io_comm_mosaic::CallbackHandlers::callbackmap_ |
Callback handlers multimap for mosaic messages; it needs to be public since we copy-assign (did not work otherwise) new callbackmap_, after inserting a pair to the multimap within the DefineMessages() method of the ROSaicNode class, onto its old version.
Definition at line 403 of file callbackhandlers.hpp.
Referenced by rosaic_node::ROSaicNode::DefineMessages().