Apollo 10.0
自动驾驶开放平台
parameter_server.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_PARAMETER_PARAMETER_SERVER_H_
18#define CYBER_PARAMETER_PARAMETER_SERVER_H_
19
20#include <memory>
21#include <string>
22#include <unordered_map>
23#include <vector>
24
25#include "cyber/proto/parameter.pb.h"
26
29
30namespace apollo {
31namespace cyber {
32
33class Node;
34
45 public:
56 explicit ParameterServer(const std::shared_ptr<Node>& node);
57
63 void SetParameter(const Parameter& parmeter);
64
73 bool GetParameter(const std::string& parameter_name, Parameter* parameter);
74
80 void ListParameters(std::vector<Parameter>* parameters);
81
82 private:
83 std::shared_ptr<Node> node_;
84 std::shared_ptr<Service<ParamName, Param>> get_parameter_service_;
85 std::shared_ptr<Service<Param, BoolResult>> set_parameter_service_;
86 std::shared_ptr<Service<NodeName, Params>> list_parameters_service_;
87
88 std::mutex param_map_mutex_;
89 std::unordered_map<std::string, Param> param_map_;
90};
91
92} // namespace cyber
93} // namespace apollo
94
95#endif // CYBER_PARAMETER_PARAMETER_SERVER_H_
Definition node.h:31
Parameter Service is a very important function of auto-driving.
void ListParameters(std::vector< Parameter > *parameters)
get all the parameters
bool GetParameter(const std::string &parameter_name, Parameter *parameter)
Get the Parameter object
void SetParameter(const Parameter &parmeter)
Set the Parameter object
A Parameter holds an apollo::cyber::proto::Param, It's more human-readable, you can use basic-value t...
Definition parameter.h:42
class register implement
Definition arena_queue.h:37