#include <Subscription.hpp>
Public Types | |
typedef std::function< void(const msp::Message &)> | CallbackM |
typedef std::function< void(const T &)> | CallbackT |
Public Member Functions | |
virtual void | decode (msp::ByteVector &data) const override |
Virtual method for decoding received data. | |
const T & | getIoObject () const |
Gets a reference to the IO object. | |
virtual const msp::Message & | getMsgObject () const override |
Gets a reference to the internal IO object as a Message. | |
virtual void | handleResponse () const override |
Calls the receive callback if it exists. | |
virtual void | makeRequest () const override |
Calls the send callback if it exists. | |
void | setIoObject (std::unique_ptr< T > &&obj) const |
Sets the object used for packing and unpacking data. | |
void | setReceiveCallback (const CallbackT &recv_callback) const |
Sets the callback to be executed on success. | |
void | setSendCallback (const CallbackM &send_callback) const |
Sets the callback used to send the request. | |
Subscription () | |
Subscription constructor. | |
Subscription (const CallbackT &recv_callback, const CallbackM &send_callback, std::unique_ptr< T > &&io_object, const double &period=0.0) | |
Subscription constructor setting all parameters. | |
Protected Attributes | |
std::unique_ptr< T > | io_object_ |
CallbackT | recv_callback_ |
CallbackM | send_callback_ |
Definition at line 88 of file Subscription.hpp.
typedef std::function<void(const msp::Message&)> msp::client::Subscription< T >::CallbackM |
Definition at line 91 of file Subscription.hpp.
typedef std::function<void(const T&)> msp::client::Subscription< T >::CallbackT |
Definition at line 90 of file Subscription.hpp.
msp::client::Subscription< T >::Subscription | ( | ) | [inline] |
Subscription constructor.
Definition at line 96 of file Subscription.hpp.
msp::client::Subscription< T >::Subscription | ( | const CallbackT & | recv_callback, |
const CallbackM & | send_callback, | ||
std::unique_ptr< T > && | io_object, | ||
const double & | period = 0.0 |
||
) | [inline] |
Subscription constructor setting all parameters.
recv_callback | Callback to execute upon receipt of message |
send_callback | Callback to execute periodically to send message |
io_object | Object which is used for encoding/decoding data |
period | Repition rate of the request |
Definition at line 105 of file Subscription.hpp.
virtual void msp::client::Subscription< T >::decode | ( | msp::ByteVector & | data | ) | const [inline, override, virtual] |
Virtual method for decoding received data.
data | Data to be unpacked |
Implements msp::client::SubscriptionBase.
Definition at line 121 of file Subscription.hpp.
const T& msp::client::Subscription< T >::getIoObject | ( | ) | const [inline] |
virtual const msp::Message& msp::client::Subscription< T >::getMsgObject | ( | ) | const [inline, override, virtual] |
Gets a reference to the internal IO object as a Message.
Implements msp::client::SubscriptionBase.
Definition at line 144 of file Subscription.hpp.
virtual void msp::client::Subscription< T >::handleResponse | ( | ) | const [inline, override, virtual] |
Calls the receive callback if it exists.
Implements msp::client::SubscriptionBase.
Definition at line 159 of file Subscription.hpp.
virtual void msp::client::Subscription< T >::makeRequest | ( | ) | const [inline, override, virtual] |
Calls the send callback if it exists.
Implements msp::client::SubscriptionBase.
Definition at line 174 of file Subscription.hpp.
void msp::client::Subscription< T >::setIoObject | ( | std::unique_ptr< T > && | obj | ) | const [inline] |
Sets the object used for packing and unpacking data.
obj | unique_ptr to a Message-derived object |
Definition at line 130 of file Subscription.hpp.
void msp::client::Subscription< T >::setReceiveCallback | ( | const CallbackT & | recv_callback | ) | const [inline] |
Sets the callback to be executed on success.
recv_callback | the callback to be executed |
Definition at line 152 of file Subscription.hpp.
void msp::client::Subscription< T >::setSendCallback | ( | const CallbackM & | send_callback | ) | const [inline] |
Sets the callback used to send the request.
send_callback | the callback to be executed |
Definition at line 167 of file Subscription.hpp.
std::unique_ptr<T> msp::client::Subscription< T >::io_object_ [protected] |
Definition at line 181 of file Subscription.hpp.
CallbackT msp::client::Subscription< T >::recv_callback_ [protected] |
Definition at line 179 of file Subscription.hpp.
CallbackM msp::client::Subscription< T >::send_callback_ [protected] |
Definition at line 180 of file Subscription.hpp.