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< BaseComponent > | Clone () const override |
Clone the component. More... | |
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. More... | |
bool | operator!= (const Component< NoData, Identifier, Serializer > &_component) const |
Components with no data are always equal to another instance of the same type. More... | |
bool | operator== (const Component< NoData, Identifier, Serializer > &_component) const |
Components with no data are always equal to another instance of the same type. More... | |
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. More... | |
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. More... | |
![]() | |
BaseComponent ()=default | |
Default constructor. More... | |
virtual | ~BaseComponent ()=default |
Default destructor. More... | |
Static Public Attributes | |
static ComponentTypeId | typeId {0} |
Unique ID for this component type. This is set through the Factory registration. More... | |
static std::string | typeName |
Unique name for this component type. This is set through the Factory registration. More... | |
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()
|
overridevirtual |
◆ Deserialize()
|
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] _in In stream.
Reimplemented from BaseComponent.
◆ operator!=()
Components with no data are always equal to another instance of the same type.
- Parameters
-
[in] _component Component to compare to
- Returns
- False.
◆ operator==()
Components with no data are always equal to another instance of the same type.
- Parameters
-
[in] _component Component to compare to
- Returns
- True.
◆ Serialize()
|
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] _out Out stream.
Reimplemented from BaseComponent.
◆ TypeId()
|
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.
References Component< DataType, Identifier, Serializer >::typeId.
Member Data Documentation
◆ typeId
|
inlinestatic |
Unique ID for this component type. This is set through the Factory registration.
◆ typeName
|
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: