← Documentation
ADS-IDAC Engine 5.0.0
BranchGoal.cpp
Go to the documentation of this file.
1// BranchGoal.cpp: implementation of the BranchGoal class.
2//
4
5#include <sstream>
6#include "BranchGoal.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(BranchGoal)
13using namespace std;
14
15
17// Construction/Destruction
19
21{
22
23}
24
26{
27
28}
33};
35 string str;
36 str = "GOAL: Sender: ";
37 str += g_sim.Translator.getString(this->getSender());
38 str += "; Receiver: ";
40 str += "; Goal: ";
41 str += g_sim.Translator.getString(this->getDecision());
43 {
44 str += " - GOAL BYPASSED";
45 }
46 str += "; New Probability: ";
47 std::ostringstream streamObj;
48 streamObj << this->getProbability();
49 str += streamObj.str();
50 return str;
51}
52void BranchGoal::saveInfoToFile(ostream &fout){
53 fout << ' ' << this->getSender() << ' ' << sim::Decision::Goal << ' ' << this->getDecision() << ' ' << sim::None << ' ' << this->getProbability() << ' '
54 << this->getTimeOfCommunication() << ' ' << this->getRemainingTime() << " 0.0 0 " << '"' << "NONE" << '"' << '\n';
55}
57 this->saveDecisionGoalToFile(fout);
59 this->saveCommunicationToFile(fout);
60}
65}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void saveInfoToFile(std::ostream &)
Definition: BranchGoal.cpp:52
std::string translateMessage()
Definition: BranchGoal.cpp:34
void saveBranchGoalToFile(std::ofstream &)
Definition: BranchGoal.cpp:56
void retrieveBranchGoalFromFile(std::ifstream &)
Definition: BranchGoal.cpp:61
virtual ~BranchGoal()
Definition: BranchGoal.cpp:25
void copyBranchGoal(BranchGoal &)
Definition: BranchGoal.cpp:29
double getTimeOfCommunication()
void saveCommunicationToFile(std::ofstream &)
int getIntendedReceiver()
void retrieveCommunicationFromFile(std::ifstream &)
void copyCommunication(Communication &)
std::string getString(int) const
void copyDecisionGoal(DecisionGoal &)
void saveDecisionGoalToFile(std::ofstream &)
void retrieveDecisionGoalFromFile(std::ifstream &)
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 Goal
Definition: SimConstants.h:190
constexpr int Bypass
Definition: SimConstants.h:132
constexpr int None
Definition: SimConstants.h:75
ConvertToString Translator
Parameter name/value conversion.