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 | |
|---|---|
| struct | Extractor |
| struct | Extractor< 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. |
| void | Define(const xml::Element & gate_node, Gate * gate)<br>Specializations for elements defined after registration. |
| void | Define(const xml::Element & event_node, BasicEvent * basic_event) |
| void | Define(const xml::Element & param_node, Parameter * parameter) |
| void | Define(const xml::Element & ccf_node, CcfGroup * ccf_group) |
| void | Define(const xml::Element & xml_node, Sequence * sequence) |
| void | Define(const xml::Element & et_node, EventTree * event_tree) |
| void | Define(const xml::Element & xml_node, InitiatingEvent * initiating_event) |
| void | Define(const xml::Element & rule_node, Rule * rule) |
| void | Define(const xml::Element & xml_node, Alignment * alignment) |
| void | Define(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::string | GlobToRegex(const std::string & glob)<br>Converts a glob pattern to a regular expression string. |
| void | CheckFileExistence(const std::vector< std::string > & xml_files)<br>Checks if all input files exist on the system. |
| void | CheckDuplicateFiles(const std::vector< std::string > & xml_files)<br>Checks if there are duplicate input files. |
Detailed Description
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
Gate * Register(
const xml::Element & gate_node,
const std::string & base_path,
RoleSpecifier container_role
)Specializations for element registrations.
function Define
void Define(
const xml::Element & gate_node,
Gate * gate
)Specializations for elements defined after registration.
function Define
void Define(
const xml::Element & event_node,
BasicEvent * basic_event
)function Define
void Define(
const xml::Element & param_node,
Parameter * parameter
)function Define
void Define(
const xml::Element & ccf_node,
CcfGroup * ccf_group
)function Define
void Define(
const xml::Element & xml_node,
Sequence * sequence
)function Define
void Define(
const xml::Element & et_node,
EventTree * event_tree
)function Define
void Define(
const xml::Element & xml_node,
InitiatingEvent * initiating_event
)function Define
void Define(
const xml::Element & rule_node,
Rule * rule
)function Define
void Define(
const xml::Element & xml_node,
Alignment * alignment
)function Define
void Define(
const xml::Element & xml_node,
Substitution * substitution
)function Initializer
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:
- IOError Input contains duplicate files.
- IOError One of the input files is not accessible.
- IOError No files match the provided wildcard patterns.
- xml::Error The xml files contain errors or malformed.
- xml::ValidityError The xml files are not valid for schema.
- mef::ValidityError The input model contains errors.
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
inline std::unique_ptr< Model > model()Return: The model built from the input files.
function ExpandWildcards
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
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
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:
- IOError Some files are missing.
function CheckDuplicateFiles
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:
- DuplicateElementError There are duplicate input files.
Precondition: All input files exist on the system.
Updated on 2026-01-09 at 21:59:12 +0000
