Apollo  6.0
Open source self driving car software
parameter_client.h
Go to the documentation of this file.
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_CLIENT_H_
18 #define CYBER_PARAMETER_PARAMETER_CLIENT_H_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include "cyber/proto/parameter.pb.h"
25 
27 #include "cyber/service/client.h"
28 
29 namespace apollo {
30 namespace cyber {
31 
32 class Node;
33 
40  public:
41  using Param = apollo::cyber::proto::Param;
42  using NodeName = apollo::cyber::proto::NodeName;
43  using ParamName = apollo::cyber::proto::ParamName;
44  using BoolResult = apollo::cyber::proto::BoolResult;
45  using Params = apollo::cyber::proto::Params;
55  ParameterClient(const std::shared_ptr<Node>& node,
56  const std::string& service_node_name);
57 
66  bool GetParameter(const std::string& param_name, Parameter* parameter);
67 
77  bool SetParameter(const Parameter& parameter);
78 
86  bool ListParameters(std::vector<Parameter>* parameters);
87 
88  private:
89  std::shared_ptr<Node> node_;
90  std::shared_ptr<GetParameterClient> get_parameter_client_;
91  std::shared_ptr<SetParameterClient> set_parameter_client_;
92  std::shared_ptr<ListParametersClient> list_parameters_client_;
93 };
94 
95 } // namespace cyber
96 } // namespace apollo
97 
98 #endif // CYBER_PARAMETER_PARAMETER_CLIENT_H_
apollo::cyber::proto::Param Param
Definition: parameter_client.h:41
Definition: node.h:31
Client get Response from a responding Service by sending a Request.
Definition: client.h:47
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
A Parameter holds an apollo::cyber::proto::Param, It&#39;s more human-readable, you can use basic-value t...
Definition: parameter.h:42
bool GetParameter(const std::string &param_name, Parameter *parameter)
Get the Parameter object.
ParameterClient(const std::shared_ptr< Node > &node, const std::string &service_node_name)
Construct a new ParameterClient object.
apollo::cyber::proto::NodeName NodeName
Definition: parameter_client.h:42
apollo::cyber::proto::ParamName ParamName
Definition: parameter_client.h:43
apollo::cyber::proto::Params Params
Definition: parameter_client.h:45
bool SetParameter(const Parameter &parameter)
Set the Parameter object.
Parameter Client is used to set/get/list parameter(s) by sending a request to ParameterServer.
Definition: parameter_client.h:39
apollo::cyber::proto::BoolResult BoolResult
Definition: parameter_client.h:44
bool ListParameters(std::vector< Parameter > *parameters)
Get all the Parameter objects.