← Documentation
ADS-IDAC Engine 5.0.0
AnalysisScanDataContainerUnit.cpp
Go to the documentation of this file.
1// AnalysisScanDataContainerUnit.cpp: implementation of the AnalysisScanDataContainerUnit class.
2//
4
6#include <boost/serialization/export.hpp>
7#include <boost/archive/binary_oarchive.hpp>
8#include <boost/archive/binary_iarchive.hpp>
9BOOST_CLASS_EXPORT_IMPLEMENT(AnalysisScanDataContainerUnit)
10using namespace std;
11
13// Construction/Destruction
15
17 time = -999.0;
18 operator_id = -999;
19}
20
22 this->alarm_name.clear();
23 this->alarm_priority.clear();
24 this->component_name.clear();
25 this->component_priority.clear();
26 this->support_system_name.clear();
27 this->support_system_priority.clear();
28 this->parameter_name.clear();
29 this->parameter_priority.clear();
30}
31
33 int n;
36 //
37 //copy alarms
38 for (n = 0; n < _asdcu.alarm_name.size(); n++) {
39 this->alarm_name.push_back(_asdcu.alarm_name.at(n));
40 this->alarm_priority.push_back(_asdcu.alarm_priority.at(n));
41 }
42 //
43 //copy components
44 for (n = 0; n < _asdcu.component_name.size(); n++) {
45 this->component_name.push_back(_asdcu.component_name.at(n));
46 this->component_priority.push_back(_asdcu.component_priority.at(n));
47 }
48 //
49 //copy support systems
50 for (n = 0; n < _asdcu.support_system_name.size(); n++) {
51 this->support_system_name.push_back(_asdcu.support_system_name.at(n));
52 this->support_system_priority.push_back(_asdcu.support_system_priority.at(n));
53 }
54 //
55 //copy parameters
56 for (n = 0; n < _asdcu.parameter_name.size(); n++) {
57 this->parameter_name.push_back(_asdcu.parameter_name.at(n));
58 this->parameter_priority.push_back(_asdcu.parameter_priority.at(n));
59 }
60}
61
63 int n;
64 fout << "ScanDataInformation" << '\n';
65 fout << time << ' '
66 << operator_id << '\n';
67 fout << this->alarm_name.size() << '\n';
68 for (n = 0; n < this->alarm_name.size(); n++) {
69 fout << this->alarm_name.at(n) << ' '
70 << this->alarm_priority.at(n) << '\n';
71 }
72 //
73 fout << this->component_name.size() << '\n';
74 for (n = 0; n < this->component_name.size(); n++) {
75 fout << this->component_name.at(n) << ' '
76 << this->component_priority.at(n) << '\n';
77 }
78 //
79 fout << this->support_system_name.size() << '\n';
80 for (n = 0; n < this->support_system_name.size(); n++) {
81 fout << this->support_system_name.at(n) << ' '
82 << this->support_system_priority.at(n) << '\n';
83 }
84 //
85 fout << this->parameter_name.size() << '\n';
86 for (n = 0; n < this->parameter_name.size(); n++) {
87 fout << this->parameter_name.at(n) << ' '
88 << this->parameter_priority.at(n) << '\n';
89 }
90
91}
92
94 int i, n, priority;
95 std::string item_name, str;
96 fin >> str;
97 fin >> this->time
98 >> this->operator_id
99 >> n;
100 for (i = 0; i < n; i++) {
101 fin >> item_name
102 >> priority;
103 this->alarm_name.push_back(item_name);
104 this->alarm_priority.push_back(priority);
105 }
106 //
107 fin >> n;
108 for (i = 0; i < n; i++) {
109 fin >> item_name
110 >> priority;
111 this->component_name.push_back(item_name);
112 this->component_priority.push_back(priority);
113 }
114 //
115 fin >> n;
116 for (i = 0; i < n; i++) {
117 fin >> item_name
118 >> priority;
119 this->support_system_name.push_back(item_name);
120 this->support_system_priority.push_back(priority);
121 }
122 //
123 fin >> n;
124 for (i = 0; i < n; i++) {
125 fin >> item_name
126 >> priority;
127 this->parameter_name.push_back(item_name);
128 this->parameter_priority.push_back(priority);
129 }
130}
131
133 std::string operator_type;
134 int n, queue_size;
135
137 operator_type = "ODM";
138 } else if (this->getAnalysisScanDataOperator() == sim::Operator::OAT) {
139 operator_type = "OAT";
140 } else {
141 operator_type = "unknown";
142 }
143 //
144 queue_size = this->alarm_name.size() + this->component_name.size() + this->support_system_name.size()
145 + this->parameter_name.size();
146 fout << this->time << '\t'
147 << operator_type << '\t'
148 << queue_size << '\n';
149 //
150 if (this->alarm_name.size() > 0) {
151 fout << '\t' << "Scanned Alarms" << '\t' << "Priority" << '\n';
152 for (n = 0; n < this->alarm_name.size(); n++) {
153 fout << '\t'
154 << this->alarm_name.at(n) << '\t'
155 << this->alarm_priority.at(n) << '\n';
156 }
157 }
158 //
159 if (this->component_name.size() > 0) {
160 fout << '\t' << "Scanned Components" << '\t' << "Priority" << '\n';
161 for (n = 0; n < this->component_name.size(); n++) {
162 fout << '\t'
163 << this->component_name.at(n) << '\t'
164 << this->component_priority.at(n) << '\n';
165 }
166 }
167 //
168 if (this->support_system_name.size() > 0) {
169 fout << '\t' << "Scanned Support Systems" << '\t' << "Priority" << '\n';
170 for (n = 0; n < this->support_system_name.size(); n++) {
171 fout << '\t'
172 << this->support_system_name.at(n) << '\t'
173 << this->support_system_priority.at(n) << '\n';
174 }
175 }
176 //
177 if (this->parameter_name.size() > 0) {
178 fout << '\t' << "Scanned Parameters" << '\t' << "Priority" << '\n';
179 for (n = 0; n < this->parameter_name.size(); n++) {
180 fout << '\t'
181 << this->parameter_name.at(n) << '\t'
182 << this->parameter_priority.at(n) << '\n';
183 }
184 }
185 //
186}
187
void saveAnalysisScanDataContainerUnittoFile(std::ofstream &)
std::vector< std::string > support_system_name
std::vector< std::string > component_name
void copyAnalysisScanDataContainerUnit(AnalysisScanDataContainerUnit &)
std::vector< std::string > parameter_name
void retrieveAnalysisScanDataContainerUnitfromFile(std::ifstream &)
constexpr int ODM
Definition: SimConstants.h:145
constexpr int OAT
Definition: SimConstants.h:144