scram::mef::Formula
Boolean formula with connectives and arguments. More...
#include <event.h>
Public Classes
| Name | |
|---|---|
| struct | Arg <br>Formula argument with a complement flag. |
| class | ArgSet <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 ={}) | |
| Connective | connective() const |
| std::optional< int > | min_number() const |
| std::optional< int > | max_number() const |
| const std::vector< Arg > & | args() const |
| void | Swap(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 &
) =defaultCopy semantics only.
function operator=
cpp
Formula & operator=(
const Formula &
) =defaultfunction 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() constReturn: The connective of this formula.
function min_number
cpp
std::optional< int > min_number() constReturn: The min number for "atleast"/"cardinality" connective.
function max_number
cpp
std::optional< int > max_number() constReturn: The max number of "cardinality" connective.
function args
cpp
inline const std::vector< Arg > & args() constReturn: 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:
- DuplicateElementError The replacement argument is duplicate.
- LogicError The current argument does not belong to this formula.
- LogicError The replacement would result in invalid setup.
Postcondition:
- Strong exception safety guarantees.
- The complement flag is preserved.
- The position is preserved.
Updated on 2025-11-11 at 16:51:08 +0000
