Apollo 10.0
自动驾驶开放平台
apollo::cyber::common::GlobalData类 参考

#include <global_data.h>

apollo::cyber::common::GlobalData 的协作图:

Public 成员函数

 ~GlobalData ()
 
int ProcessId () const
 
void SetProcessGroup (const std::string &process_group)
 
const std::string & ProcessGroup () const
 
void SetComponentNums (const int component_nums)
 
int ComponentNums () const
 
void SetSchedName (const std::string &sched_name)
 
const std::string & SchedName () const
 
const std::string & HostIp () const
 
const std::string & HostName () const
 
const CyberConfig & Config () const
 
void EnableSimulationMode ()
 
void DisableSimulationMode ()
 
bool IsRealityMode () const
 
bool IsMockTimeMode () const
 
bool IsChannelEnableArenaShm (std::string channel_name) const
 
bool IsChannelEnableArenaShm (uint64_t channel_id) const
 
apollo::cyber::proto::ArenaChannelConf GetChannelArenaConf (std::string channel_name) const &
 
apollo::cyber::proto::ArenaChannelConf GetChannelArenaConf (uint64_t channel_id) const &
 

静态 Public 成员函数

static uint64_t GenerateHashId (const std::string &name)
 
static uint64_t RegisterNode (const std::string &node_name)
 
static std::string GetNodeById (uint64_t id)
 
static uint64_t RegisterChannel (const std::string &channel)
 
static std::string GetChannelById (uint64_t id)
 
static uint64_t RegisterService (const std::string &service)
 
static std::string GetServiceById (uint64_t id)
 
static uint64_t RegisterTaskName (const std::string &task_name)
 
static std::string GetTaskNameById (uint64_t id)
 

详细描述

在文件 global_data.h41 行定义.

构造及析构函数说明

◆ ~GlobalData()

apollo::cyber::common::GlobalData::~GlobalData ( )

在文件 global_data.cc69 行定义.

69{}

成员函数说明

◆ ComponentNums()

int apollo::cyber::common::GlobalData::ComponentNums ( ) const

在文件 global_data.cc81 行定义.

81{ return component_nums_; }

◆ Config()

const CyberConfig & apollo::cyber::common::GlobalData::Config ( ) const

在文件 global_data.cc211 行定义.

211{ return config_; }

◆ DisableSimulationMode()

void apollo::cyber::common::GlobalData::DisableSimulationMode ( )

在文件 global_data.cc96 行定义.

96{ run_mode_ = RunMode::MODE_REALITY; }

◆ EnableSimulationMode()

void apollo::cyber::common::GlobalData::EnableSimulationMode ( )

在文件 global_data.cc92 行定义.

92 {
93 run_mode_ = RunMode::MODE_SIMULATION;
94}

◆ GenerateHashId()

static uint64_t apollo::cyber::common::GlobalData::GenerateHashId ( const std::string &  name)
inlinestatic

在文件 global_data.h75 行定义.

75 {
76 return common::Hash(name);
77 }
std::size_t Hash(const std::string &key)
Definition util.h:27

◆ GetChannelArenaConf() [1/2]

apollo::cyber::proto::ArenaChannelConf apollo::cyber::common::GlobalData::GetChannelArenaConf ( std::string  channel_name) const &

在文件 global_data.cc131 行定义.

132 {
133 for (auto arena_channel_conf : config_.transport_conf()
134 .shm_conf()
135 .arena_shm_conf()
136 .arena_channel_conf()) {
137 if (channel_name == arena_channel_conf.channel_name()) {
138 return arena_channel_conf;
139 }
140 }
142}

◆ GetChannelArenaConf() [2/2]

apollo::cyber::proto::ArenaChannelConf apollo::cyber::common::GlobalData::GetChannelArenaConf ( uint64_t  channel_id) const &

在文件 global_data.cc144 行定义.

145 {
146 auto channel_name =
147 cyber::common::GlobalData::Instance()->GetChannelById(channel_id);
148 return GetChannelArenaConf(channel_name);
149}
apollo::cyber::proto::ArenaChannelConf GetChannelArenaConf(std::string channel_name) const &

◆ GetChannelById()

std::string apollo::cyber::common::GlobalData::GetChannelById ( uint64_t  id)
static

在文件 global_data.cc251 行定义.

251 {
252 std::string* channel = nullptr;
253 if (channel_id_map_.Get(id, &channel)) {
254 return *channel;
255 }
256 return kEmptyString;
257}

◆ GetNodeById()

std::string apollo::cyber::common::GlobalData::GetNodeById ( uint64_t  id)
static

在文件 global_data.cc228 行定义.

228 {
229 std::string* node_name = nullptr;
230 if (node_id_map_.Get(id, &node_name)) {
231 return *node_name;
232 }
233 return kEmptyString;
234}

◆ GetServiceById()

std::string apollo::cyber::common::GlobalData::GetServiceById ( uint64_t  id)
static

在文件 global_data.cc274 行定义.

274 {
275 std::string* service = nullptr;
276 if (service_id_map_.Get(id, &service)) {
277 return *service;
278 }
279 return kEmptyString;
280}

◆ GetTaskNameById()

std::string apollo::cyber::common::GlobalData::GetTaskNameById ( uint64_t  id)
static

在文件 global_data.cc297 行定义.

297 {
298 std::string* task_name = nullptr;
299 if (task_id_map_.Get(id, &task_name)) {
300 return *task_name;
301 }
302 return kEmptyString;
303}

◆ HostIp()

