14 #ifndef ECL_SIGSLOTS_MANAGER_HPP_ 15 #define ECL_SIGSLOTS_MANAGER_HPP_ 48 template<
typename Data = Vo
id>
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 connectSlot(const std::string &topic, SigSlot< Data > *sigslot)
const Subscribers * subscribers() const
List of subscribers (listeners) to a topic.
static const Subscribers & subscribers(const std::string &topic)
Provides a list of subscribers (listeners) associated with a topic.
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 std::map< std::string, Topic< Data > > & topics()
Hack to create a static variable internally without.
Simple structure holding publishers and subscribers to a topic.
Topic< Data >::Subscribers Subscribers
A list of subscribers (slots) to a given topic.
void addPublisher(SigSlot< Data > *sigslot)
Add a publisher.
The sigslots connection manager.
static void printStatistics()
Print some statistics on the current status of the manager.
static void disconnect(const std::string &topic, SigSlot< Data > *sigslot)
Disconnect the sigslot from the specified topic.
void addSubscriber(SigSlot< Data > *sigslot)
Add a subscriber.
static bool isTopic(const std::string &topic)
Check to see if the specified topic exists (and is being used).
Not for direct use, provides the power behind both signals and slots.
static const Subscribers * connectSignal(const std::string &topic, SigSlot< Data > *sigslot)