rad  3.0.0
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 >
 
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_service &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
 
 TopicSub (boost::asio::io_service &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.

Class to subscribe and receive topics.

Todo:
Fix asio ownership problem.

Member Typedef Documentation

◆ TopicHandler_t [1/2]

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

◆ TopicHandler_t [2/2]

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

◆ TopicHandlerMap_t [1/2]

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

◆ TopicHandlerMap_t [2/2]

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

Constructor & Destructor Documentation

◆ TopicSub() [1/6]

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

◆ ~TopicSub() [1/2]

rad::TopicSub::~TopicSub ( )

◆ TopicSub() [2/6]

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

◆ TopicSub() [3/6]

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

◆ TopicSub() [4/6]

rad::TopicSub::TopicSub ( boost::asio::io_service &  ios,
std::unique_ptr< TopicHandler > &&  fallback 
)

◆ ~TopicSub() [2/2]

rad::TopicSub::~TopicSub ( )

◆ TopicSub() [5/6]

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

◆ TopicSub() [6/6]

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

Member Function Documentation

◆ Connect() [1/2]

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.

◆ Connect() [2/2]

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

◆ Disconnect() [1/2]

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

Disconnect the socket from an endpoint.

Parameters
[in]endpointWhere to get the topics from.

◆ Disconnect() [2/2]

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

◆ Flush() [1/2]

void rad::TopicSub::Flush ( )

Flush the socket buffers from topics.

◆ Flush() [2/2]

void rad::TopicSub::Flush ( )

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ Subscribe() [1/4]

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

Subscribe to a topic.

Parameters
[in]topic_nameTopic to subscribe.

◆ Subscribe() [2/4]

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

◆ Subscribe() [3/4]

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.

◆ Subscribe() [4/4]

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

◆ Unsubscribe() [1/2]

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

Unsubscribe a topic.

Parameters
[in]topic_nameTopic to unsubscribe.

◆ Unsubscribe() [2/2]

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

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