Ignition Gazebo

API Reference

1.0.2
ComponentStorage< ComponentTypeT > Class Template Reference

Templated implementation of component storage. More...

#include <ComponentStorageBase.hh>

Public Member Functions

 ComponentStorage ()
 Constructor. More...
 
const components::BaseComponentComponent (const ComponentId _id) const final
 Get a component based on an id. More...
 
components::BaseComponentComponent (const ComponentId _id) final
 Get a mutable component based on an id. More...
 
std::pair< ComponentId, bool > Create (const components::BaseComponent *_data) final
 Create a new component using the provided data. More...
 
components::BaseComponentFirst () final
 Get the first component. More...
 
bool Remove (const ComponentId _id) final
 Remove a component based on an id. More...
 
void RemoveAll () final
 Remove all components. More...
 
- Public Member Functions inherited from ComponentStorageBase
 ComponentStorageBase ()=default
 Constructor. More...
 
virtual ~ComponentStorageBase ()=default
 Destructor. More...
 

Public Attributes

std::vector< ComponentTypeT > components
 Sequential storage of components. More...
 

Additional Inherited Members

- Protected Attributes inherited from ComponentStorageBase
std::mutex mutex
 Mutex used to prevent data corruption. More...
 

Detailed Description

template<typename ComponentTypeT>
class ignition::gazebo::ComponentStorage< ComponentTypeT >

Templated implementation of component storage.

Constructor & Destructor Documentation

◆ ComponentStorage()

ComponentStorage ( )
inlineexplicit

Constructor.

Member Function Documentation

◆ Component() [1/2]

const components::BaseComponent* Component ( const ComponentId  _id) const
inlinefinalvirtual

Get a component based on an id.

Parameters
[in]_idId of the component to get.
Returns
A pointer to the component, or nullptr if the component could not be found.

Implements ComponentStorageBase.

◆ Component() [2/2]

components::BaseComponent* Component ( const ComponentId  _id)
inlinefinalvirtual

Get a mutable component based on an id.

Parameters
[in]_idId of the component to get.
Returns
A pointer to the component, or nullptr if the component could not be found.

Implements ComponentStorageBase.

◆ Create()

std::pair<ComponentId, bool> Create ( const components::BaseComponent _data)
inlinefinalvirtual

Create a new component using the provided data.

Parameters
[in]_dataData used to construct the component.
Returns
Id of the new component, and whether the components array was expanded. kComponentIdInvalid is returned if the component could not be created.

Implements ComponentStorageBase.

◆ First()

components::BaseComponent* First ( )
inlinefinalvirtual

Get the first component.

Returns
First component or nullptr if there are no components.

Implements ComponentStorageBase.

◆ Remove()

bool Remove ( const ComponentId  _id)
inlinefinalvirtual

Remove a component based on an id.

Parameters
[in]_idId of the component to remove.
Returns
True if the component was removed.

Implements ComponentStorageBase.

◆ RemoveAll()

void RemoveAll ( )
inlinefinalvirtual

Remove all components.

Implements ComponentStorageBase.

Member Data Documentation

◆ components

std::vector<ComponentTypeT> components

Sequential storage of components.


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