Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
uavcan::Subscriber< DataType_, Callback_ > Class Template Reference

#include <subscriber.hpp>

Inheritance diagram for uavcan::Subscriber< DataType_, Callback_ >:
Inheritance graph
[legend]

Public Types

typedef Callback_ Callback
 
typedef DataType_ DataType
 

Public Member Functions

int start (const Callback &callback)
 
 Subscriber (INode &node)
 
- Public Member Functions inherited from uavcan::GenericSubscriberBase
uint32_t getFailureCount () const
 
INodegetNode () const
 

Private Types

typedef GenericSubscriber< DataType_, DataType_, TransferListenerBaseType
 

Private Member Functions

virtual void handleReceivedDataStruct (ReceivedDataStructure< DataType_ > &msg)
 

Private Attributes

Callback callback_
 

Additional Inherited Members

- Protected Member Functions inherited from uavcan::GenericSubscriber< DataType_, DataType_, TransferListener >
void allowAnonymousTransfers ()
 
 GenericSubscriber (INode &node)
 
TransferListenergetTransferListener ()
 
int startAsMessageListener ()
 
int startAsServiceRequestListener ()
 
int startAsServiceResponseListener ()
 
void stop ()
 
virtual ~GenericSubscriber ()
 
- Protected Member Functions inherited from uavcan::GenericSubscriberBase
int genericStart (TransferListener *listener, bool(Dispatcher::*registration_method)(TransferListener *))
 
 GenericSubscriberBase (INode &node)
 
void stop (TransferListener *listener)
 
 ~GenericSubscriberBase ()
 
- Protected Attributes inherited from uavcan::GenericSubscriberBase
uint32_t failure_count_
 
INodenode_
 

Detailed Description

template<typename DataType_, typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>>
class uavcan::Subscriber< DataType_, Callback_ >

Use this class to subscribe to a message.

Template Parameters
DataType_Message data type.
Callback_Type of the callback that will be used to deliver received messages into the application. Type of the argument of the callback can be either:
  • DataType_&
  • const DataType_&
  • ReceivedDataStructure<DataType_>&
  • const ReceivedDataStructure<DataType_>& For the first two options, ReceivedDataStructure<> will be casted implicitly. In C++11 mode this type defaults to std::function<>. In C++03 mode this type defaults to a plain function pointer; use binder to call member functions as callbacks.

Definition at line 45 of file subscriber.hpp.

Member Typedef Documentation

◆ BaseType

template<typename DataType_ , typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>>
typedef GenericSubscriber<DataType_, DataType_, TransferListener> uavcan::Subscriber< DataType_, Callback_ >::BaseType
private

Definition at line 52 of file subscriber.hpp.

◆ Callback

template<typename DataType_ , typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>>
typedef Callback_ uavcan::Subscriber< DataType_, Callback_ >::Callback

Definition at line 49 of file subscriber.hpp.

◆ DataType

template<typename DataType_ , typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>>
typedef DataType_ uavcan::Subscriber< DataType_, Callback_ >::DataType

Definition at line 69 of file subscriber.hpp.

Constructor & Destructor Documentation

◆ Subscriber()

template<typename DataType_ , typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>>
uavcan::Subscriber< DataType_, Callback_ >::Subscriber ( INode node)
inlineexplicit

Definition at line 71 of file subscriber.hpp.

Member Function Documentation

◆ handleReceivedDataStruct()

template<typename DataType_ , typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>>
virtual void uavcan::Subscriber< DataType_, Callback_ >::handleReceivedDataStruct ( ReceivedDataStructure< DataType_ > &  msg)
inlineprivatevirtual

◆ start()

template<typename DataType_ , typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>>
int uavcan::Subscriber< DataType_, Callback_ >::start ( const Callback callback)
inline

Begin receiving messages. Each message will be passed to the application via the callback. Returns negative error code.

Definition at line 83 of file subscriber.hpp.

Member Data Documentation

◆ callback_

template<typename DataType_ , typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>>
Callback uavcan::Subscriber< DataType_, Callback_ >::callback_
private

Definition at line 54 of file subscriber.hpp.


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


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:05