const std::string & apollo::cyber::common::GlobalData::HostIp ( ) const

在文件 global_data.cc88 行定义.

88{ return host_ip_; }

◆ HostName()

const std::string & apollo::cyber::common::GlobalData::HostName ( ) const

在文件 global_data.cc90 行定义.

90{ return host_name_; }

◆ IsChannelEnableArenaShm() [1/2]

bool apollo::cyber::common::GlobalData::IsChannelEnableArenaShm ( std::string  channel_name) const

在文件 global_data.cc106 行定义.

106 {
107 if (!config_.has_transport_conf() ||
108 !config_.transport_conf().has_shm_conf() ||
109 !config_.transport_conf().shm_conf().has_arena_shm_conf()) {
110 return false;
111 }
112 bool found = false;
113 for (auto arena_channel_conf : config_.transport_conf()
114 .shm_conf()
115 .arena_shm_conf()
116 .arena_channel_conf()) {
117 if (channel_name == arena_channel_conf.channel_name()) {
118 found = true;
119 break;
120 }
121 }
122 return found;
123}

◆ IsChannelEnableArenaShm() [2/2]

bool apollo::cyber::common::GlobalData::IsChannelEnableArenaShm ( uint64_t  channel_id) const

在文件 global_data.cc125 行定义.

125 {
126 auto channel_name =
127 cyber::common::GlobalData::Instance()->GetChannelById(channel_id);
128 return IsChannelEnableArenaShm(channel_name);
129}
bool IsChannelEnableArenaShm(std::string channel_name) const

◆ IsMockTimeMode()

bool apollo::cyber::common::GlobalData::IsMockTimeMode ( ) const

在文件 global_data.cc102 行定义.

102 {
103 return clock_mode_ == ClockMode::MODE_MOCK;
104}

◆ IsRealityMode()

bool apollo::cyber::common::GlobalData::IsRealityMode ( ) const

在文件 global_data.cc98 行定义.

98 {
99 return run_mode_ == RunMode::MODE_REALITY;
100}

◆ ProcessGroup()

const std::string & apollo::cyber::common::GlobalData::ProcessGroup ( ) const

在文件 global_data.cc76 行定义.

76{ return process_group_; }

◆ ProcessId()

int apollo::cyber::common::GlobalData::ProcessId ( ) const

在文件 global_data.cc71 行定义.

71{ return process_id_; }

◆ RegisterChannel()

uint64_t apollo::cyber::common::GlobalData::RegisterChannel ( const std::string &  channel)
static

在文件 global_data.cc236 行定义.

236 {
237 auto id = Hash(channel);
238 while (channel_id_map_.Has(id)) {
239 std::string* name = nullptr;
240 channel_id_map_.Get(id, &name);
241 if (channel == *name) {
242 break;
243 }
244 ++id;
245 AWARN << "Channel name hash collision: " << channel << " <=> " << *name;
246 }
247 channel_id_map_.Set(id, channel);
248 return id;
249}
#define AWARN
Definition log.h:43

◆ RegisterNode()

uint64_t apollo::cyber::common::GlobalData::RegisterNode ( const std::string &  node_name)
static

在文件 global_data.cc213 行定义.

213 {
214 auto id = Hash(node_name);
215 while (node_id_map_.Has(id)) {
216 std::string* name = nullptr;
217 node_id_map_.Get(id, &name);
218 if (node_name == *name) {
219 break;
220 }
221 ++id;
222 AWARN << " Node name hash collision: " << node_name << " <=> " << *name;
223 }
224 node_id_map_.Set(id, node_name);
225 return id;
226}

◆ RegisterService()

uint64_t apollo::cyber::common::GlobalData::RegisterService ( const std::string &  service)
static

在文件 global_data.cc259 行定义.

259 {
260 auto id = Hash(service);
261 while (service_id_map_.Has(id)) {
262 std::string* name = nullptr;
263 service_id_map_.Get(id, &name);
264 if (service == *name) {
265 break;
266 }
267 ++id;
268 AWARN << "Service name hash collision: " << service << " <=> " << *name;
269 }
270 service_id_map_.Set(id, service);
271 return id;
272}

◆ RegisterTaskName()

uint64_t apollo::cyber::common::GlobalData::RegisterTaskName ( const std::string &  task_name)
static

在文件 global_data.cc282 行定义.

282 {
283 auto id = Hash(task_name);
284 while (task_id_map_.Has(id)) {
285 std::string* name = nullptr;
286 task_id_map_.Get(id, &name);
287 if (task_name == *name) {
288 break;
289 }
290 ++id;
291 AWARN << "Task name hash collision: " << task_name << " <=> " << *name;
292 }
293 task_id_map_.Set(id, task_name);
294 return id;
295}

◆ SchedName()

const std::string & apollo::cyber::common::GlobalData::SchedName ( ) const

在文件 global_data.cc86 行定义.

86{ return sched_name_; }

◆ SetComponentNums()

void apollo::cyber::common::GlobalData::SetComponentNums ( const int  component_nums)

在文件 global_data.cc78 行定义.

78 {
79 component_nums_ = component_nums;
80}

◆ SetProcessGroup()

void apollo::cyber::common::GlobalData::SetProcessGroup ( const std::string &  process_group)

在文件 global_data.cc73 行定义.

73 {
74 process_group_ = process_group;
75}

◆ SetSchedName()

void apollo::cyber::common::GlobalData::SetSchedName ( const std::string &  sched_name)

在文件 global_data.cc83 行定义.

83 {
84 sched_name_ = sched_name;
85}

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