←
Documentation
ADS-IDAC Engine
5.0.0
BranchExpectedSupportSystemState.cpp
Go to the documentation of this file.
1
#include <sstream>
2
#include "
BranchExpectedSupportSystemState.h
"
3
#include "../Global/ConvertToString.h"
4
#include <boost/serialization/export.hpp>
5
#include "../Global/SimulationContext.h"
6
#include <boost/archive/binary_oarchive.hpp>
7
#include <boost/archive/binary_iarchive.hpp>
8
BOOST_CLASS_EXPORT_IMPLEMENT(
BranchExpectedSupportSystemState
)
9
using namespace
std;
10
11
12
BranchExpectedSupportSystemState::BranchExpectedSupportSystemState
()
13
{
14
15
}
16
17
BranchExpectedSupportSystemState::~BranchExpectedSupportSystemState
()
18
{
19
20
}
21
void
BranchExpectedSupportSystemState::copyBranchExpectedSupportSystemState
(
BranchExpectedSupportSystemState
&_bcp){
22
DecisionExpectedSupportSystemState::copyDecisionExpectedSupportSystemState
((
DecisionExpectedSupportSystemState
&) _bcp);
23
TimerAndProbability::copyTimerAndProbability
((
TimerAndProbability
&) _bcp);
24
Communication::copyCommunication
((
Communication
&) _bcp);
25
}
26
string
BranchExpectedSupportSystemState::translateMessage
(){
27
string
str;
28
str =
"Support System: Sender: "
;
29
str +=
g_sim
.
Translator
.
getString
(this->
getSender
());
30
str +=
"; Receiver: "
;
31
str +=
g_sim
.
Translator
.
getString
(this->
getIntendedReceiver
());
32
str +=
"; Support System: "
;
33
str += this->
getDisplayName
();
34
str +=
"; Status: "
;
35
str +=
g_sim
.
Translator
.
getString
(this->
getStateOfExpectation
());
36
str +=
"; Exp State: "
;
37
str +=
g_sim
.
Translator
.
getString
(this->
getExpectedState
());
38
str +=
"; Observed State: "
;
39
str +=
g_sim
.
Translator
.
getString
(this->
getObservedSupportSystemState
());
40
if
(this->
getStateOfActivation
() ==
sim::State::OldInfo
){
41
str +=
";Use of Memorized Info"
;
42
}
43
str +=
"; New Probability: "
;
44
std::ostringstream streamObj;
45
streamObj << this->
getProbability
();
46
str += streamObj.str();
47
return
str;
48
}
49
void
BranchExpectedSupportSystemState::saveInfoToFile
(ostream &fout){
50
string
str;
51
str =
"Status:"
;
52
str +=
g_sim
.
Translator
.
getString
(this->
getStateOfExpectation
());
53
str +=
";_Exp_State:"
;
54
str +=
g_sim
.
Translator
.
getString
(this->
getExpectedState
());
55
str +=
";_Observed_State:"
;
56
str +=
g_sim
.
Translator
.
getString
(this->
getObservedSupportSystemState
());
57
if
(this->
getStateOfActivation
() ==
sim::State::OldInfo
){
58
str +=
";_Use_of_Memorized_Info"
;
59
}
60
fout <<
' '
<< this->
getSender
() <<
' '
<<
sim::Action::SendInfo
<<
' '
<< this->
getObservedSupportSystemState
() <<
' '
<< this->
getInfoName
() <<
' '
<< this->
getProbability
() <<
' '
61
<< this->
getTimeOfCommunication
() <<
' '
<< this->
getRemainingTime
() <<
" 0.0 "
<< this->
getStateOfExpectation
() <<
' '
62
<<
'"'
<<
"Intended_Receiver:"
<<
g_sim
.
Translator
.
getString
(this->
getIntendedReceiver
()) <<
';'
<< str <<
'"'
<<
'\n'
;
63
}
64
void
BranchExpectedSupportSystemState::saveBranchExpectedSupportSystemStateToFile
(ofstream &fout){
65
this->
saveDecisionExpectedSupportSystemStateToFile
(fout);
66
this->
saveTimerAndProbabilityToFile
(fout);
67
this->
saveCommunicationToFile
(fout);
68
}
69
void
BranchExpectedSupportSystemState::retrieveBranchExpectedSupportSystemStateFromFile
(ifstream &fin){
70
this->
retrieveDecisionExpectedSupportSystemStateFromFile
(fin);
71
this->
retrieveTimerAndProbabilityFromFile
(fin);
72
this->
retrieveCommunicationFromFile
(fin);
73
}
BranchExpectedSupportSystemState.h
g_sim
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
Definition:
SimulationContext.cpp:7
BranchExpectedSupportSystemState
Definition:
BranchExpectedSupportSystemState.h:17
BranchExpectedSupportSystemState::saveInfoToFile
void saveInfoToFile(std::ostream &)
Definition:
BranchExpectedSupportSystemState.cpp:49
BranchExpectedSupportSystemState::copyBranchExpectedSupportSystemState
void copyBranchExpectedSupportSystemState(BranchExpectedSupportSystemState &)
Definition:
BranchExpectedSupportSystemState.cpp:21
BranchExpectedSupportSystemState::translateMessage
std::string translateMessage()
Definition:
BranchExpectedSupportSystemState.cpp:26
BranchExpectedSupportSystemState::saveBranchExpectedSupportSystemStateToFile
void saveBranchExpectedSupportSystemStateToFile(std::ofstream &)
Definition:
BranchExpectedSupportSystemState.cpp:64
BranchExpectedSupportSystemState::BranchExpectedSupportSystemState
BranchExpectedSupportSystemState()
Definition:
BranchExpectedSupportSystemState.cpp:12
BranchExpectedSupportSystemState::retrieveBranchExpectedSupportSystemStateFromFile
void retrieveBranchExpectedSupportSystemStateFromFile(std::ifstream &)
Definition:
BranchExpectedSupportSystemState.cpp:69
BranchExpectedSupportSystemState::~BranchExpectedSupportSystemState
virtual ~BranchExpectedSupportSystemState()
Definition:
BranchExpectedSupportSystemState.cpp:17
Communication
Definition:
Communication.h:20
Communication::getSender
int getSender()
Definition:
Communication.cpp:43
Communication::getTimeOfCommunication
double getTimeOfCommunication()
Definition:
Communication.cpp:47
Communication::saveCommunicationToFile
void saveCommunicationToFile(std::ofstream &)
Definition:
Communication.cpp:60
Communication::getIntendedReceiver
int getIntendedReceiver()
Definition:
Communication.cpp:44
Communication::retrieveCommunicationFromFile
void retrieveCommunicationFromFile(std::ifstream &)
Definition:
Communication.cpp:65
Communication::copyCommunication
void copyCommunication(Communication &)
Definition:
Communication.cpp:52
ConvertToString::getString
std::string getString(int) const
Definition:
ConvertToString.cpp:190
DecisionExpectedSupportSystemState
Definition:
DecisionExpectedSupportSystemState.h:18
DecisionExpectedSupportSystemState::saveDecisionExpectedSupportSystemStateToFile
void saveDecisionExpectedSupportSystemStateToFile(std::ofstream &)
Definition:
DecisionExpectedSupportSystemState.cpp:22
DecisionExpectedSupportSystemState::retrieveDecisionExpectedSupportSystemStateFromFile
void retrieveDecisionExpectedSupportSystemStateFromFile(std::ifstream &)
Definition:
DecisionExpectedSupportSystemState.cpp:27
DecisionExpectedSupportSystemState::copyDecisionExpectedSupportSystemState
void copyDecisionExpectedSupportSystemState(DecisionExpectedSupportSystemState &)
Definition:
DecisionExpectedSupportSystemState.cpp:17
DisplayElement::getDisplayName
std::string getDisplayName()
Definition:
DisplayElement.cpp:30
ExpectationElement::getStateOfExpectation
int getStateOfExpectation()
Definition:
ExpectationElement.cpp:28
KBElement::getInfoName
std::string getInfoName()
Definition:
KBElement.cpp:26
KBExpectedSupportSystemStateUnit::getExpectedState
int getExpectedState()
Definition:
KBExpectedSupportSystemStateUnit.cpp:47
MentalSupportSystemState::getObservedSupportSystemState
int getObservedSupportSystemState()
Definition:
MentalSupportSystemState.cpp:19
Probability::getProbability
double getProbability()
Definition:
Probability.cpp:27
StateOfActivation::getStateOfActivation
int getStateOfActivation()
Definition:
StateOfActivation.cpp:25
TimerAndProbability
Definition:
TimerAndProbability.h:21
TimerAndProbability::saveTimerAndProbabilityToFile
void saveTimerAndProbabilityToFile(std::ofstream &)
Definition:
TimerAndProbability.cpp:34
TimerAndProbability::copyTimerAndProbability
void copyTimerAndProbability(TimerAndProbability &)
Definition:
TimerAndProbability.cpp:30
TimerAndProbability::retrieveTimerAndProbabilityFromFile
void retrieveTimerAndProbabilityFromFile(std::ifstream &)
Definition:
TimerAndProbability.cpp:38
Timer::getRemainingTime
double getRemainingTime()
Definition:
Timer.cpp:31
sim::Action::SendInfo
constexpr int SendInfo
Definition:
SimConstants.h:204
sim::State::OldInfo
constexpr int OldInfo
Definition:
SimConstants.h:126
SimulationContext::Translator
ConvertToString Translator
Parameter name/value conversion.
Definition:
SimulationContext.h:52
src
ADSIDAC
Branch
BranchExpectedSupportSystemState.cpp
Generated by
1.9.4