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_FAMILY_H
00018 #define CARTOGRAPHER_ROS_METRICS_INTERNAL_FAMILY_H
00019
00020 #include <memory>
00021 #include <string>
00022
00023 #include "cartographer/metrics/family_factory.h"
00024 #include "cartographer_ros/metrics/internal/counter.h"
00025 #include "cartographer_ros/metrics/internal/gauge.h"
00026 #include "cartographer_ros/metrics/internal/histogram.h"
00027 #include "cartographer_ros_msgs/MetricFamily.h"
00028
00029 namespace cartographer_ros {
00030 namespace metrics {
00031 class CounterFamily
00032 : public ::cartographer::metrics::Family<::cartographer::metrics::Counter> {
00033 public:
00034 CounterFamily(const std::string& name, const std::string& description)
00035 : name_(name), description_(description) {}
00036 Counter* Add(const std::map<std::string, std::string>& labels) override;
00037 cartographer_ros_msgs::MetricFamily ToRosMessage();
00038
00039 private:
00040 std::string name_;
00041 std::string description_;
00042 std::vector<std::unique_ptr<Counter>> wrappers_;
00043 };
00044
00045 class GaugeFamily
00046 : public ::cartographer::metrics::Family<::cartographer::metrics::Gauge> {
00047 public:
00048 GaugeFamily(const std::string& name, const std::string& description)
00049 : name_(name), description_(description) {}
00050 Gauge* Add(const std::map<std::string, std::string>& labels) override;
00051
00052 cartographer_ros_msgs::MetricFamily ToRosMessage();
00053
00054 private:
00055 std::string name_;
00056 std::string description_;
00057 std::vector<std::unique_ptr<Gauge>> wrappers_;
00058 };
00059
00060 class HistogramFamily : public ::cartographer::metrics::Family<
00061 ::cartographer::metrics::Histogram> {
00062 public:
00063 HistogramFamily(const std::string& name, const std::string& description,
00064 const BucketBoundaries& boundaries)
00065 : name_(name), description_(description), boundaries_(boundaries) {}
00066
00067 Histogram* Add(const std::map<std::string, std::string>& labels) override;
00068
00069 cartographer_ros_msgs::MetricFamily ToRosMessage();
00070
00071 private:
00072 std::string name_;
00073 std::string description_;
00074 std::vector<std::unique_ptr<Histogram>> wrappers_;
00075 const BucketBoundaries boundaries_;
00076 };
00077
00078 }
00079 }
00080
00081 #endif // CARTOGRAPHER_ROS_METRICS_INTERNAL_FAMILY_H