Skip to content

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
enumType { 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
voidhypothesis(std::unique_ptr< Formula > formula)<br>Sets the substitution hypothesis formula.
const Target &target() const
voidtarget(Target target_event)<br>Sets the target of the substitution.
const std::vector< BasicEvent * > &source() const
booldeclarative() const
voidAdd(BasicEvent * source_event)<br>Adds a source event to the substitution container.
voidValidate() 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_viewname_view() const
const std::string &label() const
voidlabel(std::string label)<br>Sets the element label.
const AttributeMap &attributes() const
voidAddAttribute(Attribute attr)<br>Adds an attribute to the attribute map of this element.
voidSetAttribute(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
voidname(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
classContainer

Public Types Documentation

enum Type

EnumeratorValueDescription
kDeleteTerms
kRecoveryRule
kExchangeEvent

The "traditional" substitution types.

using Target

cpp
using scram::mef::Substitution::Target =  std::variant<BasicEvent*, bool>;

The target type.

Public Functions Documentation

function hypothesis

cpp
inline const Formula & hypothesis() const

Return: The formula hypothesis of the substitution.

Precondition: The required hypothesis formula has been set.

function hypothesis

cpp
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

cpp
inline const Target & target() const

Return: The target of the substitution.

Precondition: The target has been set.

function target

cpp
inline void target(
    Target target_event
)

Sets the target of the substitution.

Parameters:

  • target_event Basic event or Boolean constant.

function source

cpp
inline const std::vector< BasicEvent * > & source() const

Return: The source events of the substitution.

function declarative

cpp
inline bool declarative() const

Return: true if the substitution is declarative.

function Add

cpp
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:

function Validate

cpp
void Validate() const

Checks if the substitution is setup correctly.

Exceptions:

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

cpp
std::optional< Type > type() const

Return: The equivalent "traditional" substitution type if any.

Precondition: The hypothesis, target, and source are all defined and valid.

function Element

cpp
explicit Element(
    std::string name
)

Constructs an element with an original name.

Parameters:

  • name The local identifier name.

Exceptions:

The name is expected to conform to identifier requirements described in the MEF documentation and additions.

Public Attributes Documentation

variable kTypeString

cpp
static constexpr const char * kTypeString = "substitution";

Type string for error messages.


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