00001 #ifndef _MRTA_SAMPLE_HOLDER_H_ 00002 #define _MRTA_SAMPLE_HOLDER_H_ 00003 00004 #include <QTimer> 00005 #include <QObject> 00006 #include <ros/duration.h> 00007 00008 namespace mrta 00009 { 00010 class StateMonitor; 00011 class SampleHolder : public QObject { 00012 Q_OBJECT 00013 public: 00014 SampleHolder(StateMonitor* monitor, const ros::Duration& timeout); 00015 ~SampleHolder(); 00016 bool isUpToDate() const; 00017 ros::Duration getTimeout() const; 00018 void setTimeout(const ros::Duration& timeout); 00019 void update(); 00020 00021 signals: 00022 void changed(); 00023 void updated(bool up_to_date); 00024 void timeoutChanged(const ros::Duration& timeout); 00025 00026 private: 00027 bool up_to_date_; 00028 ros::Duration timeout_; 00029 QTimer* timer_; 00030 void setUpToDate(bool up_to_date); 00031 00032 private slots: 00033 void expired(); 00034 }; 00035 } 00036 00037 #endif // _MRTA_SAMPLE_HOLDER_H_