Public Types | Public Member Functions | Protected Attributes | List of all members
msp::client::Subscription< T > Class Template Reference

#include <Subscription.hpp>

Inheritance diagram for msp::client::Subscription< T >:
Inheritance graph
[legend]

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. More...
 
const T & getIoObject () const
 Gets a reference to the IO object. More...
 
virtual const msp::MessagegetMsgObject () const override
 Gets a reference to the internal IO object as a Message. More...
 
virtual void handleResponse () const override
 Calls the receive callback if it exists. More...
 
virtual void makeRequest () const override
 Calls the send callback if it exists. More...
 
void setIoObject (std::unique_ptr< T > &&obj) const
 Sets the object used for packing and unpacking data. More...
 
void setReceiveCallback (const CallbackT &recv_callback) const
 Sets the callback to be executed on success. More...
 
void setSendCallback (const CallbackM &send_callback) const
 Sets the callback used to send the request. More...
 
 Subscription ()
 Subscription constructor. More...
 
 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. More...
 
- Public Member Functions inherited from msp::client::SubscriptionBase
bool hasTimer () const
 Checks to see if the timer has been created. More...
 
bool isAutomatic () const
 Checks to see if the subscription fires automatically. More...
 
void setTimerFrequency (const double &rate_hz)
 setTimerFrequency change the update rate of timer More...
 
void setTimerPeriod (const double &period_seconds)
 setTimerPeriod change the period of the timer More...
 
bool start () const
 Start the timer for automatic execution. More...
 
bool stop () const
 Stop the timer's automatic execution. More...
 
 SubscriptionBase ()
 
virtual ~SubscriptionBase ()
 

Protected Attributes

std::unique_ptr< T > io_object_
 
CallbackT recv_callback_
 
CallbackM send_callback_
 
- Protected Attributes inherited from msp::client::SubscriptionBase
std::unique_ptr< PeriodicTimertimer_
 

Detailed Description

template<typename T>
class msp::client::Subscription< T >

Definition at line 88 of file Subscription.hpp.

Member Typedef Documentation

template<typename T >
typedef std::function<void(const msp::Message&)> msp::client::Subscription< T >::CallbackM

Definition at line 91 of file Subscription.hpp.

template<typename T >
typedef std::function<void(const T&)> msp::client::Subscription< T >::CallbackT

Definition at line 90 of file Subscription.hpp.

Constructor & Destructor Documentation

template<typename T >
msp::client::Subscription< T >::Subscription ( )
inline

Subscription constructor.

Definition at line 96 of file Subscription.hpp.

template<typename T >
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.

Parameters
recv_callbackCallback to execute upon receipt of message
send_callbackCallback to execute periodically to send message
io_objectObject which is used for encoding/decoding data
periodRepition rate of the request

Definition at line 105 of file Subscription.hpp.

Member Function Documentation

template<typename T >
virtual void msp::client::Subscription< T >::decode ( msp::ByteVector data) const
inlineoverridevirtual

Virtual method for decoding received data.

Parameters
dataData to be unpacked

Implements msp::client::SubscriptionBase.

Definition at line 121 of file Subscription.hpp.

template<typename T >
const T& msp::client::Subscription< T >::getIoObject ( ) const
inline

Gets a reference to the IO object.

Returns

Definition at line 138 of file Subscription.hpp.

template<typename T >
virtual const msp::Message& msp::client::Subscription< T >::getMsgObject ( ) const
inlineoverridevirtual

Gets a reference to the internal IO object as a Message.

Returns
reference to a Message

Implements msp::client::SubscriptionBase.

Definition at line 144 of file Subscription.hpp.

template<typename T >
virtual void msp::client::Subscription< T >::handleResponse ( ) const
inlineoverridevirtual

Calls the receive callback if it exists.

Implements msp::client::SubscriptionBase.

Definition at line 159 of file Subscription.hpp.

template<typename T >
virtual void msp::client::Subscription< T >::makeRequest ( ) const
inlineoverridevirtual

Calls the send callback if it exists.

Implements msp::client::SubscriptionBase.

Definition at line 174 of file Subscription.hpp.

template<typename T >
void msp::client::Subscription< T >::setIoObject ( std::unique_ptr< T > &&  obj) const
inline

Sets the object used for packing and unpacking data.

Parameters
objunique_ptr to a Message-derived object

Definition at line 130 of file Subscription.hpp.

template<typename T >
void msp::client::Subscription< T >::setReceiveCallback ( const CallbackT recv_callback) const
inline

Sets the callback to be executed on success.

Parameters
recv_callbackthe callback to be executed

Definition at line 152 of file Subscription.hpp.

template<typename T >
void msp::client::Subscription< T >::setSendCallback ( const CallbackM send_callback) const
inline

Sets the callback used to send the request.

Parameters
send_callbackthe callback to be executed

Definition at line 167 of file Subscription.hpp.

Member Data Documentation

template<typename T >
std::unique_ptr<T> msp::client::Subscription< T >::io_object_
protected

Definition at line 181 of file Subscription.hpp.

template<typename T >
CallbackT msp::client::Subscription< T >::recv_callback_
protected

Definition at line 179 of file Subscription.hpp.

template<typename T >
CallbackM msp::client::Subscription< T >::send_callback_
protected

Definition at line 180 of file Subscription.hpp.


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


msp
Author(s): Christian Rauch
autogenerated on Tue Oct 6 2020 03:39:02