Template Class SigSlot

Class Documentation

template<typename Data = Void>
class SigSlot

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.

Public Types

typedef Topic<Data>::Subscribers Subscribers

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

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

Stores publishing topics and their followers.

Public Functions

inline SigSlot()

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

inline SigSlot(void (*f)(Data))

Used by slots loading global or static functions.

Parameters:

f – : the global/static function.

template<typename C>
inline SigSlot(void (C::* f)(Data), C &c)

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.

inline ~SigSlot()

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.

inline const unsigned int &handles() const

Number of copies of this object.

inline void incrHandles()

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

inline void decrHandles()

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

inline void emit(Data data)

Emit a signal along with the specified data.

This is used by signals when emitting to slots.

inline void process(Data data)

Process the callback function loaded into this sigslot.

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

inline void connectSignal(const std::string &topic)

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.

inline void connectSlot(const std::string &topic)

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.

inline void disconnect(const std::string &topic)

Disconnect the sigslot from the specified topic.

inline void disconnect()

Disconnect the sigslot from all topics.

This completely disconnects the sigslot.

inline const std::set<std::string> &subscribedTopics()