family_factory.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_FAMILY_FACTORY_H
00018 #define CARTOGRAPHER_ROS_METRICS_FAMILY_FACTORY_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/family.h"
00026 #include "cartographer_ros/metrics/internal/gauge.h"
00027 #include "cartographer_ros/metrics/internal/histogram.h"
00028 #include "cartographer_ros_msgs/ReadMetrics.h"
00029 
00030 namespace cartographer_ros {
00031 namespace metrics {
00032 
00033 // Realizes the factory / registry interface for the metrics in libcartographer
00034 // and provides a wrapper to collect ROS messages from the metrics it owns.
00035 class FamilyFactory : public ::cartographer::metrics::FamilyFactory {
00036  public:
00037   ::cartographer::metrics::Family<::cartographer::metrics::Counter>*
00038 
00039   NewCounterFamily(const std::string& name,
00040                    const std::string& description) override;
00041   ::cartographer::metrics::Family<::cartographer::metrics::Gauge>*
00042   NewGaugeFamily(const std::string& name,
00043                  const std::string& description) override;
00044   ::cartographer::metrics::Family<::cartographer::metrics::Histogram>*
00045   NewHistogramFamily(const std::string& name, const std::string& description,
00046                      const ::cartographer::metrics::Histogram::BucketBoundaries&
00047                          boundaries) override;
00048 
00049   void ReadMetrics(
00050       ::cartographer_ros_msgs::ReadMetrics::Response* response) const;
00051 
00052  private:
00053   std::vector<std::unique_ptr<CounterFamily>> counter_families_;
00054   std::vector<std::unique_ptr<GaugeFamily>> gauge_families_;
00055   std::vector<std::unique_ptr<HistogramFamily>> histogram_families_;
00056 };
00057 
00058 }  // namespace metrics
00059 }  // namespace cartographer_ros
00060 
00061 #endif  // CARTOGRAPHER_ROS_METRICS_FAMILY_FACTORY_H


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