message_field_subscriber.h
Go to the documentation of this file.
00001 #ifndef _UTILITIES_MESSAGE_FIELD_SUBSCRIBER_H_
00002 #define _UTILITIES_MESSAGE_FIELD_SUBSCRIBER_H_
00003 
00004 #include <QObject>
00005 #include <variant_topic_tools/BuiltinVariant.h>
00006 
00007 namespace utilities
00008 {
00009 class Message;
00010 class MessageField;
00011 class MessageSubscriberRegistry;
00012 
00013 class MessageFieldSubscriber : public QObject
00014 {
00015   Q_OBJECT
00016 public:
00017   MessageFieldSubscriber(QObject* parent, const QString& type,
00018                          const QString& field, MessageSubscriberRegistry* registry = NULL);
00019   virtual ~MessageFieldSubscriber();
00020   variant_topic_tools::BuiltinVariant getCurrentFieldValue() const;
00021   MessageSubscriberRegistry* getRegistry() const;
00022   void setRegistry(MessageSubscriberRegistry* registry);
00023   bool isSubscribed() const;
00024   void subscribe(const QString &topic, const size_t& queue_size);
00025   void unsubscribe();
00026 
00027 signals:
00028   void subscribed();
00029   void received(const variant_topic_tools::BuiltinVariant& field_value);
00030   void unsubscribed();
00031 
00032 private:
00033   bool subscribed_;
00034   QString subscribed_topic_;
00035   MessageField* field_;
00036   variant_topic_tools::BuiltinVariant current_field_value_;
00037   MessageSubscriberRegistry* registry_;
00038 
00039 private slots:
00040   void subscriberMessageReceived(const QString& topic, const Message& message);
00041 };
00042 }
00043 
00044 #endif // _UTILITIES_MESSAGE_FIELD_SUBSCRIBER_H_


rqt_mrta
Author(s): Adriano Henrique Rossette Leite
autogenerated on Thu Jun 6 2019 18:50:52