Skip to content

scram::mef::Container

The MEF Container of unique elements. More...

#include <element.h>

Public Types

Name
using TElementType <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_typekey_type <br>The key type of the table.

Public Functions

Name
autotable() const
autotable()
const T &Get(const key_type & id) const<br>Retrieves an element from the container.
T &Get(const key_type & id)
voidAdd(Pointer element)<br>Adds a unique element into the container, ensuring no duplicated entries.
PointerRemove(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() const

Return: 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
) const

Retrieves an element from the container.

Parameters:

  • id The valid ID/name string of the element.

Exceptions:

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:

function Remove

cpp
inline Pointer Remove(
    T * element
)

Removes MEF elements from the container.

Parameters:

  • element An element defined in this container.

Exceptions:

Return: The removed element.

Protected Functions Documentation

function data

cpp
inline const TableType & data() const

Return: The data table with the elements.


Updated on 2025-11-11 at 16:51:08 +0000