← Documentation
ADS-IDAC Engine 5.0.0
BranchExpectedParameterValue.cpp
Go to the documentation of this file.
1// BranchExpectedParameterValue.cpp: implementation of the BranchExpectedParameterValue class.
2//
4
5// #include <stdlib.h>
6#include <boost/serialization/export.hpp>
7
8#include <sstream>
10#include "../Global/ConvertToString.h"
11#include "../Global/SimulationContext.h"
12#include <boost/archive/binary_oarchive.hpp>
13#include <boost/archive/binary_iarchive.hpp>
14BOOST_CLASS_EXPORT_IMPLEMENT(BranchExpectedParameterValue)
15using namespace std;
16
17
19// Construction/Destruction
21
23
24}
25
27
28}
33}
35 string str;
36 std::ostringstream streamObj;
37 str = "Parameter: Sender: ";
38 str += g_sim.Translator.getString(this->getSender());
39 str += "; Receiver: ";
41 str += "; Parameter: ";
42 str += this->getDisplayName();
43 str += "; Status: ";
45 str += "; Exp State: ";
47 str += ' ';
49 streamObj << this->getExpectedValue1();
50 str += streamObj.str();
51 } else {
52 streamObj << this->getExpectedValue1();
53 str += streamObj.str();
54 streamObj.str("");
55 str += " and ";
56 streamObj << this->getExpectedValue2();
57 str += streamObj.str();
58 streamObj.str("");
59 }
60 str += "; Observed value: ";
61 streamObj << this->getObservedParameterValue();
62 str += streamObj.str();
63 streamObj.str("");
65 str += "; Use of memorized info";
66 }
67 str += "; New Probability: ";
68 streamObj << this->getProbability();
69 str += streamObj.str();
70 return str;
71}
73 // char ch1[50], ch2[50], ch3[50];
74 double v1, v2, v3;
75 string str;
76 str += "Status:";
78 str += ";_Exp_State:";
81 v1 = this->getExpectedValue1();
82 // _gcvt(v1, 12, ch1);
83 str += to_string(v1);
84 } else {
85 v1 = this->getExpectedValue1();
86 v2 = this->getExpectedValue2();
87 // _gcvt(v1, 12, ch1);
88 // _gcvt(v2, 12, ch2);
89 str += '_';
90 str += to_string(v1);
91 str += "_and_";
92 str += to_string(v2);
93 }
94 str += ";_Observed_value:";
95 v3 = this->getObservedParameterValue();
96 // _gcvt(v3, 12, ch3);
97 str += to_string(v3);
99 str += ";_Use_of_memorized_info";
100 }
101 fout << ' ' << this->getSender() << ' ' << sim::Action::SendInfo << ' ' << sim::None << ' ' << this->getDisplayName() << ' '
102 << this->getProbability() << ' '
103 << this->getTimeOfCommunication() << ' ' << this->getRemainingTime() << ' ' << this->getObservedParameterValue()
104 << " 0 "
105 << '"' << "Intended_Receiver:" << g_sim.Translator.getString(this->getIntendedReceiver()) << ';' << str << '"' << '\n';
106}
110 this->saveCommunicationToFile(fout);
111}
116}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void copyBranchExpectedParameterValue(BranchExpectedParameterValue &)
void retrieveBranchExpectedParameterValueFromFile(std::ifstream &)
void saveBranchExpectedParameterValueToFile(std::ofstream &)
double getTimeOfCommunication()
void saveCommunicationToFile(std::ofstream &)
int getIntendedReceiver()
void retrieveCommunicationFromFile(std::ifstream &)
void copyCommunication(Communication &)
std::string getString(int) const
void retrieveDecisionExpectedParameterValueFromFile(std::ifstream &)
void saveDecisionExpectedParameterValueToFile(std::ofstream &)
void copyDecisionExpectedParameterValue(DecisionExpectedParameterValue &)
std::string getDisplayName()
double getProbability()
Definition: Probability.cpp:27
void saveTimerAndProbabilityToFile(std::ofstream &)
void copyTimerAndProbability(TimerAndProbability &)
void retrieveTimerAndProbabilityFromFile(std::ifstream &)
double getRemainingTime()
Definition: Timer.cpp:31
constexpr int SendInfo
Definition: SimConstants.h:204
constexpr int Between
Definition: SimConstants.h:92
constexpr int OldInfo
Definition: SimConstants.h:126
constexpr int None
Definition: SimConstants.h:75
ConvertToString Translator
Parameter name/value conversion.