Skip to content

scram::mef::Formula

Boolean formula with connectives and arguments. More...

#include <event.h>

Public Classes

Name
structArg <br>Formula argument with a complement flag.
classArgSet <br>The set of formula arguments.

Public Types

Name
using std::variant< Gate *, BasicEvent *, HouseEvent * >ArgEvent <br>Argument events of a formula.

Public Functions

Name
Formula(const Formula & ) =default<br>Copy semantics only.
Formula &operator=(const Formula & ) =default
Formula(Connective connective, ArgSet args, std::optional< int > min_number ={}, std::optional< int > max_number ={})
Connectiveconnective() const
std::optional< int >min_number() const
std::optional< int >max_number() const
const std::vector< Arg > &args() const
voidSwap(ArgEvent current, ArgEvent other)<br>Swaps an argument event with another one.

Detailed Description

cpp
class scram::mef::Formula;

Boolean formula with connectives and arguments.

Formulas are not expected to be shared.

Public Types Documentation

using ArgEvent

cpp
using scram::mef::Formula::ArgEvent =  std::variant<Gate*, BasicEvent*, HouseEvent*>;

Argument events of a formula.

Public Functions Documentation

function Formula

cpp
Formula(
    const Formula & 
) =default

Copy semantics only.

function operator=

cpp
Formula & operator=(
    const Formula & 
) =default

function Formula

cpp
Formula(
    Connective connective,
    ArgSet args,
    std::optional< int > min_number ={},
    std::optional< int > max_number ={}
)

Parameters:

  • connective The logical connective for this Boolean formula.
  • args The arguments of the formula.
  • min_number The min number relevant to the connective.
  • max_number The max number relevant to the connective.

Exceptions:

  • ValidityError Invalid arguments or setup for the connective.
  • LogicError Invalid nesting of complement or constant args.
  • LogicError Negative values for min or max number.

function connective

cpp
inline Connective connective() const

Return: The connective of this formula.

function min_number

cpp
std::optional< int > min_number() const

Return: The min number for "atleast"/"cardinality" connective.

function max_number

cpp
std::optional< int > max_number() const

Return: The max number of "cardinality" connective.

function args

cpp
inline const std::vector< Arg > & args() const

Return: The arguments of this formula.

function Swap

cpp
void Swap(
    ArgEvent current,
    ArgEvent other
)

Swaps an argument event with another one.

Parameters:

  • current The current argument event in this formula.
  • other The replacement argument event.

Exceptions:

Postcondition:

  • Strong exception safety guarantees.
  • The complement flag is preserved.
  • The position is preserved.

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