Gazebo Sim

API Reference

9.0.0~pre1
Component< NoData, Identifier, Serializer > Class Template Reference

Specialization for components that don't wrap any data. This class to be used to create simple components that represent just a "tag", while avoiding a lot of boilerplate code. The Identifier must be a unique type so that type aliases can be used to create new components. However the type does not need to be defined anywhere eg. More...

#include <Component.hh>

Public Member Functions

std::unique_ptr< BaseComponentClone () const override
 Clone the component.
 
void Deserialize (std::istream &_in) override
 Fills a component based on a stream with a serialized data. By default, it will do nothing. Derived classes should override this function to support deserialization.
 
bool operator!= (const Component< NoData, Identifier, Serializer > &_component) const
 Components with no data are always equal to another instance of the same type.
 
bool operator== (const Component< NoData, Identifier, Serializer > &_component) const
 Components with no data are always equal to another instance of the same type.
 
void Serialize (std::ostream &_out) const override
 Fills a stream with a serialized version of the component. By default, it will leave the stream empty. Derived classes should override this function to support serialization.
 
ComponentTypeId TypeId () const override
 Returns the unique ID for the component's type. The ID is derived from the name that is manually chosen during the Factory registration and is guaranteed to be the same across compilers and runs.
 
- Public Member Functions inherited from BaseComponent
 BaseComponent ()=default
 Default constructor.
 
virtual ~BaseComponent ()=default
 Default destructor.
 

Static Public Attributes

static ComponentTypeId typeId {0}
 Unique ID for this component type. This is set through the Factory registration.
 
static const char * typeName {nullptr}
 Unique name for this component type. This is set through the Factory registration.
 

Detailed Description

template<typename Identifier, typename Serializer>
class gz::sim::components::Component< NoData, Identifier, Serializer >

Specialization for components that don't wrap any data. This class to be used to create simple components that represent just a "tag", while avoiding a lot of boilerplate code. The Identifier must be a unique type so that type aliases can be used to create new components. However the type does not need to be defined anywhere eg.

using Joint = Component<NoData, class JointTag>;

Member Function Documentation

◆ Clone()

template<typename Identifier , typename Serializer >
std::unique_ptr< BaseComponent > Clone ( ) const
overridevirtual

Clone the component.

Returns
A pointer to the component.

Implements BaseComponent.

◆ Deserialize()

template<typename Identifier , typename Serializer >
void Deserialize ( std::istream _in)
overridevirtual

Fills a component based on a stream with a serialized data. By default, it will do nothing. Derived classes should override this function to support deserialization.

Parameters
[in]_inIn stream.

Reimplemented from BaseComponent.

◆ operator!=()

template<typename Identifier , typename Serializer >
bool operator!= ( const Component< NoData, Identifier, Serializer > &  _component) const

Components with no data are always equal to another instance of the same type.

Parameters
[in]_componentComponent to compare to
Returns
False.

◆ operator==()

template<typename Identifier , typename Serializer >
bool operator== ( const Component< NoData, Identifier, Serializer > &  _component) const

Components with no data are always equal to another instance of the same type.

Parameters
[in]_componentComponent to compare to
Returns
True.

◆ Serialize()

template<typename Identifier , typename Serializer >
void Serialize ( std::ostream _out) const
overridevirtual

Fills a stream with a serialized version of the component. By default, it will leave the stream empty. Derived classes should override this function to support serialization.

Parameters
[in]_outOut stream.

Reimplemented from BaseComponent.

◆ TypeId()

template<typename Identifier , typename Serializer >
ComponentTypeId TypeId ( ) const
overridevirtual

Returns the unique ID for the component's type. The ID is derived from the name that is manually chosen during the Factory registration and is guaranteed to be the same across compilers and runs.

Implements BaseComponent.

Member Data Documentation

◆ typeId

template<typename Identifier , typename Serializer >
ComponentTypeId typeId {0}
inlinestatic

Unique ID for this component type. This is set through the Factory registration.

◆ typeName

template<typename Identifier , typename Serializer >
const char* typeName {nullptr}
inlinestatic

Unique name for this component type. This is set through the Factory registration.


The documentation for this class was generated from the following file: