Gazebo Transport

API Reference

13.4.1
Registry.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_REGISTRY_HH_
19 #define GZ_TRANSPORT_PARAMETERS_REGISTRY_HH_
20 
21 #include <functional>
22 #include <memory>
23 #include <string>
24 
25 #include <google/protobuf/message.h>
26 
27 #include <gz/msgs/parameter_declarations.pb.h>
28 
29 #include "gz/transport/config.hh"
31 #include "gz/transport/parameters/Export.hh"
33 
34 namespace gz::transport::parameters
35 {
36  // Inline bracket to help doxygen filtering.
37  inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
38 
39  struct ParametersRegistryPrivate;
40 
51  class GZ_TRANSPORT_PARAMETERS_VISIBLE ParametersRegistry
52  : public ParametersInterface
53  {
57  public: explicit ParametersRegistry(
58  const std::string & _parametersServicesNamespace);
59 
62 
64  public: ParametersRegistry(const ParametersRegistry &) = delete;
66  public: ParametersRegistry & operator=(const ParametersRegistry &) = delete;
71 
75  const std::string & _parameterName,
76  const google::protobuf::Message & _msg) final;
77 
81  const std::string & _parameterName,
82  google::protobuf::Message & _parameter) const final;
83 
85  const std::string & _parameterName,
86  std::unique_ptr<google::protobuf::Message> & _parameter) const final;
87 
91  const std::string & _parameterName,
92  const google::protobuf::Message & _msg) final;
93 
97  public: gz::msgs::ParameterDeclarations ListParameters() const final;
98 
106  public: ParameterResult DeclareParameter(
107  const std::string & _parameterName,
108  std::unique_ptr<google::protobuf::Message> _initialValue);
109 
117  public: ParameterResult SetParameter(
118  const std::string & _parameterName,
119  std::unique_ptr<google::protobuf::Message> _value);
120 
121 #ifdef _WIN32
122 // Disable warning C4251 which is triggered by
123 // std::unique_ptr
124 #pragma warning(push)
125 #pragma warning(disable: 4251)
126 #endif
129 #ifdef _WIN32
130 #pragma warning(pop)
131 #endif
132  };
133  }
134 }
135 
136 #endif