← Documentation
ADS-IDAC Engine 5.0.0
KBExpectedComponentStateUnit.cpp
Go to the documentation of this file.
1// KBExpectedComponentStateUnit.cpp: implementation of the KBExpectedComponentStateUnit class.
2//
4
6#include "../Branch/BranchRecord.h"
7#include <boost/serialization/export.hpp>
8#include "../Global/SimulationContext.h"
9#include <boost/archive/binary_oarchive.hpp>
10#include <boost/archive/binary_iarchive.hpp>
11BOOST_CLASS_EXPORT_IMPLEMENT(KBExpectedComponentStateUnit)
12using namespace std;
13
14
16// Construction/Destruction
18
20{
24}
25
27{
28
29}
33 fin >> expected_state;
34}
35int KBExpectedComponentStateUnit::checkForMatch(string _comp_name, int _comp_state){
36 string str = KBElement::getInfoName();
37 int n_return = 0;
38 if(_comp_name.compare(KBElement::getInfoName()) == 0){
39 if (_comp_state == expected_state){
41 }
42 else{
44 }
45 }
46 else{
47 n_return = 0;
48 }
49 return n_return;
50}
55}
56
59 fout << "KBExpectedComponentStateUnit " << expected_state << '\n';
61 this->saveKBElementToFile(fout);
62}
64 string str;
65 fin >> str >> expected_state;
66 if (str != "KBExpectedComponentStateUnit"){
67 ofstream fout("err messages.txt", ios::app);
68 cout << "KBExpectedComponentStateUnit::retrieveKBExpectedComponentStateUnitFromFile error in previous function" << endl;
69 fout << r5pars_.timesno << " KBExpectedComponentStateUnit::retrieveKBExpectedComponentStateUnitFromFile error in previous function\n";
70 fout.close();
71 r5pars_.sim_err = true;
72 g_sim.Branch_center.setTempESMessage("KBExpectedComponentStateUnit::retrieveKBExpectedComponentStateUnitFromFile Prior error");
74 return;
75 }
78}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void setTempTypeOfConsequence(Consequence)
Stores the consequence of the end state the running sequence will get.
void setTempESMessage(std::string)
Stores the description of the end state the running sequence will get if it is terminated (set by mod...
void saveExpectationElementToFile(std::ofstream &)
void retrieveExpectationElementFromFile(std::ifstream &)
void copyExpectationElement(ExpectationElement &)
void readInfoFromFile(std::ifstream &)
Definition: KBElement.cpp:27
void retrieveKBElementFromFile(std::ifstream &)
Definition: KBElement.cpp:36
void saveKBElementToFile(std::ofstream &)
Definition: KBElement.cpp:33
void copyKBElement(KBElement &)
Definition: KBElement.cpp:30
std::string getInfoName()
Definition: KBElement.cpp:26
void retrieveKBExpectedComponentStateUnitFromFile(std::ifstream &)
void copyKBExpectedComponentStateUnit(KBExpectedComponentStateUnit &)
void saveKBExpectedComponentStateUnitToFile(std::ofstream &)
struct @0 r5pars_
constexpr int ComponentState
Definition: SimConstants.h:285
constexpr int Failed
Definition: SimConstants.h:103
constexpr int Succeed
Definition: SimConstants.h:104
constexpr int None
Definition: SimConstants.h:75
BranchRecord Branch_center
Dynamic event tree state.