##

PresetManager.hh
Go to the documentation of this file.
/*
* Copyright (C) 2015 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _GAZEBO_PHYSICS_PRESETMANAGER_HH_
#define _GAZEBO_PHYSICS_PRESETMANAGER_HH_
#include <boost/any.hpp>
#include <string>
#include <vector>
#include <sdf/sdf.hh>
#include "gazebo/physics/PhysicsTypes.hh"
namespace gazebo
{
namespace physics
{
class PresetPrivate;
class GZ_PHYSICS_VISIBLE Preset
{
public: Preset();
// cppcheck-suppress noExplicitConstructor
public: Preset(const std::string & _name);
public: ~Preset();
public: std::string Name() const;
public: bool GetParam(const std::string &_key, boost::any &_value) const;
public: bool SetParam(const std::string &_key, const boost::any &_value);
public: bool HasParam(const std::string &_key) const;
public: bool SetAllPhysicsParameters(PhysicsEnginePtr _physicsEngine)
const;
public: bool SetAllParamsFromSDF(const sdf::ElementPtr _elem);
private: bool SetAllParamsHelper(const sdf::ElementPtr _elem);
public: sdf::ElementPtr SDF() const;
public: bool SDF(const sdf::ElementPtr _sdfElement);
private: PresetPrivate *dataPtr;
};
class PresetManagerPrivate;
class GZ_PHYSICS_VISIBLE PresetManager
{
public: PresetManager(PhysicsEnginePtr _physicsEngine,
const sdf::ElementPtr _sdf);
public: ~PresetManager();
public: bool CurrentProfile(const std::string &_name);
public: std::string CurrentProfile() const;
public: std::vector<std::string> AllProfiles() const;
public: bool SetProfileParam(const std::string &_profileName,
const std::string &_key, const boost::any &_value);
public: bool GetProfileParam(const std::string &_name,
const std::string &_key, boost::any &_value) const;
public: bool SetCurrentProfileParam(const std::string &_key,
const boost::any &_value);
public: bool GetCurrentProfileParam(const std::string &_key,
boost::any &_value);
public: bool CreateProfile(const std::string &_name);
public: std::string CreateProfile(const sdf::ElementPtr _sdf);
public: void RemoveProfile(const std::string &_name);
public: bool HasProfile(const std::string &_name) const;
public: sdf::ElementPtr ProfileSDF(const std::string &_name) const;
public: bool ProfileSDF(const std::string &_name,
const sdf::ElementPtr _sdf);
public: void GenerateSDFFromPreset(const std::string &_name,
sdf::ElementPtr &_elem) const;
private: void GenerateSDFHelper(const Preset &_preset,
sdf::ElementPtr &_elem) const;
private: void GeneratePresetFromSDF(const sdf::ElementPtr _elem,
Preset &_preset) const;
private: Preset *CurrentPreset() const;
private: PresetManagerPrivate *dataPtr;
};
}
}
#endif
gazebo::physics::Preset::HasParam
bool HasParam(const std::string &_key) const
Check if profile parameter is set.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::physics::Preset::~Preset
~Preset()
Destructor.
PhysicsTypes.hh
default namespace for gazebo
gazebo::physics::PresetManager::PresetManager
PresetManager(PhysicsEnginePtr _physicsEngine, const sdf::ElementPtr _sdf)
Constructor.
gazebo::physics::Preset::SetAllParamsFromSDF
bool SetAllParamsFromSDF(const sdf::ElementPtr _elem)
Set all parameters of this preset based on the key/value pairs in the given SDF element.
gazebo::physics::PresetManager::CreateProfile
bool CreateProfile(const std::string &_name)
Create a new profile.
gazebo::physics::PresetManager::~PresetManager
~PresetManager()
Destructor.
gazebo::physics::PresetManager::SetProfileParam
bool SetProfileParam(const std::string &_profileName, const std::string &_key, const boost::any &_value)
Set a parameter for a certain profile.
gazebo::physics::Preset::SDF
sdf::ElementPtr SDF() const
Get this preset profile's SDF.
gazebo::physics::PresetManager::AllProfiles
std::vector< std::string > AllProfiles() const
Get the name of all profiles.
gazebo::physics::Preset::GetParam
bool GetParam(const std::string &_key, boost::any &_value) const
Get a profile parameter.
gazebo::physics::Preset::SetAllPhysicsParameters
bool SetAllPhysicsParameters(PhysicsEnginePtr _physicsEngine) const
Set all parameters of this preset in the physics engine.
gazebo::physics::PresetManager::HasProfile
bool HasProfile(const std::string &_name) const
Determine if we have a profile.
gazebo::physics::PresetManager::SetCurrentProfileParam
bool SetCurrentProfileParam(const std::string &_key, const boost::any &_value)
Set a parameter for the current profile.
gazebo::physics::PresetManager
Class to manage preset physics profiles.
Definition: PresetManager.hh:105
gazebo::physics::Preset
Representation of a preset physics profile.
Definition: PresetManager.hh:36
gazebo::physics::PresetManager::GetCurrentProfileParam
bool GetCurrentProfileParam(const std::string &_key, boost::any &_value)
Get a parameter for the current profile.
gazebo::physics::PresetManager::ProfileSDF
sdf::ElementPtr ProfileSDF(const std::string &_name) const
Get the SDF for a profile.
gazebo::physics::Preset::Preset
Preset()
Constructor.
gazebo::physics::PhysicsEnginePtr
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:125
gazebo::physics::PresetManager::GenerateSDFFromPreset
void GenerateSDFFromPreset(const std::string &_name, sdf::ElementPtr &_elem) const
Generate an SDF element from an Preset object.
gazebo::physics::PresetManager::RemoveProfile
void RemoveProfile(const std::string &_name)
Remove a profile.
gazebo::physics::Preset::SetParam
bool SetParam(const std::string &_key, const boost::any &_value)
Set a profile parameter.
gazebo::physics::PresetManager::GetProfileParam
bool GetProfileParam(const std::string &_name, const std::string &_key, boost::any &_value) const
Get a parameter for a certain profile.
gazebo::physics::Preset::Name
std::string Name() const
Get the profile name.
gazebo::physics::PresetManager::CurrentProfile
std::string CurrentProfile() const
Get the name of the current profile.