scram::mef::Container
The MEF Container of unique elements. More...
#include <element.h>
Public Types
| Name | |
|---|---|
| using T | ElementType <br>The MEF Element type. |
| using std::conditional_t< Ownership, std::unique_ptr< T >, T * > | Pointer <br>The pointer type (owning or not) to store in the table. |
| using std::conditional_t< ById, IdTable< Pointer >, ElementTable< Pointer > > | TableType <br>The table indexed by id or name. |
| using typename TableType::key_type | key_type <br>The key type of the table. |
Public Functions
| Name | |
|---|---|
| auto | table() const |
| auto | table() |
| const T & | Get(const key_type & id) const<br>Retrieves an element from the container. |
| T & | Get(const key_type & id) |
| void | Add(Pointer element)<br>Adds a unique element into the container, ensuring no duplicated entries. |
| Pointer | Remove(T * element)<br>Removes MEF elements from the container. |
Protected Functions
| Name | |
|---|---|
| const TableType & | data() const |
Detailed Description
cpp
template <class Self ,
class T ,
bool Ownership =true,
bool ById =std::is_base_of_v<Id, T>>
class scram::mef::Container;The MEF Container of unique elements.
Template Parameters:
- Self The deriving MEF container type for the CRTP.
- T The MEF element type stored in the container.
- Ownership True if the container takes ownership over the elements.
- ById The indexation strategy (ID or name) to keep elements unique.
Public Types Documentation
using ElementType
cpp
using scram::mef::Container< Self, T, Ownership, ById >::ElementType = T;The MEF Element type.
using Pointer
cpp
using scram::mef::Container< Self, T, Ownership, ById >::Pointer = std::conditional_t<Ownership, std::unique_ptr<T>, T*>;The pointer type (owning or not) to store in the table.
using TableType
cpp
using scram::mef::Container< Self, T, Ownership, ById >::TableType = std::conditional_t<ById, IdTable<Pointer>, ElementTable<Pointer> >;The table indexed by id or name.
using key_type
cpp
using scram::mef::Container< Self, T, Ownership, ById >::key_type = typename TableType::key_type;The key type of the table.
Public Functions Documentation
function table
cpp
inline auto table() constReturn: The table as an associative range of type T elements.
function table
cpp
inline auto table()function Get
cpp
inline const T & Get(
const key_type & id
) constRetrieves an element from the container.
Parameters:
- id The valid ID/name string of the element.
Exceptions:
- UndefinedElement The element is not found.
Return: The reference to the element.
function Get
cpp
inline T & Get(
const key_type & id
)function Add
cpp
inline void Add(
Pointer element
)Adds a unique element into the container, ensuring no duplicated entries.
Parameters:
- element The pointer to the unique element.
Exceptions:
- DuplicateElementError The element is already in the container.
function Remove
cpp
inline Pointer Remove(
T * element
)Removes MEF elements from the container.
Parameters:
- element An element defined in this container.
Exceptions:
- UndefinedElement The element cannot be found in the container.
- LogicError The element in the container is not the same object.
Return: The removed element.
Protected Functions Documentation
function data
cpp
inline const TableType & data() constReturn: The data table with the elements.
Updated on 2025-11-11 at 16:51:08 +0000
