Skip to content

packages/engine/scram-node/src/reporter.h

Reporter of results.

Namespaces

Name
scram

Classes

Name
classscram::Reporter <br>Facilities to report analysis results.

Source code

cpp
/*
 * Copyright (C) 2014-2018 Olzhas Rakhimov
 * Copyright (C) 2023 OpenPRA ORG Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#pragma once

#include <cstdio>

#include <string>

#include "event.h"
#include "fault_tree_analysis.h"
#include "importance_analysis.h"
#include "model.h"
#include "probability_analysis.h"
#include "risk_analysis.h"
#include "settings.h"
#include "uncertainty_analysis.h"
#include "xml_stream.h"

namespace scram {

class Reporter {
 public:
  void Report(const core::RiskAnalysis& risk_an, std::FILE* out,
              bool indent = true);

  void Report(const core::RiskAnalysis& risk_an, const std::string& file,
              bool indent = true);

 private:
  void ReportInformation(const core::RiskAnalysis& risk_an,
                         xml::StreamElement* report);

  void ReportSoftwareInformation(xml::StreamElement* information);

  template <class T = core::RiskAnalysis>
  void ReportCalculatedQuantity(const core::Settings& settings,
                                xml::StreamElement* information);

  void ReportModelFeatures(const mef::Model& model,
                           xml::StreamElement* information);

  void ReportPerformance(const core::RiskAnalysis& risk_an,
                         xml::StreamElement* information);

  template <class T>
  void ReportUnusedElements(const T& container, const std::string& header,
                            xml::StreamElement* information);

  void ReportResults(const core::RiskAnalysis::EtaResult& eta_result,
                     xml::StreamElement* results);

  void ReportResults(const core::RiskAnalysis::Result::Id& id,
                     const core::FaultTreeAnalysis& fta,
                     const core::ProbabilityAnalysis* prob_analysis,
                     xml::StreamElement* results);

  void ReportResults(const core::RiskAnalysis::Result::Id& id,
                     const core::ProbabilityAnalysis& prob_analysis,
                     xml::StreamElement* results);

  void ReportResults(const core::RiskAnalysis::Result::Id& id,
                     const core::ImportanceAnalysis& importance_analysis,
                     xml::StreamElement* results);

  void ReportResults(const core::RiskAnalysis::Result::Id& id,
                     const core::UncertaintyAnalysis& uncert_analysis,
                     xml::StreamElement* results);

  void ReportLiteral(const core::Literal& literal, xml::StreamElement* parent);

  template <class T>
  void ReportBasicEvent(const mef::BasicEvent& basic_event,
                        xml::StreamElement* parent, const T& add_data);
};

}  // namespace scram

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