Apollo 10.0
自动驾驶开放平台
channel_verify.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16#pragma once
17
18#include <map>
19#include <memory>
20#include <set>
21#include <string>
22#include <utility>
23#include <vector>
24
25#include "modules/map/tools/map_datachecker/proto/collection_error_code.pb.h"
26
28
29namespace apollo {
30namespace hdmap {
31
33 std::string channel_name;
34 uint64_t msgnum;
35 std::string msg_type;
36};
37
39 std::string path;
40 double duration; // the unit is seconds
41 uint64_t start_time;
42 uint64_t end_time;
43 std::vector<CyberRecordChannel> channels;
44};
45
47 std::string record_path;
48 uint64_t start_time = 0;
49 std::vector<std::string> lack_channels;
50 // inadequate_rate: channel_name <---> (expected_rate, actual_rate)
51 std::map<std::string, std::pair<double, double>> inadequate_rate;
52};
53
54typedef std::shared_ptr<std::vector<OneRecordChannelCheckResult>> CheckedResult;
55typedef std::vector<OneRecordChannelCheckResult>::iterator CheckResultIterator;
56
58 public:
59 explicit ChannelVerify(std::shared_ptr<JsonConf> sp_conf);
60 ErrorCode Check(const std::string& record_dir_or_record_full_path);
61 std::shared_ptr<std::vector<OneRecordChannelCheckResult>> get_check_result()
62 const;
64
65 private:
66 bool IsRecordFile(const std::string& path) const;
67 std::shared_ptr<CyberRecordInfo> GetRecordInfo(
68 const std::string& record_path) const;
69 int IncrementalCheck(const std::vector<std::string>& records_path);
70 std::vector<std::string> GetRecordsPath(
71 const std::string& record_dir_or_record_full_path) const;
72 bool IsRecordChecked(const std::string& record_path);
73 OneRecordChannelCheckResult CheckRecordChannels(
74 const std::string& record_path);
75 void Reset();
76
77 private:
78 std::shared_ptr<JsonConf> sp_conf_ = nullptr;
79 CheckedResult sp_vec_check_result_ = nullptr;
80 ErrorCode return_state_;
81 std::set<std::string> checked_records_;
82};
83
84} // namespace hdmap
85} // namespace apollo
std::shared_ptr< std::vector< OneRecordChannelCheckResult > > get_check_result() const
ErrorCode Check(const std::string &record_dir_or_record_full_path)
std::shared_ptr< std::vector< OneRecordChannelCheckResult > > CheckedResult
std::vector< OneRecordChannelCheckResult >::iterator CheckResultIterator
class register implement
Definition arena_queue.h:37
std::vector< CyberRecordChannel > channels
std::vector< std::string > lack_channels
std::map< std::string, std::pair< double, double > > inadequate_rate