Apollo 10.0
自动驾驶开放平台
record_file_base.h
浏览该文件的文档.
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_FILE_RECORD_FILE_BASE_H_
18#define CYBER_RECORD_FILE_RECORD_FILE_BASE_H_
19
20#include <mutex>
21#include <string>
22
23#include "cyber/proto/record.pb.h"
24
25namespace apollo {
26namespace cyber {
27namespace record {
28
29const int HEADER_LENGTH = 2048;
30
32 public:
33 RecordFileBase() = default;
34 virtual ~RecordFileBase() = default;
35 virtual bool Open(const std::string& path) = 0;
36 virtual void Close() = 0;
37 const std::string& GetPath() const { return path_; }
38 const proto::Header& GetHeader() const { return header_; }
39 const proto::Index& GetIndex() const { return index_; }
40 int64_t CurrentPosition();
41 bool SetPosition(int64_t position);
42
43 protected:
44 std::mutex mutex_;
45 std::string path_;
48 int fd_ = -1;
49};
50
51} // namespace record
52} // namespace cyber
53} // namespace apollo
54
55#endif // CYBER_RECORD_FILE_RECORD_FILE_BASE_H_
const proto::Index & GetIndex() const
virtual bool Open(const std::string &path)=0
const proto::Header & GetHeader() const
const std::string & GetPath() const
class register implement
Definition arena_queue.h:37