Gazebo Gazebo

API Reference

3.15.1
gz/sim/components/Factory.hh File Reference
#include <cstdint>
#include <cstring>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <gz/common/SingletonT.hh>
#include <gz/common/Util.hh>
#include <gz/sim/components/Component.hh>
#include <gz/sim/detail/ComponentStorageBase.hh>
#include <gz/sim/config.hh>
#include <gz/sim/Export.hh>
#include <gz/sim/Types.hh>

Go to the source code of this file.

Classes

class  ComponentDescriptor< ComponentTypeT >
 A class for an object responsible for creating components. More...
 
class  ComponentDescriptorBase
 A base class for an object responsible for creating components. More...
 
class  Factory
 A factory that generates a component based on a string type. More...
 
class  StorageDescriptor< ComponentTypeT >
 A class for an object responsible for creating storages. More...
 
class  StorageDescriptorBase
 A base class for an object responsible for creating storages. More...
 

Namespaces

 ignition
 This library is part of the Ignition Robotics project.
 
 ignition::gazebo
 Gazebo is a leading open source robotics simulator, that provides high fidelity physics, rendering, and sensor simulation.
 
 ignition::gazebo::components
 Components represent data, such as position information. An Entity usually has one or more associated components.
 

Macros

#define IGN_GAZEBO_REGISTER_COMPONENT(_compType, _classname)
 Static component registration macro. More...
 

Macro Definition Documentation

◆ IGN_GAZEBO_REGISTER_COMPONENT

#define IGN_GAZEBO_REGISTER_COMPONENT (   _compType,
  _classname 
)
Value:
class IgnGazeboComponents##_classname \
{ \
public: IgnGazeboComponents##_classname() \
{ \
if (_classname::typeId != 0) \
return; \
using namespace ignition;\
using Desc = gz::sim::components::ComponentDescriptor<_classname>; \
using StorageDesc = gz::sim::components::StorageDescriptor<_classname>; \
gz::sim::components::Factory::Instance()->Register<_classname>(\
_compType, new Desc(), new StorageDesc());\
} \
}; \
static IgnGazeboComponents##_classname\
IgnitionGazeboComponentsInitializer##_classname;

Static component registration macro.

Use this macro to register components.

Each time a plugin which uses a component is loaded, it tries to register the component again, so we prevent that.

Parameters
[in]_compTypeComponent type name.
[in]_classnameClass name for component.
This library is part of the Ignition Robotics project.