← Documentation
ADS-IDAC Engine 5.0.0
BranchInfoGatherMode.cpp
Go to the documentation of this file.
1// BranchInfoGatherMode.cpp: implementation of the BranchInfoGatherMode class.
2//
4
5#include <sstream>
7#include "../Global/ConvertToString.h"
8#include <boost/serialization/export.hpp>
9#include "../Global/SimulationContext.h"
10#include <boost/archive/binary_oarchive.hpp>
11#include <boost/archive/binary_iarchive.hpp>
12BOOST_CLASS_EXPORT_IMPLEMENT(BranchInfoGatherMode)
13using namespace std;
14
15
17// Construction/Destruction
19
22}
23
25
26}
30 string str;
32 str = "use_memorized_info";
33 } else {
34 str = "gather_new_info";
35 }
36 fout << ' ' << this->getSender() << ' ' << sim::Action::SendInfo << ' ' << sim::None << " info_gather_mode " << this->getProbability()
37 << ' '
38 << this->getTimeOfCommunication() << ' ' << this->getRemainingTime() << " 0.0 0 " << '"' << str << '"' << '\n';
39}
41 this->copyCommunication(_bigm);
42 this->copyTimerAndProbability(_bigm);
44}
46 string str;
47 str = "Info_gather_mode: Sender: ";
48 str += g_sim.Translator.getString(this->getSender());
49 str += "; Receiver: ";
52 str += "; Mode: conditional_use_of_memorized_info_if_available";
53 } else {
54 str += "; Mode: always_check_for_up_to_date_info";
55 }
56 str += "; New Probability: ";
57 std::ostringstream streamObj;
58 streamObj << this->getProbability();
59 str += streamObj.str();
60 return str;
61}
63 fout << info_gather_mode << '\n';
65 this->saveCommunicationToFile(fout);
66}
68 fin >> info_gather_mode;
71}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void saveInfoToFile(std::ostream &)
void retrieveBranchInfoGatherModeFromFile(std::ifstream &)
void saveBranchInfoGatherModeToFile(std::ofstream &)
void copyBranchInfoGatherMode(BranchInfoGatherMode &)
double getTimeOfCommunication()
void saveCommunicationToFile(std::ofstream &)
int getIntendedReceiver()
void retrieveCommunicationFromFile(std::ifstream &)
void copyCommunication(Communication &)
std::string getString(int) const
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 OldInfo
Definition: SimConstants.h:126
constexpr int New
Definition: SimConstants.h:114
constexpr int None
Definition: SimConstants.h:75
ConvertToString Translator
Parameter name/value conversion.