ComponentStorage< ComponentTypeT > Class Template Reference
Templated implementation of component storage. More...
#include <ComponentStorageBase.hh>
Public Member Functions | |
ComponentStorage () | |
Constructor. More... | |
const components::BaseComponent * | Component (const ComponentId _id) const final |
Get a component based on an id. More... | |
components::BaseComponent * | Component (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::BaseComponent * | First () 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()
|
inlineexplicit |
Constructor.
Member Function Documentation
◆ Component() [1/2]
|
inlinefinalvirtual |
Get a component based on an id.
- Parameters
-
[in] _id Id 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]
|
inlinefinalvirtual |
Get a mutable component based on an id.
- Parameters
-
[in] _id Id of the component to get.
- Returns
- A pointer to the component, or nullptr if the component could not be found.
Implements ComponentStorageBase.
◆ Create()
|
inlinefinalvirtual |
Create a new component using the provided data.
- Parameters
-
[in] _data Data 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()
|
inlinefinalvirtual |
Get the first component.
- Returns
- First component or nullptr if there are no components.
Implements ComponentStorageBase.
◆ Remove()
|
inlinefinalvirtual |
Remove a component based on an id.
- Parameters
-
[in] _id Id of the component to remove.
- Returns
- True if the component was removed.
Implements ComponentStorageBase.
◆ 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: