##

AtmosphereFactory.hh
Go to the documentation of this file.
/*
* Copyright (C) 2016 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_ATMOSPHEREFACTORY_HH_
#define GAZEBO_PHYSICS_ATMOSPHEREFACTORY_HH_
#include <string>
#include <map>
#include "gazebo/physics/PhysicsTypes.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
typedef std::unique_ptr<Atmosphere> (*AtmosphereFactoryFn) (World &world);
class GZ_PHYSICS_VISIBLE AtmosphereFactory
{
public: static void RegisterAll();
public: static void RegisterAtmosphere(const std::string &_className,
AtmosphereFactoryFn _factoryfn);
public: static std::unique_ptr<Atmosphere> NewAtmosphere(
const std::string &_className, World &_world);
public: static bool IsRegistered(const std::string &_name);
private: static std::map<std::string, AtmosphereFactoryFn> models;
};
#define GZ_REGISTER_ATMOSPHERE_MODEL(_name, _classname) \
GZ_PHYSICS_VISIBLE std::unique_ptr<Atmosphere> \
New##_classname(World &_world) \
{ \
return std::unique_ptr<Atmosphere>( \
new gazebo::physics::_classname(_world)); \
} \
GZ_PHYSICS_VISIBLE \
void Register##_classname() \
{\
AtmosphereFactory::RegisterAtmosphere(_name, New##_classname);\
}
}
}
#endif
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::physics::AtmosphereFactory::RegisterAll
static void RegisterAll()
Register everything.
gazebo::physics::AtmosphereFactory::RegisterAtmosphere
static void RegisterAtmosphere(const std::string &_className, AtmosphereFactoryFn _factoryfn)
Register an atmosphere class.
system.hh
PhysicsTypes.hh
default namespace for gazebo
gazebo::physics::AtmosphereFactory
The atmosphere factory instantiates different atmosphere models.
Definition: AtmosphereFactory.hh:39
gazebo::physics::World
The world provides access to all other object within a simulated environment.
Definition: World.hh:74
gazebo::physics::AtmosphereFactoryFn
std::unique_ptr< Atmosphere >(* AtmosphereFactoryFn)(World &world)
Definition: AtmosphereFactory.hh:35
gazebo::physics::AtmosphereFactory::IsRegistered
static bool IsRegistered(const std::string &_name)
Check if an atmosphere model is registered.
gazebo::physics::AtmosphereFactory::NewAtmosphere
static std::unique_ptr< Atmosphere > NewAtmosphere(const std::string &_className, World &_world)
Create a new instance of an atmosphere model.