Go to the documentation of this file.
14 #ifndef ECL_SIGSLOTS_MANAGER_HPP_
15 #define ECL_SIGSLOTS_MANAGER_HPP_
48 template<
typename Data = Vo
id>
49 class SigSlotsManager {
52 friend class SigSlot<Data>;
60 std::cout <<
"Topics" << std::endl;
61 typename std::map< std::string, Topic<Data> >::iterator iter;
62 for ( iter =
topics().begin(); iter !=
topics().end(); ++iter ) {
63 std::cout << iter->second;
88 std::pair< typename std::map< std::string, Topic<Data> >::iterator,
bool> ret =
topics().insert( std::pair< std::string,
Topic<Data> >(topic,
Topic<Data>(topic)) );
107 std::pair< typename std::map< std::string, Topic<Data> >::iterator,
bool> ret =
topics().insert(std::pair< std::string,
Topic<Data> >(topic,
Topic<Data>(topic)) );
121 typename std::map<std::string, Topic<Data> >::iterator iter =
topics().find(topic);
122 if ( iter !=
topics().end() ) {
123 iter->second.disconnect(sigslot);
125 if ( iter->second.empty() ) {
136 static bool isTopic(
const std::string& topic) {
147 static std::map< std::string, Topic<Data> >&
topics() {
148 static std::map< std::string, Topic<Data> > topic_list;
163 typename std::map< std::string, Topic<Data> >::const_iterator iter =
topics().find(topic);
170 return *iter->second.subscribers();
static void printStatistics()
Print some statistics on the current status of the manager.
Simple structure holding publishers and subscribers to a topic.
const Subscribers * subscribers() const
List of subscribers (listeners) to a topic.
Not for direct use, provides the power behind both signals and slots.
static bool isTopic(const std::string &topic)
Check to see if the specified topic exists (and is being used).
Stores publisher and subscriber lists to a uniquely string identified topic.
std::set< SigSlot< Data > * > Subscribers
A list of subscribers (slots) to a given topic.
static const Subscribers * connectSignal(const std::string &topic, SigSlot< Data > *sigslot)
friend class SigSlot< Data >
void addSubscriber(SigSlot< Data > *sigslot)
Add a subscriber.
static const Subscribers & subscribers(const std::string &topic)
Provides a list of subscribers (listeners) associated with a topic.
static void connectSlot(const std::string &topic, SigSlot< Data > *sigslot)
static std::map< std::string, Topic< Data > > & topics()
Hack to create a static variable internally without.
void addPublisher(SigSlot< Data > *sigslot)
Add a publisher.
Topic< Data >::Subscribers Subscribers
A list of subscribers (slots) to a given topic.
static void disconnect(const std::string &topic, SigSlot< Data > *sigslot)
Disconnect the sigslot from the specified topic.
ecl_sigslots
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:47