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

Not for direct use, provides the power behind both signals and slots. More...

#include <sigslot.hpp>

List of all members.

Public Types

typedef std::map< std::string,
const Subscribers * > 
PublicationMap
 Stores publishing topics and their followers.
typedef Topic< Data >::Subscribers Subscribers
 A list of subscribers (slots) to a given topic.

Public Member Functions

void connectSignal (const std::string &topic)
 Connect a signal to the specified topic.
void connectSlot (const std::string &topic)
 Connect a slot to the specified topic.
void decrHandles ()
 Decrement the counter for the number of copies of this object.
void disconnect (const std::string &topic)
 Disconnect the sigslot from the specified topic.
void disconnect ()
 Disconnect the sigslot from all topics.
void emit (Data data)
 Emit a signal along with the specified data.
const unsigned int & handles () const
 Number of copies of this object.
void incrHandles ()
 Increment the counter for the number of copies of this object.
void process (Data data)
 Process the callback function loaded into this sigslot.
 SigSlot ()
 SigSlot (void(*f)(Data))
template<typename C >
 SigSlot (void(C::*f)(Data), C &c)
const std::set< std::string > & subscribedTopics ()
 ~SigSlot ()
 Disconnects the sigslot completely.

Private Attributes

UnaryFunction< Data, void > * function
Mutex mutex
unsigned int number_of_handles
unsigned int processing_count
PublicationMap publications
std::set< std::string > subscriptions

Detailed Description

template<typename Data = Void>
class ecl::SigSlot< Data >

Not for direct use, provides the power behind both signals and slots.

This is the workhorse for both signals and slots, providing the implementation for all the functions necessary by both types of frontends.

Definition at line 46 of file sigslot.hpp.


Member Typedef Documentation

template<typename Data = Void>
typedef std::map<std::string, const Subscribers*> ecl::SigSlot< Data >::PublicationMap

Stores publishing topics and their followers.

Definition at line 52 of file sigslot.hpp.

template<typename Data = Void>
typedef Topic<Data>::Subscribers ecl::SigSlot< Data >::Subscribers

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

Definition at line 51 of file sigslot.hpp.


Constructor & Destructor Documentation

template<typename Data = Void>
ecl::SigSlot< Data >::SigSlot ( ) [inline]

Used only by signals where the function callback automatically defaults to the emit() function.

Definition at line 61 of file sigslot.hpp.

template<typename Data = Void>
ecl::SigSlot< Data >::SigSlot ( void(*)(Data)  f) [inline]

Used by slots loading global or static functions.

Parameters:
f: the global/static function.

Definition at line 69 of file sigslot.hpp.

template<typename Data = Void>
template<typename C >
ecl::SigSlot< Data >::SigSlot ( void(C::*)(Data)  f,
C &  c 
) [inline]

Used by slots loading a member function.

Parameters:
f: the member function to load.
c: the instance for the member function's class.
Template Parameters:
C: the member function's class type.

Definition at line 80 of file sigslot.hpp.

template<typename Data = Void>
ecl::SigSlot< Data >::~SigSlot ( ) [inline]

Disconnects the sigslot completely.

This is a rather elaborate process, it must first disconnect from any signals to ensure no new callbacks are instantiated, then check to see that there are no callbacks actually running, block if so, then finalise any deletions.

Definition at line 91 of file sigslot.hpp.


Member Function Documentation

template<typename Data = Void>
void ecl::SigSlot< Data >::connectSignal ( const std::string &  topic) [inline]

Connect a signal to the specified topic.

If the topic doesn't exist, it will be created and the signal connected. If it does exist, it will connect with a set of slots also currently linked to the topic.

Definition at line 138 of file sigslot.hpp.

template<typename Data = Void>
void ecl::SigSlot< Data >::connectSlot ( const std::string &  topic) [inline]

Connect a slot to the specified topic.

If the topic doesn't exist, it will be created and the slot connected. If it does exist, it will pass on its link details to any signals also connected to the topic.

Definition at line 156 of file sigslot.hpp.

template<typename Data = Void>
void ecl::SigSlot< Data >::decrHandles ( ) [inline]

Decrement the counter for the number of copies of this object.

Definition at line 99 of file sigslot.hpp.

template<typename Data = Void>
void ecl::SigSlot< Data >::disconnect ( const std::string &  topic) [inline]

Disconnect the sigslot from the specified topic.

Definition at line 167 of file sigslot.hpp.

template<typename Data = Void>
void ecl::SigSlot< Data >::disconnect ( ) [inline]

Disconnect the sigslot from all topics.

This completely disconnects the sigslot.

Definition at line 177 of file sigslot.hpp.

template<typename Data = Void>
void ecl::SigSlot< Data >::emit ( Data  data) [inline]

Emit a signal along with the specified data.

This is used by signals when emitting to slots.

Definition at line 106 of file sigslot.hpp.

template<typename Data = Void>
const unsigned int& ecl::SigSlot< Data >::handles ( ) const [inline]

Number of copies of this object.

Definition at line 97 of file sigslot.hpp.

template<typename Data = Void>
void ecl::SigSlot< Data >::incrHandles ( ) [inline]

Increment the counter for the number of copies of this object.

Definition at line 98 of file sigslot.hpp.

template<typename Data = Void>
void ecl::SigSlot< Data >::process ( Data  data) [inline]

Process the callback function loaded into this sigslot.

This is used by slots with their loaded functions or relaying signals with their emit() methods.

Definition at line 123 of file sigslot.hpp.

template<typename Data = Void>
const std::set<std::string>& ecl::SigSlot< Data >::subscribedTopics ( ) [inline]

Definition at line 190 of file sigslot.hpp.


Member Data Documentation

template<typename Data = Void>
UnaryFunction<Data,void>* ecl::SigSlot< Data >::function [private]

Definition at line 199 of file sigslot.hpp.

template<typename Data = Void>
Mutex ecl::SigSlot< Data >::mutex [private]

Definition at line 193 of file sigslot.hpp.

template<typename Data = Void>
unsigned int ecl::SigSlot< Data >::number_of_handles [private]

Definition at line 195 of file sigslot.hpp.

template<typename Data = Void>
unsigned int ecl::SigSlot< Data >::processing_count [private]

Definition at line 194 of file sigslot.hpp.

template<typename Data = Void>
PublicationMap ecl::SigSlot< Data >::publications [private]

Definition at line 197 of file sigslot.hpp.

template<typename Data = Void>
std::set<std::string> ecl::SigSlot< Data >::subscriptions [private]

Definition at line 196 of file sigslot.hpp.


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


ecl_sigslots
Author(s): Daniel Stonier
autogenerated on Wed Aug 26 2015 11:27:23