scram::mef::Model
This class represents a risk analysis model.
#include <model.h>
Inherits from scram::mef::Element, scram::mef::Composite< Model, InitiatingEvent, EventTree, Sequence, Rule, Alignment, Substitution, FaultTree, BasicEvent, Gate, HouseEvent, Parameter, CcfGroup, ExternLibrary, ExternFunction< void > >, scram::mef::ContainerElement, boost::noncopyable
Public Functions
| Name | |
|---|---|
| const MissionTime & | mission_time() const |
| MissionTime & | mission_time() |
| auto | initiating_events() const |
| auto | event_trees() const |
| auto | sequences() const |
| auto | rules() const |
| auto | fault_trees() const |
| auto | alignments() const |
| auto | substitutions() const |
| auto | parameters() const |
| auto | house_events() const |
| auto | basic_events() const |
| auto | gates() const |
| auto | ccf_groups() const |
| auto | libraries() const |
| auto | extern_functions() const |
| void | Add(std::unique_ptr< HouseEvent > element)<br>Adds MEF constructs into the model container. |
| void | Add(std::unique_ptr< BasicEvent > element) |
| void | Add(std::unique_ptr< Gate > element) |
| void | Add(std::unique_ptr< Expression > element) |
| void | Add(std::unique_ptr< Instruction > element) |
| Model(std::string name ="")<br>Creates a model container. | |
| bool | HasDefaultName() const |
| const std::string & | GetOptionalName() const |
| void | SetOptionalName(std::string name ="")<br>Sets the optional name of the model. |
| Context * | context() const |
| Formula::ArgEvent | GetEvent(std::string_view id)<br>Convenience function to retrieve an event with its ID. |
Public Attributes
| Name | |
|---|---|
| constexpr const char * | kTypeString <br>Container type identifier string for error messages. |
| constexpr const char[] | kDefaultName <br>Only Model is allowed to have an optional name, while all other Elements require names. |
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::Composite< Model, InitiatingEvent, EventTree, Sequence, Rule, Alignment, Substitution, FaultTree, BasicEvent, Gate, HouseEvent, Parameter, CcfGroup, ExternLibrary, ExternFunction< void > >
| Name | |
|---|---|
| template <class T > <br>auto | table() const |
| template <class T > <br>auto | table() |
| template <class T ,class ContainerType =typename detail::container_of<T, Ts...>::type> <br>const T & | Get(const typename ContainerType::key_type & id) const<br>Retrieves an element from the container. |
| template <class T ,class ContainerType =typename detail::container_of<T, Ts...>::type> <br>T & | Get(const typename ContainerType::key_type & id) |
Protected Functions inherited from scram::mef::Composite< Model, InitiatingEvent, EventTree, Sequence, Rule, Alignment, Substitution, FaultTree, BasicEvent, Gate, HouseEvent, Parameter, CcfGroup, ExternLibrary, ExternFunction< void > >
| Name | |
|---|---|
| template <class T > <br>decltype(auto) | data() const |
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 mission_time
inline const MissionTime & mission_time() constReturn: The mission time expression for the whole model.
function mission_time
inline MissionTime & mission_time()function initiating_events
inline auto initiating_events() constReturn: Table ranges of the elements in the model.
function event_trees
inline auto event_trees() constfunction sequences
inline auto sequences() constfunction rules
inline auto rules() constfunction fault_trees
inline auto fault_trees() constfunction alignments
inline auto alignments() constfunction substitutions
inline auto substitutions() constfunction parameters
inline auto parameters() constfunction house_events
inline auto house_events() constfunction basic_events
inline auto basic_events() constfunction gates
inline auto gates() constfunction ccf_groups
inline auto ccf_groups() constfunction libraries
inline auto libraries() constfunction extern_functions
inline auto extern_functions() constfunction Add
inline void Add(
std::unique_ptr< HouseEvent > element
)Adds MEF constructs into the model container.
Parameters:
- element An element defined in this model.
Exceptions:
- DuplicateElementError The element is already in the model.
function Add
inline void Add(
std::unique_ptr< BasicEvent > element
)function Add
inline void Add(
std::unique_ptr< Gate > element
)function Add
inline void Add(
std::unique_ptr< Expression > element
)function Add
inline void Add(
std::unique_ptr< Instruction > element
)function Model
explicit Model(
std::string name =""
)Creates a model container.
Parameters:
- name The optional name for the model.
Exceptions:
- ValidityError The name is malformed.
function HasDefaultName
inline bool HasDefaultName() constReturn: true if the model name has not been set.
function GetOptionalName
inline const std::string & GetOptionalName() constReturn: The model name or an empty string for the optional name.
function SetOptionalName
inline void SetOptionalName(
std::string name =""
)Sets the optional name of the model.
function context
inline Context * context() constReturn: The context to be used by test-event expressions for event-tree walks.
Note: There's only single context for the whole model (i.e., global); two event-trees cannot be walked concurrently.
function GetEvent
Formula::ArgEvent GetEvent(
std::string_view id
)Convenience function to retrieve an event with its ID.
Parameters:
- id The valid ID string of the event.
Exceptions:
- UndefinedElement The event with the given ID is not in the model.
Return: The event with its type encoded in variant suitable for formulas.
Public Attributes Documentation
variable kTypeString
static constexpr const char * kTypeString = "model";Container type identifier string for error messages.
variable kDefaultName
static constexpr const char[] kDefaultName = "__unnamed-model__";Only Model is allowed to have an optional name, while all other Elements require names.
An empty name is an error for Element class invariants as well. This leads to a nasty magic string based optional name for a model.
Updated on 2025-11-11 at 16:51:08 +0000
