Public Types | Public Member Functions | Private Attributes | List of all members
ecl::SigSlot< Void > Class Reference

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

#include <sigslot.hpp>

Public Types

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

Public Member Functions

void connectSignal (const std::string &topic)
 Connect a signal to the specified topic. More...
 
void connectSlot (const std::string &topic)
 Connect a slot to the specified topic. More...
 
void disconnect ()
 Disconnect the sigslot from all topics. More...
 
void disconnect (const std::string &topic)
 Disconnect the sigslot from the specified topic. More...
 
void emit ()
 Emit a signal. More...
 
void process (Void void_arg=Void())
 Process the callback function loaded into this sigslot. More...
 
 SigSlot ()
 
template<typename C >
 SigSlot (void(C::*f)(void), C &c)
 
 SigSlot (VoidFunction f)
 
 ~SigSlot ()
 Disconnects the sigslot completely. More...
 

Private Attributes

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

Detailed Description

Not for direct use, provides the power behind both void 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. This is the specialisation of the general case for void callbacks.

Definition at line 220 of file sigslot.hpp.

Member Typedef Documentation

◆ PublicationMap

typedef std::map<std::string, const Subscribers*> ecl::SigSlot< Void >::PublicationMap

Stores publishing topics and their followers.

Definition at line 226 of file sigslot.hpp.

◆ Subscribers

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

Definition at line 225 of file sigslot.hpp.

Constructor & Destructor Documentation

◆ SigSlot() [1/3]

ecl::SigSlot< Void >::SigSlot ( )
inline

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

Definition at line 232 of file sigslot.hpp.

◆ SigSlot() [2/3]

Used by slots loading global or static functions.

Parameters
f: the global/static function.

Definition at line 240 of file sigslot.hpp.

◆ SigSlot() [3/3]

template<typename C >
ecl::SigSlot< Void >::SigSlot ( void(C::*)(void)  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 251 of file sigslot.hpp.

◆ ~SigSlot()

ecl::SigSlot< Void >::~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 262 of file sigslot.hpp.

Member Function Documentation

◆ connectSignal()

void ecl::SigSlot< Void >::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 309 of file sigslot.hpp.

◆ connectSlot()

void ecl::SigSlot< Void >::connectSlot ( const std::string &  topic)
inline

Connect a slot to the specified topic.

Definition at line 323 of file sigslot.hpp.

◆ disconnect() [1/2]

void ecl::SigSlot< Void >::disconnect ( )
inline

Disconnect the sigslot from all topics.

This completely disconnects the sigslot.

Definition at line 347 of file sigslot.hpp.

◆ disconnect() [2/2]

void ecl::SigSlot< Void >::disconnect ( const std::string &  topic)
inline

Disconnect the sigslot from 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 337 of file sigslot.hpp.

◆ emit()

void ecl::SigSlot< Void >::emit ( )
inline

Emit a signal.

This is used by signals when emitting to slots.

Definition at line 277 of file sigslot.hpp.

◆ process()

void ecl::SigSlot< Void >::process ( Void  void_arg = Void())
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 294 of file sigslot.hpp.

Member Data Documentation

◆ function

NullaryFunction<void>* ecl::SigSlot< Void >::function
private

Definition at line 367 of file sigslot.hpp.

◆ mutex

Mutex ecl::SigSlot< Void >::mutex
private

Definition at line 361 of file sigslot.hpp.

◆ number_of_handles

unsigned int ecl::SigSlot< Void >::number_of_handles
private

Definition at line 363 of file sigslot.hpp.

◆ processing_count

unsigned int ecl::SigSlot< Void >::processing_count
private

Definition at line 362 of file sigslot.hpp.

◆ publications

PublicationMap ecl::SigSlot< Void >::publications
private

Definition at line 365 of file sigslot.hpp.

◆ subscriptions

std::set<std::string> ecl::SigSlot< Void >::subscriptions
private

Definition at line 364 of file sigslot.hpp.


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


ecl_sigslots
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:47