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

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

#include <topic.hpp>

List of all members.

Public Types

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

Public Member Functions

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

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 45 of file topic.hpp.


Member Typedef Documentation

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

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

Definition at line 50 of file topic.hpp.


Constructor & Destructor Documentation

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 56 of file topic.hpp.


Member Function Documentation

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

Add a publisher.

Parameters:
sigslot: the sigslot to add.

Definition at line 75 of file topic.hpp.

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

Add a subscriber.

Parameters:
sigslot: the sigslot to add.

Definition at line 68 of file topic.hpp.

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 86 of file topic.hpp.

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 102 of file topic.hpp.

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 62 of file topic.hpp.


Friends And Related Function Documentation

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 130 of file topic.hpp.


Member Data Documentation

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

Definition at line 119 of file topic.hpp.

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

Definition at line 120 of file topic.hpp.

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

Definition at line 121 of file topic.hpp.


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


ecl_sigslots
Author(s): Daniel Stonier
autogenerated on Sun Oct 5 2014 23:35:39