Apollo 10.0
自动驾驶开放平台
apollo::localization::msf::pyramid_map::BaseMapNodeConfig类 参考

The map node config info. 更多...

#include <base_map_node_config.h>

类 apollo::localization::msf::pyramid_map::BaseMapNodeConfig 继承关系图:
apollo::localization::msf::pyramid_map::BaseMapNodeConfig 的协作图:

Public 成员函数

 BaseMapNodeConfig ()
 
virtual ~BaseMapNodeConfig ()
 
virtual std::shared_ptr< BaseMapNodeConfigClone ()
 Alloc a new map node config.
 
virtual unsigned int LoadBinary (const unsigned char *buf)
 Load the map node config from a binary chunk.
 
virtual unsigned int CreateBinary (unsigned char *buf, size_t buf_size) const
 Create the binary map node config.
 
virtual unsigned int GetBinarySize () const
 Get the size of the config in bytes.
 

Public 属性

MapNodeIndex node_index_
 
MapVersion map_version_ = MapVersion::UNKNOWN
 
unsigned char body_md5_ [MD5LENTH] = {0}
 
size_t body_size_ = 0
 
bool has_map_version_ = true
 
bool has_body_md5_ = true
 

详细描述

The map node config info.

在文件 base_map_node_config.h31 行定义.

构造及析构函数说明

◆ BaseMapNodeConfig()

apollo::localization::msf::pyramid_map::BaseMapNodeConfig::BaseMapNodeConfig ( )

在文件 base_map_node_config.cc26 行定义.

26{}

◆ ~BaseMapNodeConfig()

apollo::localization::msf::pyramid_map::BaseMapNodeConfig::~BaseMapNodeConfig ( )
virtual

在文件 base_map_node_config.cc28 行定义.

28{}

成员函数说明

◆ Clone()

std::shared_ptr< BaseMapNodeConfig > apollo::localization::msf::pyramid_map::BaseMapNodeConfig::Clone ( )
virtual

Alloc a new map node config.

Clone a new map node config.

apollo::localization::msf::pyramid_map::NdtMapNodeConfig , 以及 apollo::localization::msf::pyramid_map::PyramidMapNodeConfig 重载.

在文件 base_map_node_config.cc30 行定义.

30 {
31 std::shared_ptr<BaseMapNodeConfig> map_node_config(new BaseMapNodeConfig());
32 map_node_config->node_index_ = node_index_;
33 map_node_config->map_version_ = map_version_;
34 memcpy(map_node_config->body_md5_, body_md5_, sizeof(body_md5_));
35 map_node_config->body_size_ = body_size_;
36 map_node_config->has_map_version_ = has_map_version_;
37 map_node_config->has_body_md5_ = has_body_md5_;
38
39 return map_node_config;
40}

◆ CreateBinary()

unsigned int apollo::localization::msf::pyramid_map::BaseMapNodeConfig::CreateBinary ( unsigned char *  buf,
size_t  buf_size 
) const
virtual

Create the binary map node config.

参数
<buf,buf_size>The buffer and its size.
<return>The required or the used size.

在文件 base_map_node_config.cc88 行定义.

89 {
90 unsigned int target_size = GetBinarySize();
91
92 if (buf_size < target_size) {
93 return 0;
94 }
95
96 // map_version
97 uint16_t *us_p = reinterpret_cast<uint16_t *>(buf);
98 if (has_map_version_) {
99 *us_p = static_cast<uint16_t>(map_version_);
100 ++us_p;
101 }
102
103 // body_md5
104 unsigned char *uc_p = reinterpret_cast<unsigned char *>(us_p);
105 if (has_body_md5_) {
106 memcpy(uc_p, body_md5_, sizeof(body_md5_));
107 uc_p += MD5LENTH;
108 }
109
110 // node_index._resolution_id
111 unsigned int *ui_p = reinterpret_cast<unsigned int *>(us_p);
113 ++ui_p;
114
115 // node_index._zone_id
116 int *int_p = reinterpret_cast<int *>(ui_p);
117 *int_p = node_index_.zone_id_;
118 ++int_p;
119
120 // node_index._m
121 ui_p = reinterpret_cast<unsigned int *>(int_p);
122 *ui_p = node_index_.m_;
123 ++ui_p;
124
125 // node_index._n
126 *ui_p = node_index_.n_;
127 ++ui_p;
128
129 // the body size
130 *ui_p = static_cast<unsigned int>(body_size_);
131
132 return target_size;
133}
#define MD5LENTH
virtual unsigned int GetBinarySize() const
Get the size of the config in bytes.
unsigned int m_
The map node ID at the northing direction.
unsigned int resolution_id_
The ID of the resolution.
unsigned int n_
The map node ID at the easting direction.

