Skip to content

scram::mef::Initializer

This class operates on input files to initialize analysis constructs like models, fault trees, and events. More...

#include <initializer.h>

Inherits from boost::noncopyable

Public Classes

Name
structExtractor
structExtractor< T, -1 > <br>Specialization of Extractor to extract all expressions into arg vector.

Public Functions

Name
Gate *Register(const xml::Element & gate_node, const std::string & base_path, RoleSpecifier container_role)<br>Specializations for element registrations.
voidDefine(const xml::Element & gate_node, Gate * gate)<br>Specializations for elements defined after registration.
voidDefine(const xml::Element & event_node, BasicEvent * basic_event)
voidDefine(const xml::Element & param_node, Parameter * parameter)
voidDefine(const xml::Element & ccf_node, CcfGroup * ccf_group)
voidDefine(const xml::Element & xml_node, Sequence * sequence)
voidDefine(const xml::Element & et_node, EventTree * event_tree)
voidDefine(const xml::Element & xml_node, InitiatingEvent * initiating_event)
voidDefine(const xml::Element & rule_node, Rule * rule)
voidDefine(const xml::Element & xml_node, Alignment * alignment)
voidDefine(const xml::Element & xml_node, Substitution * substitution)
Initializer(const std::vector< std::string > & xml_files, core::Settings settings, bool allow_extern =false, xml::Validator * extra_validator =nullptr)<br>Reads input files with the structure of analysis constructs.
std::unique_ptr< Model >model()
std::vector< std::string >ExpandWildcards(const std::vector< std::string > & xml_files)<br>Expands wildcard patterns in file paths to a list of matching files.
std::stringGlobToRegex(const std::string & glob)<br>Converts a glob pattern to a regular expression string.
voidCheckFileExistence(const std::vector< std::string > & xml_files)<br>Checks if all input files exist on the system.
voidCheckDuplicateFiles(const std::vector< std::string > & xml_files)<br>Checks if there are duplicate input files.

Detailed Description

cpp
class scram::mef::Initializer;

This class operates on input files to initialize analysis constructs like models, fault trees, and events.

The initialization phase includes validation and proper setup of the constructs for future use or analysis.

Public Functions Documentation

function Register

cpp
Gate * Register(
    const xml::Element & gate_node,
    const std::string & base_path,
    RoleSpecifier container_role
)

Specializations for element registrations.

function Define

cpp
void Define(
    const xml::Element & gate_node,
    Gate * gate
)

Specializations for elements defined after registration.

function Define

cpp
void Define(
    const xml::Element & event_node,
    BasicEvent * basic_event
)

function Define

cpp
void Define(
    const xml::Element & param_node,
    Parameter * parameter
)

function Define

cpp
void Define(
    const xml::Element & ccf_node,
    CcfGroup * ccf_group
)

function Define

cpp
void Define(
    const xml::Element & xml_node,
    Sequence * sequence
)

function Define

cpp
void Define(
    const xml::Element & et_node,
    EventTree * event_tree
)

function Define

cpp
void Define(
    const xml::Element & xml_node,
    InitiatingEvent * initiating_event
)

function Define

cpp
void Define(
    const xml::Element & rule_node,
    Rule * rule
)

function Define

cpp
void Define(
    const xml::Element & xml_node,
    Alignment * alignment
)

function Define

cpp
void Define(
    const xml::Element & xml_node,
    Substitution * substitution
)

function Initializer

cpp
Initializer(
    const std::vector< std::string > & xml_files,
    core::Settings settings,
    bool allow_extern =false,
    xml::Validator * extra_validator =nullptr
)

Reads input files with the structure of analysis constructs.

Parameters:

  • xml_files The MEF XML input files, possibly containing wildcards.
  • settings Analysis settings.
  • allow_extern Allow external libraries in the input.
  • extra_validator Additional XML validator to be run after the MEF validator.

Exceptions:

Warning: Processing external libraries from XML input is UNSAFE. It allows loading and executing arbitrary code during analysis. Enable this feature for trusted input files and libraries only.

Initializes the analysis model from the given input files. Puts all events into their appropriate containers in the model.

function model

cpp
inline std::unique_ptr< Model > model()

Return: The model built from the input files.

function ExpandWildcards

cpp
static std::vector< std::string > ExpandWildcards(
    const std::vector< std::string > & xml_files
)

Expands wildcard patterns in file paths to a list of matching files.

Parameters:

  • xml_files The XML input files, possibly containing wildcards.

Exceptions:

  • IOError If no files match the provided patterns.

Return: A vector of expanded file paths.

function GlobToRegex

cpp
static std::string GlobToRegex(
    const std::string & glob
)

Converts a glob pattern to a regular expression string.

Parameters:

  • glob The glob pattern to convert.

Return: A regex string equivalent to the glob pattern.

function CheckFileExistence

cpp
static void CheckFileExistence(
    const std::vector< std::string > & xml_files
)

Checks if all input files exist on the system.

Parameters:

  • xml_files The XML input files.

Exceptions:

function CheckDuplicateFiles

cpp
static void CheckDuplicateFiles(
    const std::vector< std::string > & xml_files
)

Checks if there are duplicate input files.

Parameters:

  • xml_files The XML input files.

Exceptions:

Precondition: All input files exist on the system.


Updated on 2026-01-09 at 21:59:12 +0000