rad 6.2.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
rad::TopicSub Class Reference

#include <topicSub.hpp>

Public Types

using TopicHandler_t = std::function<void(const std::string&, const void*, size_t)>
 
using TopicHandlerMap_t = std::unordered_map<std::string, TopicHandler_t>
 

Public Member Functions

 TopicSub (boost::asio::io_context &ios, std::unique_ptr< TopicHandler > &&fallback)
 
 ~TopicSub ()
 
void Subscribe (const std::string &topic_name)
 
void Subscribe (const std::string &topic_name, TopicHandler_t handler)
 
void Unsubscribe (const std::string &topic_name)
 
void Connect (const std::string &endpoint)
 
void Disconnect (const std::string &endpoint)
 
void Flush ()
 
 TopicSub (const TopicSub &)=delete
 
TopicSuboperator= (const TopicSub &)=delete
 
 TopicSub (TopicSub &&rhs)=default
 

Detailed Description

Class to subscribe and receive topics.

Todo
Fix asio ownership problem.

Member Typedef Documentation

◆ TopicHandler_t

using rad::TopicSub::TopicHandler_t = std::function<void(const std::string&, const void*, size_t)>

◆ TopicHandlerMap_t

using rad::TopicSub::TopicHandlerMap_t = std::unordered_map<std::string, TopicHandler_t>

Constructor & Destructor Documentation

◆ TopicSub() [1/3]

rad::TopicSub::TopicSub ( boost::asio::io_context & ios,
std::unique_ptr< TopicHandler > && fallback )
Parameters
[in]iosReference to the event loop.
[in]fallbackMap of handlers for given topics.

◆ ~TopicSub()

rad::TopicSub::~TopicSub ( )

◆ TopicSub() [2/3]

rad::TopicSub::TopicSub ( const TopicSub & )
delete

◆ TopicSub() [3/3]

rad::TopicSub::TopicSub ( TopicSub && rhs)
default

Member Function Documentation

◆ Connect()

void rad::TopicSub::Connect ( const std::string & endpoint)

Connect the socket to an endpoint to receive topics.

Parameters
[in]endpointWhere to get the topics from.

◆ Disconnect()

void rad::TopicSub::Disconnect ( const std::string & endpoint)

Disconnect the socket from an endpoint.

Parameters
[in]endpointWhere to get the topics from.

◆ Flush()

void rad::TopicSub::Flush ( )

Flush the socket buffers from topics.

◆ operator=()

TopicSub & rad::TopicSub::operator= ( const TopicSub & )
delete

◆ Subscribe() [1/2]

void rad::TopicSub::Subscribe ( const std::string & topic_name)

Subscribe to a topic.

Parameters
[in]topic_nameTopic to subscribe.

◆ Subscribe() [2/2]

void rad::TopicSub::Subscribe ( const std::string & topic_name,
TopicHandler_t handler )

Subscribe to a topic.

Parameters
[in]topic_nameTopic to subscribe.
[in]handlerHandler for the subscribed topic_name.

◆ Unsubscribe()

void rad::TopicSub::Unsubscribe ( const std::string & topic_name)

Unsubscribe a topic.

Parameters
[in]topic_nameTopic to unsubscribe.

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