←
Documentation
ADS-IDAC Engine
5.0.0
KBExpectedSupportSystemStateUnit.cpp
Go to the documentation of this file.
1
#include "
KBExpectedSupportSystemStateUnit.h
"
2
#include "../Branch/BranchRecord.h"
3
#include <boost/serialization/export.hpp>
4
#include "../Global/SimulationContext.h"
5
#include <boost/archive/binary_oarchive.hpp>
6
#include <boost/archive/binary_iarchive.hpp>
7
BOOST_CLASS_EXPORT_IMPLEMENT(
KBExpectedSupportSystemStateUnit
)
8
using namespace
std;
9
10
11
KBExpectedSupportSystemStateUnit::KBExpectedSupportSystemStateUnit
()
12
{
13
this->
setTypeOfExpectation
(
sim::Comm::SupportSystemState
);
14
this->
setStateOfExpectation
(
sim::None
);
15
expected_state
=
sim::None
;
16
}
17
KBExpectedSupportSystemStateUnit::~KBExpectedSupportSystemStateUnit
()
18
{
19
20
}
21
void
KBExpectedSupportSystemStateUnit::setExpectedState
(
int
n){
expected_state
= n;}
22
void
KBExpectedSupportSystemStateUnit::readInfoFromFile
(ifstream &fin){
23
KBElement::readInfoFromFile
(fin);
24
fin >>
expected_state
;
25
}
26
int
KBExpectedSupportSystemStateUnit::checkForMatch
(
string
_ss_name,
int
_ss_state){
27
int
n_return = 0;
28
if
(_ss_name.compare(
KBElement::getInfoName
()) == 0){
29
if
(_ss_state ==
expected_state
){
30
n_return =
ExpectationElement::updateExpectation
(
sim::State::Succeed
);
31
}
32
else
{
33
n_return =
ExpectationElement::updateExpectation
(
sim::State::Failed
);
34
}
35
}
36
else
{
37
n_return = 0;
38
}
39
return
n_return;
40
}
41
void
KBExpectedSupportSystemStateUnit::copyKBExpectedSupportSystemStateUnit
(
KBExpectedSupportSystemStateUnit
&_essp){
42
KBElement::copyKBElement
((
KBElement
&) _essp);
43
ExpectationElement::copyExpectationElement
((
ExpectationElement
&) _essp);
44
expected_state
= _essp.
getExpectedState
();
45
}
46
47
int
KBExpectedSupportSystemStateUnit::getExpectedState
(){
return
expected_state
;}
48
void
KBExpectedSupportSystemStateUnit::saveKBExpectedSupportSystemStateUnitToFile
(ofstream &fout){
49
fout <<
"KBExpectedSupportSystemStateUnit "
<<
expected_state
<<
'\n'
;
50
this->
saveExpectationElementToFile
(fout);
51
this->
saveKBElementToFile
(fout);
52
}
53
void
KBExpectedSupportSystemStateUnit::retrieveKBExpectedSupportSystemStateUnitFromFile
(ifstream &fin){
54
string
str;
55
fin >> str >>
expected_state
;
56
if
(str !=
"KBExpectedSupportSystemStateUnit"
){
57
ofstream fout(
"err messages.txt"
, ios::app);
58
cout <<
"KBExpectedSupportSystemStateUnit::retrieveKBExpectedSupportSystemStateUnitFromFile error in previous function"
<< endl;
59
fout <<
r5pars_
.timesno <<
" KBExpectedSupportSystemStateUnit::retrieveKBExpectedSupportSystemStateUnitFromFile error in previous function\n"
;
60
fout.close();
61
r5pars_
.sim_err =
true
;
62
g_sim
.
Branch_center
.
setTempESMessage
(
"KBExpectedSupportSystemStateUnit::retrieveKBExpectedSupportSystemStateUnitFromFile Prior error"
);
63
g_sim
.
Branch_center
.
setTempTypeOfConsequence
(
Consequence::NoKB
);
64
return
;
65
}
66
this->
retrieveExpectationElementFromFile
(fin);
67
this->
retrieveKBElementFromFile
(fin);
68
}
KBExpectedSupportSystemStateUnit.h
Consequence::NoKB
@ NoKB
g_sim
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
Definition:
SimulationContext.cpp:7
BranchRecord::setTempTypeOfConsequence
void setTempTypeOfConsequence(Consequence)
Stores the consequence of the end state the running sequence will get.
Definition:
BranchRecord.cpp:1641
BranchRecord::setTempESMessage
void setTempESMessage(std::string)
Stores the description of the end state the running sequence will get if it is terminated (set by mod...
Definition:
BranchRecord.cpp:1640
ExpectationElement
Definition:
ExpectationElement.h:20
ExpectationElement::setStateOfExpectation
void setStateOfExpectation(int)
Definition:
ExpectationElement.cpp:27
ExpectationElement::saveExpectationElementToFile
void saveExpectationElementToFile(std::ofstream &)
Definition:
ExpectationElement.cpp:75
ExpectationElement::retrieveExpectationElementFromFile
void retrieveExpectationElementFromFile(std::ifstream &)
Definition:
ExpectationElement.cpp:78
ExpectationElement::setTypeOfExpectation
void setTypeOfExpectation(int)
Definition:
ExpectationElement.cpp:73
ExpectationElement::updateExpectation
int updateExpectation(int)
Definition:
ExpectationElement.cpp:29
ExpectationElement::copyExpectationElement
void copyExpectationElement(ExpectationElement &)
Definition:
ExpectationElement.cpp:69
KBElement
Definition:
KBElement.h:16
KBElement::readInfoFromFile
void readInfoFromFile(std::ifstream &)
Definition:
KBElement.cpp:27
KBElement::retrieveKBElementFromFile
void retrieveKBElementFromFile(std::ifstream &)
Definition:
KBElement.cpp:36
KBElement::saveKBElementToFile
void saveKBElementToFile(std::ofstream &)
Definition:
KBElement.cpp:33
KBElement::copyKBElement
void copyKBElement(KBElement &)
Definition:
KBElement.cpp:30
KBElement::getInfoName
std::string getInfoName()
Definition:
KBElement.cpp:26
KBExpectedSupportSystemStateUnit
Definition:
KBExpectedSupportSystemStateUnit.h:17
KBExpectedSupportSystemStateUnit::getExpectedState
int getExpectedState()
Definition:
KBExpectedSupportSystemStateUnit.cpp:47
KBExpectedSupportSystemStateUnit::expected_state
int expected_state
Definition:
KBExpectedSupportSystemStateUnit.h:41
KBExpectedSupportSystemStateUnit::copyKBExpectedSupportSystemStateUnit
void copyKBExpectedSupportSystemStateUnit(KBExpectedSupportSystemStateUnit &)
Definition:
KBExpectedSupportSystemStateUnit.cpp:41
KBExpectedSupportSystemStateUnit::~KBExpectedSupportSystemStateUnit
virtual ~KBExpectedSupportSystemStateUnit()
Definition:
KBExpectedSupportSystemStateUnit.cpp:17
KBExpectedSupportSystemStateUnit::setExpectedState
void setExpectedState(int)
Definition:
KBExpectedSupportSystemStateUnit.cpp:21
KBExpectedSupportSystemStateUnit::saveKBExpectedSupportSystemStateUnitToFile
void saveKBExpectedSupportSystemStateUnitToFile(std::ofstream &)
Definition:
KBExpectedSupportSystemStateUnit.cpp:48
KBExpectedSupportSystemStateUnit::readInfoFromFile
void readInfoFromFile(std::ifstream &)
Definition:
KBExpectedSupportSystemStateUnit.cpp:22
KBExpectedSupportSystemStateUnit::retrieveKBExpectedSupportSystemStateUnitFromFile
void retrieveKBExpectedSupportSystemStateUnitFromFile(std::ifstream &)
Definition:
KBExpectedSupportSystemStateUnit.cpp:53
KBExpectedSupportSystemStateUnit::checkForMatch
int checkForMatch(std::string, int)
Definition:
KBExpectedSupportSystemStateUnit.cpp:26
KBExpectedSupportSystemStateUnit::KBExpectedSupportSystemStateUnit
KBExpectedSupportSystemStateUnit()
Definition:
KBExpectedSupportSystemStateUnit.cpp:11
r5pars_
struct @0 r5pars_
sim::Comm::SupportSystemState
constexpr int SupportSystemState
Definition:
SimConstants.h:292
sim::State::Failed
constexpr int Failed
Definition:
SimConstants.h:103
sim::State::Succeed
constexpr int Succeed
Definition:
SimConstants.h:104
sim::None
constexpr int None
Definition:
SimConstants.h:75
SimulationContext::Branch_center
BranchRecord Branch_center
Dynamic event tree state.
Definition:
SimulationContext.h:45
src
ADSIDAC
Crew
KBExpectedSupportSystemStateUnit.cpp
Generated by
1.9.4