family.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2018 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
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 }  // namespace metrics
00079 }  // namespace cartographer_ros
00080 
00081 #endif  // CARTOGRAPHER_ROS_METRICS_INTERNAL_FAMILY_H


cartographer_ros
Author(s): The Cartographer Authors
autogenerated on Wed Jul 10 2019 04:10:28