Factory.hh File Reference
#include <algorithm>
#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/config.hh>
#include <gz/sim/Export.hh>
#include <gz/sim/Types.hh>
#include <gz/utils/NeverDestroyed.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... | |
Namespaces | |
gz | |
This library is part of the Gazebo project. | |
gz::sim | |
Gazebo is a leading open source robotics simulator, that provides high fidelity physics, rendering, and sensor simulation. | |
gz::sim::components | |
Components represent data, such as position information. An Entity usually has one or more associated components. | |
Macros | |
#define | GZ_SIM_REGISTER_COMPONENT(_compType, _classname) |
Static component registration macro. More... | |
Macro Definition Documentation
◆ GZ_SIM_REGISTER_COMPONENT
#define GZ_SIM_REGISTER_COMPONENT | ( | _compType, | |
_classname | |||
) |
Value:
class GzSimComponents##_classname \
{ \
public: GzSimComponents##_classname() \
{ \
using namespace gz;\
using Desc = sim::components::ComponentDescriptor<_classname>; \
sim::components::Factory::Instance()->Register<_classname>(\
_compType, new Desc(), sim::components::RegistrationObjectId(this));\
} \
public: GzSimComponents##_classname( \
const GzSimComponents##_classname&) = delete; \
public: GzSimComponents##_classname( \
GzSimComponents##_classname&) = delete; \
public: ~GzSimComponents##_classname() \
{ \
sim::components::Factory::Instance()->Unregister<_classname>( \
sim::components::RegistrationObjectId(this)); \
} \
}; \
static GzSimComponents##_classname\
GzSimComponentsInitializer##_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] _compType Component type name. [in] _classname Class name for component.