MRPT  1.9.9
mrpt::comms::Topic Class Reference

Detailed Description

Definition at line 51 of file nodelets.h.

#include <mrpt/comms/nodelets.h>

Inheritance diagram for mrpt::comms::Topic:
Inheritance graph

Public Types

using Ptr = std::shared_ptr< Topic >
 

Public Member Functions

 ~Topic ()
 
template<typename ARG , typename Callable >
Subscriber::Ptr createSubscriber (Callable &&func)
 
void publish (const std::any &any)
 
void cleanupSubscriber (std::list< std::weak_ptr< Subscriber >>::iterator it)
 

Static Public Member Functions

template<typename CLEANUP >
static Ptr create (CLEANUP &&cleanup)
 

Private Member Functions

 Topic (std::function< void()> &&cleanup)
 

Private Attributes

std::mutex m_mutex
 
std::list< std::weak_ptr< Subscriber > > m_subs
 
std::function< void()> m_cleanup
 

Member Typedef Documentation

◆ Ptr

Definition at line 57 of file nodelets.h.

Constructor & Destructor Documentation

◆ Topic()

Topic::Topic ( std::function< void()> &&  cleanup)
private

Definition at line 36 of file nodelets.cpp.

Referenced by create().

◆ ~Topic()

Topic::~Topic ( )

Definition at line 37 of file nodelets.cpp.

References m_cleanup.

Member Function Documentation

◆ cleanupSubscriber()

void Topic::cleanupSubscriber ( std::list< std::weak_ptr< Subscriber >>::iterator  it)

Definition at line 48 of file nodelets.cpp.

References m_mutex, and m_subs.

◆ create()

template<typename CLEANUP >
static Ptr mrpt::comms::Topic::create ( CLEANUP &&  cleanup)
inlinestatic

Definition at line 96 of file nodelets.h.

References Topic().

Referenced by mrpt::comms::TopicDirectory::getTopic().

◆ createSubscriber()

template<typename ARG , typename Callable >
Subscriber::Ptr mrpt::comms::Topic::createSubscriber ( Callable &&  func)
inline

◆ publish()

void Topic::publish ( const std::any &  any)

Definition at line 39 of file nodelets.cpp.

References m_mutex, and m_subs.

Member Data Documentation

◆ m_cleanup

std::function<void()> mrpt::comms::Topic::m_cleanup
private

Definition at line 104 of file nodelets.h.

Referenced by ~Topic().

◆ m_mutex

std::mutex mrpt::comms::Topic::m_mutex
private

Definition at line 102 of file nodelets.h.

Referenced by cleanupSubscriber(), createSubscriber(), and publish().

◆ m_subs

std::list<std::weak_ptr<Subscriber> > mrpt::comms::Topic::m_subs
private

Definition at line 103 of file nodelets.h.

Referenced by cleanupSubscriber(), createSubscriber(), and publish().




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020