← Documentation
ADS-IDAC Engine 5.0.0
ProcedureStep.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <typeinfo>
5
6#include <boost/serialization/vector.hpp>
7#include <boost/serialization/unique_ptr.hpp>
8#include <boost/serialization/string.hpp>
9#include <boost/serialization/base_object.hpp>
10#include <boost/archive/text_iarchive.hpp>
11#include <boost/archive/text_oarchive.hpp>
12#include <boost/serialization/split_member.hpp>
13#include <cstdint>
14#include <stdexcept>
15#include <memory>
16#include "ProcedureStepUnit.h"
17#include "../ControlPanel/StateOfActivation.h"
18#include "../Crew/ShortTermMemory.h"
19#include "../Scheduler/AnalysisInfoContainer.h"
20#include "../Scheduler/CommandControlCenter.h"
21#include <vector>
22#include <string>
23#include <boost/serialization/export.hpp>
24
25class Operator; // Assuming Operator is serializable if needed
26
27
29public:
31 virtual ~ProcedureStep();
32 void clear();
33 void setCurrentProcedureName(std::string name);
34 void setCurrentStepName(std::string name);
35 void setNextProcedureName(std::string name);
36 void setNextStepName(std::string name);
37 void setProcedureStepCharacteristics(int characteristics);
38 void setProcedureStepComplexity(double complexity);
39 void setProcedureType(int type);
40 std::string getCurrentProcedureName();
41 std::string getCurrentStepName();
42 std::string getNextProcedureName();
43 std::string getNextStepName();
46 int getProcedureType();
47 void setDescription(std::string desc);
48 std::string getDescription();
49 void readDescriptionFromFile(std::ifstream &);
50 bool readInfoFromFile(std::string, std::string);
52 bool oneThroughProcessForProcedureStep(Operator &, double, double, bool, ShortTermMemory &);
56 bool checkWhetherThisIsAMentalProcedure(std::string);
58 void setBranchControlFlag(int flag);
60 void saveProcedureStepToFile(std::ofstream &);
61 void retrieveProcedureStepFromFile(std::ifstream &);
62 std::vector<std::unique_ptr<ProcedureStepUnit>> procedure_step_unit;
63
64private:
67 std::string description;
72
73 // State overlay: state only. Names, description, and characteristics are
74 // definitions re-seeded from the shared master. Units are written by
75 // count + in-place element state so load never lets Boost reconstruct
76 // the container (reconstruction would default-construct units and wipe
77 // the seeded definitions).
79 BOOST_SERIALIZATION_SPLIT_MEMBER()
80 template<class Archive>
81 void save(Archive &ar, const unsigned int) const {
82 ar & boost::serialization::base_object<StateOfActivation>(*this);
83 const uint32_t n_units = static_cast<uint32_t>(procedure_step_unit.size());
84 ar & n_units;
85 for (const auto& up : procedure_step_unit)
86 ar & *up;
87 }
88 template<class Archive>
89 void load(Archive &ar, const unsigned int) {
90 ar & boost::serialization::base_object<StateOfActivation>(*this);
91 uint32_t n_units = 0;
92 ar & n_units;
93 if (n_units != procedure_step_unit.size())
94 throw std::runtime_error(
95 "ProcedureStep state overlay: unit count mismatch against the seeded book");
96 for (auto& up : procedure_step_unit)
97 ar & *up;
98 }
99};
100
101
102BOOST_CLASS_EXPORT_KEY(ProcedureStep)
std::string next_procedure_name
Definition: ProcedureStep.h:66
void load(Archive &ar, const unsigned int)
Definition: ProcedureStep.h:89
std::string description
Definition: ProcedureStep.h:67
std::vector< std::unique_ptr< ProcedureStepUnit > > procedure_step_unit
Definition: ProcedureStep.h:62
std::string current_procedure_name
Definition: ProcedureStep.h:65
int getProcedureStepCharacteristics()
std::string next_step_name
Definition: ProcedureStep.h:66
void setNextStepName(std::string name)
virtual ~ProcedureStep()
bool checkWhetherThisIsAMentalProcedure(std::string)
double calculateProcedureStepStaticHEPMultiplier()
void setProcedureStepComplexity(double complexity)
std::string getNextProcedureName()
std::string current_step_name
Definition: ProcedureStep.h:65
void copyProcedureStep(ProcedureStep &)
bool oneThroughProcessForProcedureStep(Operator &, double, double, bool, ShortTermMemory &)
double procedure_step_complexity
Definition: ProcedureStep.h:69
std::string getCurrentProcedureName()
void readDescriptionFromFile(std::ifstream &)
void saveProcedureStepToFile(std::ofstream &)
void setDescription(std::string desc)
void setBranchControlFlag(int flag)
int getProcedureType()
int branch_control_flag
Definition: ProcedureStep.h:71
void retrieveProcedureStepFromFile(std::ifstream &)
std::string getCurrentStepName()
int getBranchControlFlag()
bool readInfoFromFile(std::string, std::string)
void setCurrentProcedureName(std::string name)
void setCurrentStepName(std::string name)
friend class boost::serialization::access
Definition: ProcedureStep.h:78
void save(Archive &ar, const unsigned int) const
Definition: ProcedureStep.h:81
bool oneThroughProcessForInstinctiveResponseProcedure(Operator &, double, double, bool, ShortTermMemory &)
void setNextProcedureName(std::string name)
int procedure_step_characteristics
Definition: ProcedureStep.h:68
bool executeInstinctiveResponseProcedureTransfer(Operator &, ShortTermMemory &)
std::string getDescription()
void setProcedureStepCharacteristics(int characteristics)
void setProcedureType(int type)
std::string getNextStepName()
void resetStateOfActivation()
double getProcedureStepComplexity()