← Documentation
ADS-IDAC Engine 5.0.0
BranchStrategy.cpp
Go to the documentation of this file.
1// BranchStrategy.cpp: implementation of the BranchStrategy class.
2//
4
5#include <sstream>
6#include "BranchStrategy.h"
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(BranchStrategy)
13using namespace std;
14
15
17// Construction/Destruction
19
21
22}
23
25
26}
31};
33 string str;
34 str = "STRATEGY: Sender: ";
35 str += g_sim.Translator.getString(this->getSender());
36 str += "; Receiver: ";
38 str += "; Strategy: ";
39 str += g_sim.Translator.getString(this->getDecision());
40 str += "; New Probability: ";
41 std::ostringstream streamObj;
42 streamObj << this->getProbability();
43 str += streamObj.str();
44 return str;
45}
46void BranchStrategy::saveInfoToFile(ostream &fout) {
47 fout << ' ' << this->getSender() << ' ' << sim::Decision::Strategy << ' ' << this->getDecision() << " NONE " << ' '
48 << this->getProbability() << ' '
49 << this->getTimeOfCommunication() << ' ' << this->getRemainingTime() << " 0.0 0 " << '"' << "NONE" << '"'
50 << '\n';
51}
55 this->saveCommunicationToFile(fout);
56}
61}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void retrieveBranchStrategyFromFile(std::ifstream &)
std::string translateMessage()
void copyBranchStrategy(BranchStrategy &)
void saveBranchStrategyToFile(std::ofstream &)
void saveInfoToFile(std::ostream &)
virtual ~BranchStrategy()
double getTimeOfCommunication()
void saveCommunicationToFile(std::ofstream &)
int getIntendedReceiver()
void retrieveCommunicationFromFile(std::ifstream &)
void copyCommunication(Communication &)
std::string getString(int) const
void copyDecisionStrategy(DecisionStrategy &)
void retrieveDecisionStrategyFromFile(std::ifstream &)
void saveDecisionStrategyToFile(std::ofstream &)
int getDecision()
Definition: Decision.cpp:27
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 Strategy
Definition: SimConstants.h:192
ConvertToString Translator
Parameter name/value conversion.