Gazebo Transport

API Reference

13.4.0
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
35 {
36  namespace transport
37  {
38  namespace parameters
39  {
40  // Inline bracket to help doxygen filtering.
41  inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
42 
43  struct ParametersRegistryPrivate;
44 
55  class GZ_TRANSPORT_PARAMETERS_VISIBLE ParametersRegistry
56  : public ParametersInterface
57  {
61  public: explicit ParametersRegistry(
62  const std::string & _parametersServicesNamespace);
63 
66 
68  public: ParametersRegistry(const ParametersRegistry &) = delete;
70  public: ParametersRegistry &
71  operator=(const ParametersRegistry &) = delete;
75  public: ParametersRegistry &
77 
81  const std::string & _parameterName,
82  const google::protobuf::Message & _msg) final;
83 
87  const std::string & _parameterName,
88  google::protobuf::Message & _parameter) const final;
89 
91  const std::string & _parameterName,
92  std::unique_ptr<google::protobuf::Message> & _parameter) const final;
93 
97  const std::string & _parameterName,
98  const google::protobuf::Message & _msg) final;
99 
103  public: gz::msgs::ParameterDeclarations
104  ListParameters() const final;
105 
113  public: ParameterResult DeclareParameter(
114  const std::string & _parameterName,
115  std::unique_ptr<google::protobuf::Message> _initialValue);
116 
124  public: ParameterResult SetParameter(
125  const std::string & _parameterName,
126  std::unique_ptr<google::protobuf::Message> _value);
127 
128 #ifdef _WIN32
129 // Disable warning C4251 which is triggered by
130 // std::unique_ptr
131 #pragma warning(push)
132 #pragma warning(disable: 4251)
133 #endif
136 #ifdef _WIN32
137 #pragma warning(pop)
138 #endif
139  };
140  }
141  }
142  }
143 }
144 
145 #endif