scram::mef::Id
Mixin class for assigning unique identifiers to elements.
#include <element.h>
Inherits from scram::mef::Element, scram::mef::Role, scram::mef::ContainerElement, boost::noncopyable
Inherited by scram::mef::CcfGroup, scram::mef::Event, scram::mef::Parameter
Public Functions
| Name | |
|---|---|
| const std::string & | unique_name(const Element & element)<br>Produces unique name for the model element within the same type. |
| const std::string & | unique_name(const Id & element) |
| Id(std::string name, std::string base_path ="", RoleSpecifier role =RoleSpecifier::kPublic)<br>Constructs an element with an original name. | |
| const std::string & | id() const |
| std::string_view | id_view() const |
| std::string_view | full_path() const |
| void | id(std::string name)<br>Resets the element ID. |
Protected Functions
| Name | |
|---|---|
| ~Id() =default |
Additional inherited members
Public Types inherited from scram::mef::Element
| Name | |
|---|---|
| using ext::linear_set< Attribute, AttributeKey > | AttributeMap <br>Unique attribute map keyed with the attribute names. |
Public Functions inherited from scram::mef::Element
| Name | |
|---|---|
| Element(std::string name)<br>Constructs an element with an original name. | |
| const std::string & | name() const |
| std::string_view | name_view() const |
| const std::string & | label() const |
| void | label(std::string label)<br>Sets the element label. |
| const AttributeMap & | attributes() const |
| void | AddAttribute(Attribute attr)<br>Adds an attribute to the attribute map of this element. |
| void | SetAttribute(Attribute attr)<br>Sets an attribute to the attribute map. |
| const Attribute * | GetAttribute(std::string_view name) const |
| std::optional< Attribute > | RemoveAttribute(std::string_view name)<br>Removes an attribute of this element. |
Protected Functions inherited from scram::mef::Element
| Name | |
|---|---|
| ~Element() =default | |
| void | name(std::string name)<br>Resets the element name. |
Public Functions inherited from scram::mef::Role
| Name | |
|---|---|
| Role(RoleSpecifier role =RoleSpecifier::kPublic, std::string base_path ="")<br>Sets the role of an element upon creation. | |
| RoleSpecifier | role() const |
| const std::string & | base_path() const |
Protected Functions inherited from scram::mef::Role
| Name | |
|---|---|
| ~Role() =default |
Protected Functions inherited from scram::mef::ContainerElement
| Name | |
|---|---|
| const Element * | container() const |
Friends inherited from scram::mef::ContainerElement
| Name | |
|---|---|
| class | Container |
Public Functions Documentation
function unique_name
static inline const std::string & unique_name(
const Element & element
)Produces unique name for the model element within the same type.
function unique_name
static inline const std::string & unique_name(
const Id & element
)function Id
explicit Id(
std::string name,
std::string base_path ="",
RoleSpecifier role =RoleSpecifier::kPublic
)Constructs an element with an original name.
Parameters:
- name The local identifier name.
- role A role specifier of the element.
- base_path The series of containers to get this event.
Exceptions:
- LogicError The name is required and empty.
- ValidityError The name is malformed.
- ValidityError The base path string is malformed.
- ValidityError Private element at model/global scope.
The name is expected to conform to identifier requirements described in the MEF documentation and additions.
Sets the role of an element upon creation.
The base reference path must be formatted according to the MEF documentation and additions.
Mangles the element name into a unique id. Private elements get their full path as their ids, while public elements retain their name as ids.
function id
inline const std::string & id() constReturn: The unique id that is set upon the construction of this element.
function id_view
inline std::string_view id_view() constReturn: The string view to the id to be used as a table key.
function full_path
inline std::string_view full_path() constReturn: The string view to the unique full path for a table key.
function id
void id(
std::string name
)Resets the element ID.
Parameters:
- name The new valid name for the element.
Exceptions:
- LogicError The name is empty.
- ValidityError The name is malformed.
Precondition: The element is not in any container keyed by its ID or name.
Protected Functions Documentation
function ~Id
~Id() =defaultUpdated on 2025-11-11 at 16:51:08 +0000
