Gazebo Gazebo

API Reference

6.16.0
gz/sim/components/Factory.hh File Reference
#include <cstdint>
#include <cstring>
#include <deque>
#include <map>
#include <memory>
#include <string>
#include <utility>
#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  ComponentDescriptorQueue
 A class to hold the queue of component descriptors registered by translation units. This queue is necessary to ensure that component creation continues to work after plugins are unloaded. The typical scenario this aims to solve is: More...
 
class  Factory
 A factory that generates a component based on a string type. More...
 
struct  RegistrationObjectId
 A wrapper around uintptr_t to prevent implicit conversions. 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 Gazebo 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() \
{ \
using namespace ignition; \
using Desc = gz::sim::components::ComponentDescriptor<_classname>; \
gz::sim::components::Factory::Instance()->Register<_classname>(\
_compType, new Desc(), \
gz::sim::components::RegistrationObjectId(this));\
} \
public: IgnGazeboComponents##_classname( \
const IgnGazeboComponents##_classname&) = delete; \
public: IgnGazeboComponents##_classname( \
IgnGazeboComponents##_classname&) = delete; \
public: ~IgnGazeboComponents##_classname() \
{ \
using namespace ignition; \
gazebo::components::RegistrationObjectId(this)); \
} \
}; \
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 Gazebo project.
void Unregister()
Unregister a component so that the factory can't create instances of the component anymore.
Definition: gz/sim/components/Factory.hh:335
static Factory * Instance()
Get an instance of the singleton.