Apollo 10.0
自动驾驶开放平台
header_builder.cc
浏览该文件的文档.
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
18
19namespace apollo {
20namespace cyber {
21namespace record {
22
23using ::apollo::cyber::proto::CompressType;
24
26 proto::Header header;
27 header.set_major_version(MAJOR_VERSION_);
28 header.set_minor_version(MINOR_VERSION_);
29 header.set_compress(COMPRESS_TYPE_);
30 header.set_chunk_interval(CHUNK_INTERVAL_);
31 header.set_segment_interval(SEGMENT_INTERVAL_);
32 header.set_index_position(0);
33 header.set_chunk_number(0);
34 header.set_channel_number(0);
35 header.set_begin_time(0);
36 header.set_end_time(0);
37 header.set_message_number(0);
38 header.set_size(0);
39 header.set_is_complete(false);
40 header.set_chunk_raw_size(CHUNK_RAW_SIZE_);
41 header.set_segment_raw_size(SEGMENT_RAW_SIZE_);
42 return header;
43}
44
46 const uint64_t segment_interval, const uint64_t segment_raw_size) {
47 proto::Header header;
48 header.set_major_version(MAJOR_VERSION_);
49 header.set_minor_version(MINOR_VERSION_);
50 header.set_compress(COMPRESS_TYPE_);
51 header.set_chunk_interval(CHUNK_INTERVAL_);
52 header.set_chunk_raw_size(CHUNK_RAW_SIZE_);
53 header.set_index_position(0);
54 header.set_chunk_number(0);
55 header.set_channel_number(0);
56 header.set_begin_time(0);
57 header.set_end_time(0);
58 header.set_message_number(0);
59 header.set_size(0);
60 header.set_is_complete(false);
61 header.set_segment_raw_size(segment_raw_size);
62 header.set_segment_interval(segment_interval);
63 return header;
64}
65
67 const uint64_t chunk_interval, const uint64_t chunk_raw_size) {
68 proto::Header header;
69 header.set_major_version(MAJOR_VERSION_);
70 header.set_minor_version(MINOR_VERSION_);
71 header.set_compress(COMPRESS_TYPE_);
72 header.set_segment_interval(SEGMENT_INTERVAL_);
73 header.set_segment_raw_size(SEGMENT_RAW_SIZE_);
74 header.set_index_position(0);
75 header.set_chunk_number(0);
76 header.set_channel_number(0);
77 header.set_begin_time(0);
78 header.set_end_time(0);
79 header.set_message_number(0);
80 header.set_size(0);
81 header.set_is_complete(false);
82 header.set_chunk_interval(chunk_interval);
83 header.set_chunk_raw_size(chunk_raw_size);
84 return header;
85}
86
87} // namespace record
88} // namespace cyber
89} // namespace apollo
static proto::Header GetHeader()
Build a default record header.
static proto::Header GetHeaderWithChunkParams(const uint64_t chunk_interval, const uint64_t chunk_raw_size)
Build a record header with customized max interval time (ns) and max raw size (byte) for chunk.
static proto::Header GetHeaderWithSegmentParams(const uint64_t segment_interval, const uint64_t segment_raw_size)
Build a record header with customized max interval time (ns) and max raw size (byte) for segment.
class register implement
Definition arena_queue.h:37