← Documentation
ADS-IDAC Engine 5.0.0
BranchSubGoal.cpp
Go to the documentation of this file.
1// BranchSubGoal.cpp: implementation of the BranchSubGoal class.
2//
4
5#include <sstream>
6#include "BranchSubGoal.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(BranchSubGoal)
13using namespace std;
14
15
17// Construction/Destruction
19
21
22}
23
25
26}
31};
33 string str;
34 str = "SUBGOAL: Sender: ";
35 str += g_sim.Translator.getString(this->getSender());
36 str += "; Receiver: ";
38 str += "; Subgoal: ";
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 BranchSubGoal::saveInfoToFile(ostream &fout) {
47 fout << ' ' << this->getSender() << ' ' << sim::Decision::Goal << ' ' << this->getDecision() << " NONE " << this->getProbability()
48 << ' '
49 << this->getTimeOfCommunication() << ' ' << this->getRemainingTime() << " 0.0 0 " << '"' << "NONE" << '"'
50 << '\n';
51}
53 this->saveDecisionSubGoalToFile(fout);
55 this->saveCommunicationToFile(fout);
56}
61}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
virtual ~BranchSubGoal()
void retrieveBranchSubGoalFromFile(std::ifstream &)
void saveInfoToFile(std::ostream &)
std::string translateMessage()
void copyBranchSubGoal(BranchSubGoal &)
void saveBranchSubGoalToFile(std::ofstream &)
double getTimeOfCommunication()
void saveCommunicationToFile(std::ofstream &)
int getIntendedReceiver()
void retrieveCommunicationFromFile(std::ifstream &)
void copyCommunication(Communication &)
std::string getString(int) const
void saveDecisionSubGoalToFile(std::ofstream &)
void retrieveDecisionSubGoalFromFile(std::ifstream &)
void copyDecisionSubGoal(DecisionSubGoal &)
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
ConvertToString Translator
Parameter name/value conversion.