Apollo 10.0
自动驾驶开放平台
readable_info.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_TRANSPORT_SHM_READABLE_INFO_H_
18#define CYBER_TRANSPORT_SHM_READABLE_INFO_H_
19
20#include <cstddef>
21#include <cstdint>
22#include <memory>
23#include <string>
24
25namespace apollo {
26namespace cyber {
27namespace transport {
28
29class ReadableInfo;
30using ReadableInfoPtr = std::shared_ptr<ReadableInfo>;
31
33 public:
35 ReadableInfo(uint64_t host_id, int32_t block_index,
36 uint64_t channel_id, int32_t arena_block_index = -1);
37 virtual ~ReadableInfo();
38
39 ReadableInfo& operator=(const ReadableInfo& other);
40
41 bool DeserializeFrom(const std::string& src);
42 bool DeserializeFrom(const char* src, std::size_t len);
43 bool SerializeTo(std::string* dst) const;
44
45 uint64_t host_id() const { return host_id_; }
46 void set_host_id(uint64_t host_id) { host_id_ = host_id; }
47
48 int32_t block_index() const { return block_index_; }
49 void set_block_index(int32_t block_index) { block_index_ = block_index; }
50
51 int32_t arena_block_index() const { return arena_block_index_; }
53 int32_t arena_block_index) { arena_block_index_ = arena_block_index; }
54
55 uint64_t channel_id() const { return channel_id_; }
56 void set_channel_id(uint64_t channel_id) { channel_id_ = channel_id; }
57
58 static const size_t kSize;
59
60 private:
61 uint64_t host_id_;
62 int32_t block_index_;
63 int32_t arena_block_index_;
64 uint64_t channel_id_;
65};
66
67} // namespace transport
68} // namespace cyber
69} // namespace apollo
70
71#endif // CYBER_TRANSPORT_SHM_READABLE_INFO_H_
void set_block_index(int32_t block_index)
bool SerializeTo(std::string *dst) const
void set_arena_block_index(int32_t arena_block_index)
ReadableInfo & operator=(const ReadableInfo &other)
bool DeserializeFrom(const std::string &src)
void set_channel_id(uint64_t channel_id)
std::shared_ptr< ReadableInfo > ReadableInfoPtr
class register implement
Definition arena_queue.h:37