Gazebo Transport

API Reference

12.2.1
Client.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Open Source Robotics Foundation
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 
18 #ifndef GZ_TRANSPORT_PARAMETERS_CLIENT_HH_
19 #define GZ_TRANSPORT_PARAMETERS_CLIENT_HH_
20 
21 #include <memory>
22 #include <string>
23 
24 #include "google/protobuf/message.h"
25 
26 #include "gz/msgs/parameter_declarations.pb.h"
27 
28 #include "gz/transport/config.hh"
29 #include "gz/transport/Node.hh"
30 #include "gz/transport/parameters/Export.hh"
32 
33 namespace gz
34 {
35  namespace transport
36  {
37  namespace parameters
38  {
39 
40  // Inline bracket to help doxygen filtering.
41  inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
42 
43  struct ParametersClientPrivate;
44 
47  class GZ_TRANSPORT_PARAMETERS_VISIBLE ParametersClient
48  : public ParametersInterface
49  {
58  public: ParametersClient(
59  const std::string & _serverNamespace = "",
60  unsigned int _timeoutMs = kDefaultTimeoutMs);
61 
63  public: ~ParametersClient();
64 
66  public: ParametersClient(const ParametersClient &) = delete;
68  public: ParametersClient & operator=(
69  const ParametersClient &) = delete;
73  public: ParametersClient & operator=(
74  ParametersClient &&);
75 
78  public: ParameterResult DeclareParameter(
79  const std::string & _parameterName,
80  const google::protobuf::Message & _msg) final;
81 
84  public: ParameterResult Parameter(
85  const std::string & _parameterName,
86  google::protobuf::Message & _parameter) const final;
87 
88  public: ParameterResult Parameter(
89  const std::string & _parameterName,
90  std::unique_ptr<google::protobuf::Message> & _parameter) const final;
91 
94  public: ParameterResult SetParameter(
95  const std::string & _parameterName,
96  const google::protobuf::Message & _msg) final;
97 
101  public: gz::msgs::ParameterDeclarations
102  ListParameters() const final;
103 
104 #ifdef _WIN32
105 // Disable warning C4251 which is triggered by
106 // std::unique_ptr
107 #pragma warning(push)
108 #pragma warning(disable: 4251)
109 #endif
112 #ifdef _WIN32
113 #pragma warning(pop)
114 #endif
115 
116  private: constexpr static inline unsigned int kDefaultTimeoutMs = 5000;
117  };
118  }
119  }
120  }
121 }
122 
123 #endif