Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef CARTOGRAPHER_ROS_METRICS_INTERNAL_COUNTER_H
00018 #define CARTOGRAPHER_ROS_METRICS_INTERNAL_COUNTER_H
00019
00020 #include "cartographer/metrics/counter.h"
00021 #include "cartographer_ros/metrics/internal/gauge.h"
00022 #include "cartographer_ros_msgs/Metric.h"
00023
00024 namespace cartographer_ros {
00025 namespace metrics {
00026
00027 class Counter : public ::cartographer::metrics::Counter {
00028 public:
00029 explicit Counter(const std::map<std::string, std::string>& labels)
00030 : gauge_(labels) {}
00031
00032 void Increment(const double value) override { gauge_.Increment(value); }
00033
00034 void Increment() override { gauge_.Increment(); }
00035
00036 double Value() { return gauge_.Value(); }
00037
00038 cartographer_ros_msgs::Metric ToRosMessage() {
00039 cartographer_ros_msgs::Metric msg = gauge_.ToRosMessage();
00040 msg.type = cartographer_ros_msgs::Metric::TYPE_COUNTER;
00041 return msg;
00042 }
00043
00044 private:
00045 Gauge gauge_;
00046 };
00047
00048 }
00049 }
00050
00051 #endif // CARTOGRAPHER_ROS_METRICS_INTERNAL_COUNTER_H