Gazebo Sim

API Reference

8.7.0
BaseComponent Class Referenceabstract

Base class for all components. More...

#include <Component.hh>

Public Member Functions

 BaseComponent ()=default
 Default constructor. More...
 
virtual ~BaseComponent ()=default
 Default destructor. More...
 
virtual std::unique_ptr< BaseComponentClone () const =0
 Clone the component. More...
 
virtual void Deserialize (std::istream &_in)
 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...
 
virtual void Serialize (std::ostream &_out) const
 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...
 
virtual ComponentTypeId TypeId () const =0
 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...
 

Detailed Description

Base class for all components.

Constructor & Destructor Documentation

◆ BaseComponent()

BaseComponent ( )
default

Default constructor.

◆ ~BaseComponent()

virtual ~BaseComponent ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ Clone()

virtual std::unique_ptr<BaseComponent> Clone ( ) const
pure virtual

Clone the component.

Returns
A pointer to the component.

Implemented in Component< NoData, Identifier, Serializer >, and Component< DataType, Identifier, Serializer >.

◆ Deserialize()

virtual void Deserialize ( std::istream _in)
inlinevirtual

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 in Component< NoData, Identifier, Serializer >, and Component< DataType, Identifier, Serializer >.

References std::endl(), gzwarn, and BaseComponent::TypeId().

◆ Serialize()

virtual void Serialize ( std::ostream _out) const
inlinevirtual

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 in Component< NoData, Identifier, Serializer >, and Component< DataType, Identifier, Serializer >.

References std::endl(), gzwarn, and BaseComponent::TypeId().

◆ TypeId()

virtual ComponentTypeId TypeId ( ) const
pure virtual

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.

Implemented in Component< NoData, Identifier, Serializer >, and Component< DataType, Identifier, Serializer >.

Referenced by BaseComponent::Deserialize(), Factory::New(), and BaseComponent::Serialize().


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