Go to the documentation of this file.00001 #ifndef _UTILITIES_MESSAGE_SUBSCRIBER_REGISTRY_H_
00002 #define _UTILITIES_MESSAGE_SUBSCRIBER_REGISTRY_H_
00003
00004 #include <QMap>
00005 #include <QString>
00006 #include "utilities/message_broker.h"
00007 #include "utilities/message_subscriber.h"
00008
00009 namespace utilities
00010 {
00011 class MessageSubscriberRegistry : public MessageBroker
00012 {
00013 Q_OBJECT
00014 public:
00015 MessageSubscriberRegistry(
00016 QObject* parent = NULL,
00017 const ros::NodeHandle& nh = ros::NodeHandle("~"));
00018 virtual ~MessageSubscriberRegistry();
00019 const ros::NodeHandle& getNodeHandle() const;
00020 bool subscribe(const QString& topic, QObject* receiver, const char* method,
00021 const PropertyMap& properties = PropertyMap(),
00022 Qt::ConnectionType type = Qt::AutoConnection);
00023 bool unsubscribe(const QString& topic, QObject* receiver,
00024 const char* method = 0);
00025
00026 private:
00027 typedef QMap<QString, MessageSubscriber*>::iterator iterator;
00028 typedef QMap<QString, MessageSubscriber*>::const_iterator const_iterator;
00029 ros::NodeHandle nh_;
00030 QMap<QString, MessageSubscriber*> subscribers_;
00031
00032 private slots:
00033 void subscriberAboutToBeDestroyed();
00034 };
00035 }
00036
00037 #endif // _UTILITIES_MESSAGE_SUBSCRIBER_REGISTRY_H_