Skip to content

scram::mef::Expression ​

Abstract base class for all sorts of expressions to describe events. More...

#include <expression.h>

Inherits from boost::noncopyable

Inherited by scram::mef::ExpressionFormula< Exponential >, scram::mef::ExpressionFormula< ExternExpression< R, Args... > >, scram::mef::ExpressionFormula< Glm >, scram::mef::ExpressionFormula< Ite >, scram::mef::ExpressionFormula< Mean >, scram::mef::ExpressionFormula< NaryExpression< T, -1 > >, scram::mef::ExpressionFormula< NaryExpression< T, 1 > >, scram::mef::ExpressionFormula< NaryExpression< T, 2 > >, scram::mef::ExpressionFormula< Switch >, scram::mef::ExpressionFormula< Weibull >, scram::mef::ConstantExpression, scram::mef::ExpressionFormula< T >, scram::mef::MissionTime, scram::mef::Parameter, scram::mef::PeriodicTest, scram::mef::RandomDeviate, scram::mef::TestEvent

Public Functions ​

Name
Expression(std::vector< Expression * > args ={})<br>Constructor for use by derived classes to register their arguments.
virtual~Expression() =default
const std::vector< Expression * > &args() const
virtual voidValidate() const<br>Validates the expression.
virtual doublevalue() =0
virtual Intervalinterval()
virtual boolIsDeviate()<br>Determines if the value of the expression contains deviate expressions.
doubleSample()
voidReset()<br>This routine resets the sampling to get new values.

Protected Functions ​

Name
voidAddArg(Expression * arg)<br>Registers an additional argument expression.

Detailed Description ​

cpp
class scram::mef::Expression;

Abstract base class for all sorts of expressions to describe events.

This class also acts like a connector for parameter nodes and may create cycles. Expressions are not expected to be shared except for parameters. In addition, expressions are not expected to be changed after validation phases.

Public Functions Documentation ​

function Expression ​

cpp
explicit Expression(
    std::vector< Expression * > args ={}
)

Constructor for use by derived classes to register their arguments.

Parameters:

  • args Arguments of this expression.

function ~Expression ​

cpp
virtual ~Expression() =default

function args ​

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

Return: A set of arguments of the expression.

function Validate ​

cpp
inline virtual void Validate() const

Validates the expression.

Exceptions:

Reimplemented by: scram::mef::NaryExpression< T, 1 >::Validate, scram::mef::NaryExpression< T, 2 >::Validate, scram::mef::NaryExpression< T, -1 >::Validate, scram::mef::Exponential::Validate, scram::mef::Glm::Validate, scram::mef::Weibull::Validate, scram::mef::PeriodicTest::Validate, scram::mef::UniformDeviate::Validate, scram::mef::NormalDeviate::Validate, scram::mef::LognormalDeviate::Validate, scram::mef::GammaDeviate::Validate, scram::mef::BetaDeviate::Validate, scram::mef::Histogram::Validate

This late validation is due to parameters that are defined late.

function value ​

cpp
virtual double value() =0

Return: The mean value of this expression.

Reimplemented by: scram::mef::ExpressionFormula::value, scram::mef::ExpressionFormula::value, scram::mef::ExpressionFormula::value, scram::mef::ExpressionFormula::value, scram::mef::ExpressionFormula::value, scram::mef::ExpressionFormula::value, scram::mef::ExpressionFormula::value, scram::mef::ExpressionFormula::value, scram::mef::ExpressionFormula::value, scram::mef::ExpressionFormula::value, scram::mef::ExpressionFormula::value, scram::mef::ConstantExpression::value, scram::mef::PeriodicTest::value, scram::mef::UniformDeviate::value, scram::mef::NormalDeviate::value, scram::mef::LognormalDeviate::value, scram::mef::GammaDeviate::value, scram::mef::BetaDeviate::value, scram::mef::Histogram::value, scram::mef::TestInitiatingEvent::value, scram::mef::TestFunctionalEvent::value, scram::mef::MissionTime::value, scram::mef::Parameter::value

function interval ​

cpp
inline virtual Interval interval()

Return: The domain interval for validation purposes only.

Reimplemented by: scram::mef::NaryExpression< T, 1 >::interval, scram::mef::NaryExpression< T, 2 >::interval, scram::mef::NaryExpression< T, -1 >::interval, scram::mef::Ite::interval, scram::mef::Switch::interval, scram::mef::Exponential::interval, scram::mef::Glm::interval, scram::mef::Weibull::interval, scram::mef::PeriodicTest::interval, scram::mef::Mean::interval, scram::mef::UniformDeviate::interval, scram::mef::NormalDeviate::interval, scram::mef::LognormalDeviate::interval, scram::mef::GammaDeviate::interval, scram::mef::BetaDeviate::interval, scram::mef::Histogram::interval, scram::mef::TestEvent::interval, scram::mef::MissionTime::interval, scram::mef::Parameter::interval

function IsDeviate ​

cpp
virtual bool IsDeviate()

Determines if the value of the expression contains deviate expressions.

Return:

  • true if the expression's value deviates from its mean.
  • false if the expression's value does not need sampling.

Warning: Improper registration of arguments may yield silent failure.

Reimplemented by: scram::mef::ConstantExpression::IsDeviate, scram::mef::RandomDeviate::IsDeviate, scram::mef::TestEvent::IsDeviate, scram::mef::MissionTime::IsDeviate

The default logic is to check arguments with uncertainties for sampling. Derived expression classes must decide if they don't have arguments, or if they are random deviates.

function Sample ​

cpp
double Sample()

Return: A sampled value of this expression.

function Reset ​

cpp
void Reset()

This routine resets the sampling to get new values.

All the arguments are called to reset themselves. If this expression was not sampled, its arguments are not going to get any calls.

Protected Functions Documentation ​

function AddArg ​

cpp
inline void AddArg(
    Expression * arg
)

Registers an additional argument expression.

Parameters:

  • arg An argument expression used by this expression.

Updated on 2025-12-19 at 21:56:46 +0000