Public Types | Public Member Functions | Private Attributes | Friends | List of all members
ecl::Topic< Data > Class Template Reference

Stores publisher and subscriber lists to a uniquely string identified topic. More...

#include <topic.hpp>

Public Types

typedef std::set< SigSlot< Data > * > Subscribers
 A list of subscribers (slots) to a given topic. More...
 

Public Member Functions

void addPublisher (SigSlot< Data > *sigslot)
 Add a publisher. More...
 
void addSubscriber (SigSlot< Data > *sigslot)
 Add a subscriber. More...
 
void disconnect (SigSlot< Data > *sigslot)
 Disconnect a sigslot. More...
 
bool empty () const
 Checks to see if there is no publishers/subscribers. More...
 
const Subscriberssubscribers () const
 List of subscribers (listeners) to a topic. More...
 
 Topic (const std::string &name)
 Uniquely construct with the specified name. More...
 

Private Attributes

std::string topic_name
 
std::set< SigSlot< Data > * > topic_publishers
 
std::set< SigSlot< Data > * > topic_subscribers
 

Friends

template<typename OutputStream , typename TopicData >
OutputStream & operator<< (OutputStream &ostream, const Topic< TopicData > &topic)
 

Detailed Description

template<typename Data>
class ecl::Topic< Data >

Stores publisher and subscriber lists to a uniquely string identified topic.

This is not for direct use, its the storage container for the sigslots manager.

Definition at line 51 of file topic.hpp.

Member Typedef Documentation

◆ Subscribers

template<typename Data >
typedef std::set<SigSlot<Data>*> ecl::Topic< Data >::Subscribers

A list of subscribers (slots) to a given topic.

Definition at line 58 of file topic.hpp.

Constructor & Destructor Documentation

◆ Topic()

template<typename Data >
ecl::Topic< Data >::Topic ( const std::string &  name)
inline

Uniquely construct with the specified name.

Parameters
name: name of the topic.

Definition at line 64 of file topic.hpp.

Member Function Documentation

◆ addPublisher()

template<typename Data >
void ecl::Topic< Data >::addPublisher ( SigSlot< Data > *  sigslot)
inline

Add a publisher.

Parameters
sigslot: the sigslot to add.

Definition at line 83 of file topic.hpp.

◆ addSubscriber()

template<typename Data >
void ecl::Topic< Data >::addSubscriber ( SigSlot< Data > *  sigslot)
inline

Add a subscriber.

Parameters
sigslot: the sigslot to add.

Definition at line 76 of file topic.hpp.

◆ disconnect()

template<typename Data >
void ecl::Topic< Data >::disconnect ( SigSlot< Data > *  sigslot)
inline

Disconnect a sigslot.

This parses both publishers and subscribers looking for the sigslot to connect. Could be a bit heavy doing it this way, but its convenient.

Parameters
sigslot: the sigslot to disconnect.

Definition at line 94 of file topic.hpp.

◆ empty()

template<typename Data >
bool ecl::Topic< Data >::empty ( ) const
inline

Checks to see if there is no publishers/subscribers.

This is used to delete the topic (by the manager) if it is empty.

Returns
bool : empty (true) or not (false).

Definition at line 110 of file topic.hpp.

◆ subscribers()

template<typename Data >
const Subscribers* ecl::Topic< Data >::subscribers ( ) const
inline

List of subscribers (listeners) to a topic.

Returns
Subscribers : handle to the list.

Definition at line 70 of file topic.hpp.

Friends And Related Function Documentation

◆ operator<<

template<typename Data >
template<typename OutputStream , typename TopicData >
OutputStream& operator<< ( OutputStream &  ostream,
const Topic< TopicData > &  topic 
)
friend

Insertion operator for sending the topic to an output stream.

Parameters
ostream: the output stream.
topic: the topic to be inserted.
Returns
OutputStream : continue streaming with the updated output stream.

Definition at line 136 of file topic.hpp.

Member Data Documentation

◆ topic_name

template<typename Data >
std::string ecl::Topic< Data >::topic_name
private

Definition at line 127 of file topic.hpp.

◆ topic_publishers

template<typename Data >
std::set<SigSlot<Data>*> ecl::Topic< Data >::topic_publishers
private

Definition at line 128 of file topic.hpp.

◆ topic_subscribers

template<typename Data >
std::set<SigSlot<Data>*> ecl::Topic< Data >::topic_subscribers
private

Definition at line 129 of file topic.hpp.


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


ecl_sigslots
Author(s): Daniel Stonier
autogenerated on Sun Aug 2 2020 03:12:19