← Documentation
ADS-IDAC Engine 5.0.0
HardWiredMentalBelief.cpp
Go to the documentation of this file.
1// HardWiredMentalBelief.cpp: implementation of the HardWiredMentalBelief class.
2//
4
6#include "../Branch/BranchRecord.h"
7#include <boost/serialization/export.hpp>
8#include "../Global/SimulationContext.h"
9#include <boost/archive/binary_oarchive.hpp>
10#include <boost/archive/binary_iarchive.hpp>
11BOOST_CLASS_EXPORT_IMPLEMENT(HardWiredMentalBelief)
12using namespace std;
13
14
16// Construction/Destruction
18
20{
23}
24
26{
27
28}
30 this->copyExpectationElement(_hmb);
31 this->copyKBElement(_hmb);
33};
35 string str;
36 fin >> str >> expected_state;
37 this->setInfoName(str);
38}
39int HardWiredMentalBelief::checkForMatch(string _name, int _state){
40 string str = this->getInfoName();
41 int n_return = 0;
42 if(_name.compare(str) == 0){
43 if (_state == this->getExpectedState()){
45 }
46 else{
48 }
49 }
50 else{
51 n_return = 0;
52 }
53 return n_return;
54}
58 fout << "HardWiredMentalBelief " << expected_state << '\n';
60 this->saveKBElementToFile(fout);
61}
63 string str;
64 fin >> str >> expected_state;
65 if (str != "HardWiredMentalBelief"){
66 ofstream fout("err messages.txt", ios::app);
67 cout << "HardWiredMentalBelief::retrieveHardWiredMentalBeliefFromFile in previous function" << endl;
68 fout << r5pars_.timesno << " HardWiredMentalBelief::retrieveHardWiredMentalBeliefFromFile errir in previous function\n";
69 fout.close();
70 r5pars_.sim_err = true;
71 g_sim.Branch_center.setTempESMessage("HardWiredMentalBelief::retrieveHardWiredMentalBeliefFromFile Prior err.");
73 return;
74 }
77}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void setTempTypeOfConsequence(Consequence)
Stores the consequence of the end state the running sequence will get.
void setTempESMessage(std::string)
Stores the description of the end state the running sequence will get if it is terminated (set by mod...
void saveExpectationElementToFile(std::ofstream &)
void retrieveExpectationElementFromFile(std::ifstream &)
void copyExpectationElement(ExpectationElement &)
void saveHardWiredMentalBeliefToFile(std::ofstream &)
int checkForMatch(std::string, int)
void readInfoFromFile(std::ifstream &)
void copyHardWiredMentalBelief(HardWiredMentalBelief &)
void retrieveHardWiredMentalBeliefFromFile(std::ifstream &)
void setInfoName(std::string)
Definition: KBElement.cpp:25
void retrieveKBElementFromFile(std::ifstream &)
Definition: KBElement.cpp:36
void saveKBElementToFile(std::ofstream &)
Definition: KBElement.cpp:33
void copyKBElement(KBElement &)
Definition: KBElement.cpp:30
std::string getInfoName()
Definition: KBElement.cpp:26
struct @0 r5pars_
constexpr int MentalBelief
Definition: SimConstants.h:265
constexpr int Failed
Definition: SimConstants.h:103
constexpr int Succeed
Definition: SimConstants.h:104
constexpr int None
Definition: SimConstants.h:75
BranchRecord Branch_center
Dynamic event tree state.