PresetManager.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 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 
37  {
39  public: Preset();
40 
43  public: Preset(const std::string & _name);
44 
46  public: ~Preset();
47 
50  public: std::string Name() const;
51 
56  public: bool GetParam(const std::string &_key, boost::any &_value) const;
57 
61  public: bool SetParam(const std::string &_key, const boost::any &_value);
62 
66  public: bool HasParam(const std::string &_key) const;
67 
72  public: bool SetAllPhysicsParameters(PhysicsEnginePtr _physicsEngine)
73  const;
74 
79  public: bool SetAllParamsFromSDF(const sdf::ElementPtr _elem);
80 
85  private: bool SetAllParamsHelper(const sdf::ElementPtr _elem);
86 
89  public: sdf::ElementPtr SDF() const;
90 
94  public: bool SDF(const sdf::ElementPtr _sdfElement);
95 
97  private: PresetPrivate *dataPtr;
98  };
99 
100  class PresetManagerPrivate;
101 
105  {
109  public: PresetManager(PhysicsEnginePtr _physicsEngine,
110  const sdf::ElementPtr _sdf);
111 
113  public: ~PresetManager();
114 
118  public: bool CurrentProfile(const std::string &_name);
119 
122  public: std::string CurrentProfile() const;
123 
126  public: std::vector<std::string> AllProfiles() const;
127 
133  public: bool SetProfileParam(const std::string &_profileName,
134  const std::string &_key, const boost::any &_value);
135 
141  public: bool GetProfileParam(const std::string &_name,
142  const std::string &_key, boost::any &_value) const;
143 
148  public: bool SetCurrentProfileParam(const std::string &_key,
149  const boost::any &_value);
150 
155  public: bool GetCurrentProfileParam(const std::string &_key,
156  boost::any &_value);
157 
162  public: bool CreateProfile(const std::string &_name);
163 
169  public: std::string CreateProfile(const sdf::ElementPtr _sdf);
170 
173  public: void RemoveProfile(const std::string &_name);
174 
178  public: bool HasProfile(const std::string &_name) const;
179 
184  public: sdf::ElementPtr ProfileSDF(const std::string &_name) const;
185 
190  public: bool ProfileSDF(const std::string &_name,
191  const sdf::ElementPtr _sdf);
192 
196  public: void GenerateSDFFromPreset(const std::string &_name,
197  sdf::ElementPtr &_elem) const;
198 
202  private: void GenerateSDFHelper(const Preset &_preset,
203  sdf::ElementPtr &_elem) const;
204 
208  private: void GeneratePresetFromSDF(const sdf::ElementPtr _elem,
209  Preset &_preset) const;
210 
213  private: Preset *CurrentPreset() const;
214 
216  private: PresetManagerPrivate *dataPtr;
217  };
218  }
219 }
220 
221 #endif
default namespace for gazebo
Definition: PresetManagerPrivate.hh:54
Class to manage preset physics profiles.
Definition: PresetManager.hh:104
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:116
Definition: PresetManagerPrivate.hh:31
Representation of a preset physics profile.
Definition: PresetManager.hh:36
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59