Apollo  6.0
Open source self driving car software
record_base.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 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 
17 #ifndef CYBER_RECORD_RECORD_BASE_H_
18 #define CYBER_RECORD_RECORD_BASE_H_
19 
20 #include <cstdint>
21 #include <set>
22 #include <string>
23 
24 #include "cyber/proto/record.pb.h"
25 
26 namespace apollo {
27 namespace cyber {
28 namespace record {
29 
30 static const std::string& kEmptyString = "";
31 
35 class RecordBase {
36  public:
40  virtual ~RecordBase() = default;
41 
49  virtual uint64_t GetMessageNumber(const std::string& channel_name) const = 0;
50 
58  virtual const std::string& GetMessageType(
59  const std::string& channel_name) const = 0;
60 
68  virtual const std::string& GetProtoDesc(
69  const std::string& channel_name) const = 0;
70 
76  virtual std::set<std::string> GetChannelList() const = 0;
77 
83  const proto::Header& GetHeader() const { return header_; }
84 
90  const std::string GetFile() const { return file_; }
91 
92  protected:
93  std::string file_;
94  proto::Header header_;
95  bool is_opened_ = false;
96 };
97 
98 } // namespace record
99 } // namespace cyber
100 } // namespace apollo
101 
102 #endif // CYBER_RECORD_RECORD_BASE_H_
bool is_opened_
Definition: record_base.h:95
proto::Header header_
Definition: record_base.h:94
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::string file_
Definition: record_base.h:93
const proto::Header & GetHeader() const
Get record header.
Definition: record_base.h:83
virtual std::set< std::string > GetChannelList() const =0
Get channel list.
virtual ~RecordBase()=default
Destructor.
Base class for record reader and writer.
Definition: record_base.h:35
virtual const std::string & GetMessageType(const std::string &channel_name) const =0
Get message type by channel name.
virtual uint64_t GetMessageNumber(const std::string &channel_name) const =0
Get message number by channel name.
virtual const std::string & GetProtoDesc(const std::string &channel_name) const =0
Get proto descriptor string by channel name.
const std::string GetFile() const
Get record file path.
Definition: record_base.h:90