00001 #ifndef STATE_PUBLISHER_ZMQ_H 00002 #define STATE_PUBLISHER_ZMQ_H 00003 00004 #include <QObject> 00005 #include <QtPlugin> 00006 #include <zmq.hpp> 00007 #include <thread> 00008 #include <mutex> 00009 #include "../statepublisher_base.h" 00010 00011 00012 class StatePublisherZMQ: public QObject, StatePublisher 00013 { 00014 Q_OBJECT 00015 Q_PLUGIN_METADATA(IID "com.icarustechnology.PlotJuggler.StatePublisher" "../statepublisher.json") 00016 Q_INTERFACES(StatePublisher) 00017 00018 public: 00019 StatePublisherZMQ(); 00020 00021 virtual void updateState(PlotDataMap* datamap, double current_time); 00022 00023 virtual ~StatePublisherZMQ(); 00024 00025 private: 00026 PlotDataMap* _prev_dataplot; 00027 00028 void run_thread(); 00029 00030 std::thread _thread; 00031 std::mutex _mutex; 00032 00033 std::map<QString, double> _current_data; 00034 double _prev_time; 00035 00036 00037 }; 00038 00039 #endif // STATE_PUBLISHER_ZMQ_H