PresetManager.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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 _GAZEBO_PHYSICS_PRESETMANAGER_HH_
19 #define _GAZEBO_PHYSICS_PRESETMANAGER_HH_
20 
21 #include <boost/any.hpp>
22 #include <string>
23 #include <vector>
24 #include <sdf/sdf.hh>
25 
27 
28 namespace gazebo
29 {
30  namespace physics
31  {
32  class PresetPrivate;
33 
36  class GZ_PHYSICS_VISIBLE Preset
37  {
39  public: Preset();
40 
43  // cppcheck-suppress noExplicitConstructor
44  public: Preset(const std::string & _name);
45 
47  public: ~Preset();
48 
51  public: std::string Name() const;
52 
57  public: bool GetParam(const std::string &_key, boost::any &_value) const;
58 
62  public: bool SetParam(const std::string &_key, const boost::any &_value);
63 
67  public: bool HasParam(const std::string &_key) const;
68 
73  public: bool SetAllPhysicsParameters(PhysicsEnginePtr _physicsEngine)
74  const;
75 
80  public: bool SetAllParamsFromSDF(const sdf::ElementPtr _elem);
81 
86  private: bool SetAllParamsHelper(const sdf::ElementPtr _elem);
87 
90  public: sdf::ElementPtr SDF() const;
91 
95  public: bool SDF(const sdf::ElementPtr _sdfElement);
96 
98  private: PresetPrivate *dataPtr;
99  };
100 
101  class PresetManagerPrivate;
102 
105  class GZ_PHYSICS_VISIBLE PresetManager
106  {
110  public: PresetManager(PhysicsEnginePtr _physicsEngine,
111  const sdf::ElementPtr _sdf);
112 
114  public: ~PresetManager();
115 
119  public: bool CurrentProfile(const std::string &_name);
120 
123  public: std::string CurrentProfile() const;
124 
127  public: std::vector<std::string> AllProfiles() const;
128 
134  public: bool SetProfileParam(const std::string &_profileName,
135  const std::string &_key, const boost::any &_value);
136 
142  public: bool GetProfileParam(const std::string &_name,
143  const std::string &_key, boost::any &_value) const;
144 
149  public: bool SetCurrentProfileParam(const std::string &_key,
150  const boost::any &_value);
151 
156  public: bool GetCurrentProfileParam(const std::string &_key,
157  boost::any &_value);
158 
163  public: bool CreateProfile(const std::string &_name);
164 
170  public: std::string CreateProfile(const sdf::ElementPtr _sdf);
171 
174  public: void RemoveProfile(const std::string &_name);
175 
179  public: bool HasProfile(const std::string &_name) const;
180 
185  public: sdf::ElementPtr ProfileSDF(const std::string &_name) const;
186 
191  public: bool ProfileSDF(const std::string &_name,
192  const sdf::ElementPtr _sdf);
193 
197  public: void GenerateSDFFromPreset(const std::string &_name,
198  sdf::ElementPtr &_elem) const;
199 
203  private: void GenerateSDFHelper(const Preset &_preset,
204  sdf::ElementPtr &_elem) const;
205 
209  private: void GeneratePresetFromSDF(const sdf::ElementPtr _elem,
210  Preset &_preset) const;
211 
214  private: Preset *CurrentPreset() const;
215 
217  private: PresetManagerPrivate *dataPtr;
218  };
219  }
220 }
221 
222 #endif
default namespace for gazebo
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:125
Class to manage preset physics profiles.
Definition: PresetManager.hh:105
Representation of a preset physics profile.
Definition: PresetManager.hh:36