◆ GetBinarySize()

unsigned int apollo::localization::msf::pyramid_map::BaseMapNodeConfig::GetBinarySize ( ) const
virtual

Get the size of the config in bytes.

在文件 base_map_node_config.cc135 行定义.

135 {
136 size_t binary_size = 0;
137
138 // map_version
139 if (has_map_version_) {
140 binary_size += sizeof(uint16_t);
141 }
142
143 // body_md5
144 if (has_body_md5_) {
145 binary_size += sizeof(body_md5_);
146 }
147
148 // node_index._resolution_id
149 // node_index._zone_id
150 // node_index._m
151 // node_index._n
152 binary_size += sizeof(unsigned int) + sizeof(int) + sizeof(unsigned int) +
153 sizeof(unsigned int);
154
155 // the body size
156 binary_size += sizeof(unsigned int);
157 return static_cast<unsigned int>(binary_size);
158}

◆ LoadBinary()

unsigned int apollo::localization::msf::pyramid_map::BaseMapNodeConfig::LoadBinary ( const unsigned char *  buf)
virtual

Load the map node config from a binary chunk.

参数
<return>The size read (the real size of config).

在文件 base_map_node_config.cc42 行定义.

42 {
43 size_t binary_size = 0;
44
45 // map_version
46 const uint16_t *us_p = reinterpret_cast<const uint16_t *>(buf);
47 if (has_map_version_) {
48 binary_size += sizeof(uint16_t);
49 map_version_ = static_cast<MapVersion>(*us_p);
50 ++us_p;
51 }
52
53 // body_md5
54 const unsigned char *uc_p = reinterpret_cast<const unsigned char *>(us_p);
55 if (has_body_md5_) {
56 binary_size += sizeof(body_md5_);
57 memcpy(body_md5_, uc_p, sizeof(body_md5_));
58 uc_p += MD5LENTH;
59 }
60
61 binary_size += sizeof(unsigned int) + sizeof(int) + sizeof(unsigned int) +
62 sizeof(unsigned int) + sizeof(unsigned int);
63 // node_index._resolution_id
64 const unsigned int *ui_p = reinterpret_cast<const unsigned int *>(us_p);
66 ++ui_p;
67
68 // node_index._zone_id
69 const int *int_p = reinterpret_cast<const int *>(ui_p);
70 node_index_.zone_id_ = *int_p;
71 ++int_p;
72
73 // node_index._m
74 ui_p = reinterpret_cast<const unsigned int *>(int_p);
75 node_index_.m_ = *ui_p;
76 ++ui_p;
77
78 // node_index._n
79 node_index_.n_ = *ui_p;
80 ++ui_p;
81
82 // the body size
83 body_size_ = *ui_p;
84
85 return static_cast<unsigned int>(binary_size);
86}

类成员变量说明

◆ body_md5_

unsigned char apollo::localization::msf::pyramid_map::BaseMapNodeConfig::body_md5_[MD5LENTH] = {0}

在文件 base_map_node_config.h55 行定义.

55{0};

◆ body_size_

size_t apollo::localization::msf::pyramid_map::BaseMapNodeConfig::body_size_ = 0

在文件 base_map_node_config.h56 行定义.

◆ has_body_md5_

bool apollo::localization::msf::pyramid_map::BaseMapNodeConfig::has_body_md5_ = true

在文件 base_map_node_config.h58 行定义.

◆ has_map_version_

bool apollo::localization::msf::pyramid_map::BaseMapNodeConfig::has_map_version_ = true

在文件 base_map_node_config.h57 行定义.

◆ map_version_

MapVersion apollo::localization::msf::pyramid_map::BaseMapNodeConfig::map_version_ = MapVersion::UNKNOWN

在文件 base_map_node_config.h54 行定义.

◆ node_index_

MapNodeIndex apollo::localization::msf::pyramid_map::BaseMapNodeConfig::node_index_

在文件 base_map_node_config.h53 行定义.


该类的文档由以下文件生成: