scram::mef::Substitution
The general representation for Delete Terms, Recovery Rules, and Exchange Events.
#include <substitution.h>
Inherits from scram::mef::Element, scram::mef::ContainerElement, boost::noncopyable
Public Types
| Name | |
|---|---|
| enum | Type { kDeleteTerms, kRecoveryRule, kExchangeEvent}<br>The "traditional" substitution types. |
| using std::variant< BasicEvent *, bool > | Target <br>The target type. |
Public Functions
| Name | |
|---|---|
| const Formula & | hypothesis() const |
| void | hypothesis(std::unique_ptr< Formula > formula)<br>Sets the substitution hypothesis formula. |
| const Target & | target() const |
| void | target(Target target_event)<br>Sets the target of the substitution. |
| const std::vector< BasicEvent * > & | source() const |
| bool | declarative() const |
| void | Add(BasicEvent * source_event)<br>Adds a source event to the substitution container. |
| void | Validate() const<br>Checks if the substitution is setup correctly. |
| std::optional< Type > | type() const |
| Element(std::string name)<br>Constructs an element with an original name. |
Public Attributes
| Name | |
|---|---|
| constexpr const char * | kTypeString <br>Type string for error messages. |
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 | |
|---|---|
| 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. |
Protected Functions inherited from scram::mef::ContainerElement
| Name | |
|---|---|
| const Element * | container() const |
Friends inherited from scram::mef::ContainerElement
| Name | |
|---|---|
| class | Container |
Public Types Documentation
enum Type
| Enumerator | Value | Description |
|---|---|---|
| kDeleteTerms | ||
| kRecoveryRule | ||
| kExchangeEvent |
The "traditional" substitution types.
using Target
using scram::mef::Substitution::Target = std::variant<BasicEvent*, bool>;The target type.
Public Functions Documentation
function hypothesis
inline const Formula & hypothesis() constReturn: The formula hypothesis of the substitution.
Precondition: The required hypothesis formula has been set.
function hypothesis
inline void hypothesis(
std::unique_ptr< Formula > formula
)Sets the substitution hypothesis formula.
Parameters:
- formula Simple Boolean formula built over basic events only.
function target
inline const Target & target() constReturn: The target of the substitution.
Precondition: The target has been set.
function target
inline void target(
Target target_event
)Sets the target of the substitution.
Parameters:
- target_event Basic event or Boolean constant.
function source
inline const std::vector< BasicEvent * > & source() constReturn: The source events of the substitution.
function declarative
inline bool declarative() constReturn: true if the substitution is declarative.
function Add
void Add(
BasicEvent * source_event
)Adds a source event to the substitution container.
Parameters:
- source_event The event to be replaced by the target event.
Exceptions:
- DuplicateElementError The source event is duplicate.
function Validate
void Validate() constChecks if the substitution is setup correctly.
Exceptions:
- ValidityError Problems with the substitution setup.
Note: Non-declarative substitutions need to be validated further for idempotency across substitutions before analysis.
Precondition: The substitution has its hypothesis and target.
function type
std::optional< Type > type() constReturn: The equivalent "traditional" substitution type if any.
Precondition: The hypothesis, target, and source are all defined and valid.
function Element
explicit Element(
std::string name
)Constructs an element with an original name.
Parameters:
- name The local identifier name.
Exceptions:
- LogicError The name is required and empty.
- ValidityError The name is malformed.
The name is expected to conform to identifier requirements described in the MEF documentation and additions.
Public Attributes Documentation
variable kTypeString
static constexpr const char * kTypeString = "substitution";Type string for error messages.
Updated on 2025-11-11 at 16:51:08 +0000
