PhoenixSwarm  3.5.0
Library to ease communication between daemons
Loading...
Searching...
No Matches
Representation.cpp
Go to the documentation of this file.
1/***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6
7
8#include "Representation.h"
9
11
13template<>
15 return "Data";
16}
17
19
25bool CheckStream<Data>::check_stream(const std::string & fieldDescription, const Data & data, const Data & reference, std::ostream & out){
26 bool b(true);
27 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Data::name", data.getName(), reference.getName(), out);
28 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Data::description", data.getDescription(), reference.getDescription(), out);
29 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Data::type", data.getType(), reference.getType(), out);
30 b &= CheckStream<DataStreamMsg>::check_stream(fieldDescription + "\n- Data::value", data.getValue(), reference.getValue(), out);
31 return b;
32}
33
34
39
42
43}
44
46
48Data::Data(const Data & other){
49 copyData(other);
50}
51
53
56Data & Data::operator = (const Data & other){
57 copyData(other);
58 return *this;
59}
60
62
64void Data::setName(const PString & name){
65 p_name = name;
66}
67
69
71void Data::setDescription(const PString & description){
72 p_description = description;
73}
74
76
78void Data::setType(const PString & type){
79 p_type = type;
80}
81
83
85void Data::setValue(const DataStreamMsg & value){
86 p_value = value;
87}
88
90
92const PString & Data::getName() const{
93 return p_name;
94}
95
97
99PString & Data::getName(){
100 return p_name;
101}
102
104
106const PString & Data::getDescription() const{
107 return p_description;
108}
109
111
114 return p_description;
115}
116
118
120const PString & Data::getType() const{
121 return p_type;
122}
123
125
127PString & Data::getType(){
128 return p_type;
129}
130
132
134const DataStreamMsg & Data::getValue() const{
135 return p_value;
136}
137
139
141DataStreamMsg & Data::getValue(){
142 return p_value;
143}
144
146
148void Data::copyData(const Data & other){
149 p_name = other.p_name;
151 p_type = other.p_type;
152 p_value = other.p_value;
153}
154
157 p_name = "";
158 p_description = "";
159 p_type = "";
160}
161
163
165template<>
167 return "Function";
168}
169
171
177bool CheckStream<Function>::check_stream(const std::string & fieldDescription, const Function & data, const Function & reference, std::ostream & out){
178 bool b(true);
179 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Function::name", data.getName(), reference.getName(), out);
180 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Function::description", data.getDescription(), reference.getDescription(), out);
181 b &= CheckStream<std::vector<Data>>::check_stream(fieldDescription + "\n- Function::vecParam", data.getVecParam(), reference.getVecParam(), out);
182 b &= CheckStream<Data>::check_stream(fieldDescription + "\n- Function::returnValue", data.getReturnValue(), reference.getReturnValue(), out);
183 return b;
184}
185
186
191
196
198
201 copyFunction(other);
202}
203
205
209 copyFunction(other);
210 return *this;
211}
212
214
216void Function::setName(const PString & name){
217 p_name = name;
218}
219
221
223void Function::setDescription(const PString & description){
224 p_description = description;
225}
226
228
230void Function::setVecParam(const std::vector<Data> & vecParam){
231 p_vecParam = vecParam;
232}
233
235
237void Function::setReturnValue(const Data & returnValue){
238 p_returnValue = returnValue;
239}
240
242
244const PString & Function::getName() const{
245 return p_name;
246}
247
249
252 return p_name;
253}
254
256
258const PString & Function::getDescription() const{
259 return p_description;
260}
261
263
266 return p_description;
267}
268
270
272const std::vector<Data> & Function::getVecParam() const{
273 return p_vecParam;
274}
275
277
279std::vector<Data> & Function::getVecParam(){
280 return p_vecParam;
281}
282
284
287 return p_returnValue;
288}
289
291
296
298
301 p_name = other.p_name;
303 p_vecParam = other.p_vecParam;
305}
306
312
314
316template<>
318 return "Message";
319}
320
322
328bool CheckStream<Message>::check_stream(const std::string & fieldDescription, const Message & data, const Message & reference, std::ostream & out){
329 bool b(true);
330 b &= CheckStream<time_t>::check_stream(fieldDescription + "\n- Message::sendTime", data.getSendTime(), reference.getSendTime(), out);
331 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- Message::id", data.getId(), reference.getId(), out);
332 b &= CheckStream<bool>::check_stream(fieldDescription + "\n- Message::isConfirmationNeeded", data.getIsConfirmationNeeded(), reference.getIsConfirmationNeeded(), out);
333 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Message::sender", data.getSender(), reference.getSender(), out);
334 b &= CheckStream<std::vector<PString>>::check_stream(fieldDescription + "\n- Message::vecRecver", data.getVecRecver(), reference.getVecRecver(), out);
335 b &= CheckStream<MessageType::MessageType>::check_stream(fieldDescription + "\n- Message::type", data.getType(), reference.getType(), out);
336 b &= CheckStream<Data>::check_stream(fieldDescription + "\n- Message::data", data.getData(), reference.getData(), out);
337 return b;
338}
339
340
345
350
352
355 copyMessage(other);
356}
357
359
363 copyMessage(other);
364 return *this;
365}
366
368
370void Message::setSendTime(const time_t & sendTime){
371 p_sendTime = sendTime;
372}
373
375
377void Message::setId(size_t id){
378 p_id = id;
379}
380
382
384void Message::setIsConfirmationNeeded(bool isConfirmationNeeded){
385 p_isConfirmationNeeded = isConfirmationNeeded;
386}
387
389
391void Message::setSender(const PString & sender){
392 p_sender = sender;
393}
394
396
398void Message::setVecRecver(const std::vector<PString> & vecRecver){
399 p_vecRecver = vecRecver;
400}
401
403
406 p_type = type;
407}
408
410
412void Message::setData(const Data & data){
413 p_data = data;
414}
415
417
419const time_t & Message::getSendTime() const{
420 return p_sendTime;
421}
422
424
427 return p_sendTime;
428}
429
431
433size_t Message::getId() const{
434 return p_id;
435}
436
438
440size_t & Message::getId(){
441 return p_id;
442}
443
445
450
452
457
459
461const PString & Message::getSender() const{
462 return p_sender;
463}
464
466
469 return p_sender;
470}
471
473
475const std::vector<PString> & Message::getVecRecver() const{
476 return p_vecRecver;
477}
478
480
482std::vector<PString> & Message::getVecRecver(){
483 return p_vecRecver;
484}
485
487
490 return p_type;
491}
492
494
499
501
503const Data & Message::getData() const{
504 return p_data;
505}
506
508
511 return p_data;
512}
513
515
517void Message::copyMessage(const Message & other){
518 p_sendTime = other.p_sendTime;
519 p_id = other.p_id;
521 p_sender = other.p_sender;
522 p_vecRecver = other.p_vecRecver;
523 p_type = other.p_type;
524 p_data = other.p_data;
525}
526
529 p_id = 0lu;
531 p_sender = "";
532}
533
535
537template<>
539 return "VecStat";
540}
541
543
549bool CheckStream<VecStat>::check_stream(const std::string & fieldDescription, const VecStat & data, const VecStat & reference, std::ostream & out){
550 bool b(true);
551 b &= CheckStream<std::vector<size_t>>::check_stream(fieldDescription + "\n- VecStat::nbEvent", data.getNbEvent(), reference.getNbEvent(), out);
552 b &= CheckStream<std::vector<time_t>>::check_stream(fieldDescription + "\n- VecStat::startTimestamp", data.getStartTimestamp(), reference.getStartTimestamp(), out);
553 b &= CheckStream<std::vector<time_t>>::check_stream(fieldDescription + "\n- VecStat::endTimestamp", data.getEndTimestamp(), reference.getEndTimestamp(), out);
554 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::min", data.getMin(), reference.getMin(), out);
555 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::max", data.getMax(), reference.getMax(), out);
556 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::average", data.getAverage(), reference.getAverage(), out);
557 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::rate", data.getRate(), reference.getRate(), out);
558 b &= CheckStream<std::vector<std::vector<float> >>::check_stream(fieldDescription + "\n- VecStat::vecRateQuantile", data.getVecRateQuantile(), reference.getVecRateQuantile(), out);
559 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::rateEventBelowLowerBound", data.getRateEventBelowLowerBound(), reference.getRateEventBelowLowerBound(), out);
560 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::rateEventAboveUpperBound", data.getRateEventAboveUpperBound(), reference.getRateEventAboveUpperBound(), out);
561 return b;
562}
563
564
569
574
576
579 copyVecStat(other);
580}
581
583
587 copyVecStat(other);
588 return *this;
589}
590
592
594void VecStat::setNbEvent(const std::vector<size_t> & nbEvent){
595 p_nbEvent = nbEvent;
596}
597
599
601void VecStat::setStartTimestamp(const std::vector<time_t> & startTimestamp){
602 p_startTimestamp = startTimestamp;
603}
604
606
608void VecStat::setEndTimestamp(const std::vector<time_t> & endTimestamp){
609 p_endTimestamp = endTimestamp;
610}
611
613
615void VecStat::setMin(const std::vector<float> & min){
616 p_min = min;
617}
618
620
622void VecStat::setMax(const std::vector<float> & max){
623 p_max = max;
624}
625
627
629void VecStat::setAverage(const std::vector<float> & average){
630 p_average = average;
631}
632
634
636void VecStat::setRate(const std::vector<float> & rate){
637 p_rate = rate;
638}
639
641
643void VecStat::setVecRateQuantile(const std::vector<std::vector<float> > & vecRateQuantile){
644 p_vecRateQuantile = vecRateQuantile;
645}
646
648
650void VecStat::setRateEventBelowLowerBound(const std::vector<float> & rateEventBelowLowerBound){
651 p_rateEventBelowLowerBound = rateEventBelowLowerBound;
652}
653
655
657void VecStat::setRateEventAboveUpperBound(const std::vector<float> & rateEventAboveUpperBound){
658 p_rateEventAboveUpperBound = rateEventAboveUpperBound;
659}
660
662
664const std::vector<size_t> & VecStat::getNbEvent() const{
665 return p_nbEvent;
666}
667
669
671std::vector<size_t> & VecStat::getNbEvent(){
672 return p_nbEvent;
673}
674
676
678const std::vector<time_t> & VecStat::getStartTimestamp() const{
679 return p_startTimestamp;
680}
681
683
685std::vector<time_t> & VecStat::getStartTimestamp(){
686 return p_startTimestamp;
687}
688
690
692const std::vector<time_t> & VecStat::getEndTimestamp() const{
693 return p_endTimestamp;
694}
695
697
699std::vector<time_t> & VecStat::getEndTimestamp(){
700 return p_endTimestamp;
701}
702
704
706const std::vector<float> & VecStat::getMin() const{
707 return p_min;
708}
709
711
713std::vector<float> & VecStat::getMin(){
714 return p_min;
715}
716
718
720const std::vector<float> & VecStat::getMax() const{
721 return p_max;
722}
723
725
727std::vector<float> & VecStat::getMax(){
728 return p_max;
729}
730
732
734const std::vector<float> & VecStat::getAverage() const{
735 return p_average;
736}
737
739
741std::vector<float> & VecStat::getAverage(){
742 return p_average;
743}
744
746
748const std::vector<float> & VecStat::getRate() const{
749 return p_rate;
750}
751
753
755std::vector<float> & VecStat::getRate(){
756 return p_rate;
757}
758
760
762const std::vector<std::vector<float> > & VecStat::getVecRateQuantile() const{
763 return p_vecRateQuantile;
764}
765
767
769std::vector<std::vector<float> > & VecStat::getVecRateQuantile(){
770 return p_vecRateQuantile;
771}
772
774
776const std::vector<float> & VecStat::getRateEventBelowLowerBound() const{
778}
779
781
786
788
790const std::vector<float> & VecStat::getRateEventAboveUpperBound() const{
792}
793
795
800
802
816
820
822
824template<>
826 return "DaemonStat";
827}
828
830
836bool CheckStream<DaemonStat>::check_stream(const std::string & fieldDescription, const DaemonStat & data, const DaemonStat & reference, std::ostream & out){
837 bool b(true);
838 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- DaemonStat::name", data.getName(), reference.getName(), out);
839 b &= CheckStream<std::map<PString, VecStat >>::check_stream(fieldDescription + "\n- DaemonStat::mapStatComputing", data.getMapStatComputing(), reference.getMapStatComputing(), out);
840 b &= CheckStream<std::map<PString, std::map<PString, VecStat > >>::check_stream(fieldDescription + "\n- DaemonStat::mapStatCommunication", data.getMapStatCommunication(), reference.getMapStatCommunication(), out);
841 return b;
842}
843
844
849
854
856
859 copyDaemonStat(other);
860}
861
863
867 copyDaemonStat(other);
868 return *this;
869}
870
872
874void DaemonStat::setName(const PString & name){
875 p_name = name;
876}
877
879
881void DaemonStat::setMapStatComputing(const std::map<PString, VecStat > & mapStatComputing){
882 p_mapStatComputing = mapStatComputing;
883}
884
886
888void DaemonStat::setMapStatCommunication(const std::map<PString, std::map<PString, VecStat > > & mapStatCommunication){
889 p_mapStatCommunication = mapStatCommunication;
890}
891
893
895const PString & DaemonStat::getName() const{
896 return p_name;
897}
898
900
903 return p_name;
904}
905
907
909const std::map<PString, VecStat > & DaemonStat::getMapStatComputing() const{
910 return p_mapStatComputing;
911}
912
914
916std::map<PString, VecStat > & DaemonStat::getMapStatComputing(){
917 return p_mapStatComputing;
918}
919
921
923const std::map<PString, std::map<PString, VecStat > > & DaemonStat::getMapStatCommunication() const{
925}
926
928
930std::map<PString, std::map<PString, VecStat > > & DaemonStat::getMapStatCommunication(){
932}
933
935
942
947
949
951template<>
953 return "StatAccumulator";
954}
955
957
963bool CheckStream<StatAccumulator>::check_stream(const std::string & fieldDescription, const StatAccumulator & data, const StatAccumulator & reference, std::ostream & out){
964 bool b(true);
965 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- StatAccumulator::nbEvent", data.getNbEvent(), reference.getNbEvent(), out);
966 b &= CheckStream<float>::check_stream(fieldDescription + "\n- StatAccumulator::sum", data.getSum(), reference.getSum(), out);
967 b &= CheckStream<float>::check_stream(fieldDescription + "\n- StatAccumulator::min", data.getMin(), reference.getMin(), out);
968 b &= CheckStream<float>::check_stream(fieldDescription + "\n- StatAccumulator::max", data.getMax(), reference.getMax(), out);
969 b &= CheckStream<std::vector<size_t>>::check_stream(fieldDescription + "\n- StatAccumulator::vecHistogram", data.getVecHistogram(), reference.getVecHistogram(), out);
970 b &= CheckStream<float>::check_stream(fieldDescription + "\n- StatAccumulator::histLowerBound", data.getHistLowerBound(), reference.getHistLowerBound(), out);
971 b &= CheckStream<float>::check_stream(fieldDescription + "\n- StatAccumulator::histUpperBound", data.getHistUpperBound(), reference.getHistUpperBound(), out);
972 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- StatAccumulator::nbEventBelowLowerBound", data.getNbEventBelowLowerBound(), reference.getNbEventBelowLowerBound(), out);
973 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- StatAccumulator::nbEventAboveUpperBound", data.getNbEventAboveUpperBound(), reference.getNbEventAboveUpperBound(), out);
974 return b;
975}
976
977
982
987
989
994
996
1000 copyStatAccumulator(other);
1001 return *this;
1002}
1003
1005
1007void StatAccumulator::setNbEvent(size_t nbEvent){
1008 p_nbEvent = nbEvent;
1009}
1010
1012
1015 p_sum = sum;
1016}
1017
1019
1022 p_min = min;
1023}
1024
1026
1029 p_max = max;
1030}
1031
1033
1035void StatAccumulator::setVecHistogram(const std::vector<size_t> & vecHistogram){
1036 p_vecHistogram = vecHistogram;
1037}
1038
1040
1042void StatAccumulator::setHistLowerBound(float histLowerBound){
1043 p_histLowerBound = histLowerBound;
1044}
1045
1047
1049void StatAccumulator::setHistUpperBound(float histUpperBound){
1050 p_histUpperBound = histUpperBound;
1051}
1052
1054
1056void StatAccumulator::setNbEventBelowLowerBound(size_t nbEventBelowLowerBound){
1057 p_nbEventBelowLowerBound = nbEventBelowLowerBound;
1058}
1059
1061
1063void StatAccumulator::setNbEventAboveUpperBound(size_t nbEventAboveUpperBound){
1064 p_nbEventAboveUpperBound = nbEventAboveUpperBound;
1065}
1066
1068
1071 return p_nbEvent;
1072}
1073
1075
1078 return p_nbEvent;
1079}
1080
1082
1085 return p_sum;
1086}
1087
1089
1092 return p_sum;
1093}
1094
1096
1099 return p_min;
1100}
1101
1103
1106 return p_min;
1107}
1108
1110
1113 return p_max;
1114}
1115
1117
1120 return p_max;
1121}
1122
1124
1126const std::vector<size_t> & StatAccumulator::getVecHistogram() const{
1127 return p_vecHistogram;
1128}
1129
1131
1133std::vector<size_t> & StatAccumulator::getVecHistogram(){
1134 return p_vecHistogram;
1135}
1136
1138
1143
1145
1150
1152
1157
1159
1164
1166
1171
1173
1178
1180
1185
1187
1192
1194
1207
1210 p_nbEvent = 0lu;
1211 p_sum = 0.0f;
1212 p_min = 0.0f;
1213 p_max = 0.0f;
1214 p_histLowerBound = 0.0f;
1215 p_histUpperBound = 0.0f;
1218}
1219
1221
1223template<>
1225 return "DaemonStatAccumulator";
1226}
1227
1229
1235bool CheckStream<DaemonStatAccumulator>::check_stream(const std::string & fieldDescription, const DaemonStatAccumulator & data, const DaemonStatAccumulator & reference, std::ostream & out){
1236 bool b(true);
1237 b &= CheckStream<std::map<PString, StatAccumulator >>::check_stream(fieldDescription + "\n- DaemonStatAccumulator::mapStatComputing", data.getMapStatComputing(), reference.getMapStatComputing(), out);
1238 b &= CheckStream<std::map<PString, std::map<PString, StatAccumulator > >>::check_stream(fieldDescription + "\n- DaemonStatAccumulator::mapStatCommunication", data.getMapStatCommunication(), reference.getMapStatCommunication(), out);
1239 return b;
1240}
1241
1242
1247
1252
1254
1259
1261
1268
1270
1272void DaemonStatAccumulator::setMapStatComputing(const std::map<PString, StatAccumulator > & mapStatComputing){
1273 p_mapStatComputing = mapStatComputing;
1274}
1275
1277
1279void DaemonStatAccumulator::setMapStatCommunication(const std::map<PString, std::map<PString, StatAccumulator > > & mapStatCommunication){
1280 p_mapStatCommunication = mapStatCommunication;
1281}
1282
1284
1286const std::map<PString, StatAccumulator > & DaemonStatAccumulator::getMapStatComputing() const{
1287 return p_mapStatComputing;
1288}
1289
1291
1293std::map<PString, StatAccumulator > & DaemonStatAccumulator::getMapStatComputing(){
1294 return p_mapStatComputing;
1295}
1296
1298
1300const std::map<PString, std::map<PString, StatAccumulator > > & DaemonStatAccumulator::getMapStatCommunication() const{
1302}
1303
1305
1307std::map<PString, std::map<PString, StatAccumulator > > & DaemonStatAccumulator::getMapStatCommunication(){
1309}
1310
1312
1318
1322
1324
1326template<>
1328 return "DaemonConfig";
1329}
1330
1332
1338bool CheckStream<DaemonConfig>::check_stream(const std::string & fieldDescription, const DaemonConfig & data, const DaemonConfig & reference, std::ostream & out){
1339 bool b(true);
1340 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- DaemonConfig::hostName", data.getHostName(), reference.getHostName(), out);
1341 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- DaemonConfig::receivingPort", data.getReceivingPort(), reference.getReceivingPort(), out);
1342 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- DaemonConfig::name", data.getName(), reference.getName(), out);
1343 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- DaemonConfig::description", data.getDescription(), reference.getDescription(), out);
1344 b &= CheckStream<std::map<PString, time_t>>::check_stream(fieldDescription + "\n- DaemonConfig::mapTimeout", data.getMapTimeout(), reference.getMapTimeout(), out);
1345 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- DaemonConfig::statNbBin", data.getStatNbBin(), reference.getStatNbBin(), out);
1346 b &= CheckStream<float>::check_stream(fieldDescription + "\n- DaemonConfig::statHistLowerBound", data.getStatHistLowerBound(), reference.getStatHistLowerBound(), out);
1347 b &= CheckStream<float>::check_stream(fieldDescription + "\n- DaemonConfig::statHistUpperBound", data.getStatHistUpperBound(), reference.getStatHistUpperBound(), out);
1348 b &= CheckStream<time_t>::check_stream(fieldDescription + "\n- DaemonConfig::statTimerPeriodMs", data.getStatTimerPeriodMs(), reference.getStatTimerPeriodMs(), out);
1349 b &= CheckStream<DaemonStatAccumulator>::check_stream(fieldDescription + "\n- DaemonConfig::daemonStatAccumulator", data.getDaemonStatAccumulator(), reference.getDaemonStatAccumulator(), out);
1350 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- DaemonConfig::statDaemonName", data.getStatDaemonName(), reference.getStatDaemonName(), out);
1351 return b;
1352}
1353
1354
1359
1364
1366
1371
1373
1377 copyDaemonConfig(other);
1378 return *this;
1379}
1380
1382
1384void DaemonConfig::setHostName(const PString & hostName){
1385 p_hostName = hostName;
1386}
1387
1389
1391void DaemonConfig::setReceivingPort(size_t receivingPort){
1392 p_receivingPort = receivingPort;
1393}
1394
1396
1398void DaemonConfig::setName(const PString & name){
1399 p_name = name;
1400}
1401
1403
1405void DaemonConfig::setDescription(const PString & description){
1406 p_description = description;
1407}
1408
1410
1412void DaemonConfig::setMapTimeout(const std::map<PString, time_t> & mapTimeout){
1413 p_mapTimeout = mapTimeout;
1414}
1415
1417
1419void DaemonConfig::setStatNbBin(size_t statNbBin){
1420 p_statNbBin = statNbBin;
1421}
1422
1424
1426void DaemonConfig::setStatHistLowerBound(float statHistLowerBound){
1427 p_statHistLowerBound = statHistLowerBound;
1428}
1429
1431
1433void DaemonConfig::setStatHistUpperBound(float statHistUpperBound){
1434 p_statHistUpperBound = statHistUpperBound;
1435}
1436
1438
1440void DaemonConfig::setStatTimerPeriodMs(const time_t & statTimerPeriodMs){
1441 p_statTimerPeriodMs = statTimerPeriodMs;
1442}
1443
1445
1448 p_daemonStatAccumulator = daemonStatAccumulator;
1449}
1450
1452
1454void DaemonConfig::setStatDaemonName(const PString & statDaemonName){
1455 p_statDaemonName = statDaemonName;
1456}
1457
1459
1461const PString & DaemonConfig::getHostName() const{
1462 return p_hostName;
1463}
1464
1466
1469 return p_hostName;
1470}
1471
1473
1476 return p_receivingPort;
1477}
1478
1480
1485
1487
1489const PString & DaemonConfig::getName() const{
1490 return p_name;
1491}
1492
1494
1497 return p_name;
1498}
1499
1501
1503const PString & DaemonConfig::getDescription() const{
1504 return p_description;
1505}
1506
1508
1511 return p_description;
1512}
1513
1515
1517const std::map<PString, time_t> & DaemonConfig::getMapTimeout() const{
1518 return p_mapTimeout;
1519}
1520
1522
1524std::map<PString, time_t> & DaemonConfig::getMapTimeout(){
1525 return p_mapTimeout;
1526}
1527
1529
1532 return p_statNbBin;
1533}
1534
1536
1539 return p_statNbBin;
1540}
1541
1543
1548
1550
1555
1557
1562
1564
1569
1571
1574 return p_statTimerPeriodMs;
1575}
1576
1578
1583
1585
1590
1592
1597
1599
1601const PString & DaemonConfig::getStatDaemonName() const{
1602 return p_statDaemonName;
1603}
1604
1606
1611
1613
1628
1631 p_hostName = "";
1632 p_receivingPort = 0lu;
1633 p_name = "";
1634 p_description = "";
1635 p_statNbBin = 0lu;
1636 p_statHistLowerBound = 0.0f;
1637 p_statHistUpperBound = 0.0f;
1638 p_statDaemonName = "";
1639}
1640
std::string phoenix_getTypeName< StatAccumulator >()
Get the name of the class StatAccumulator for PhoenixTypeStream.
std::string phoenix_getTypeName< VecStat >()
Get the name of the class VecStat for PhoenixTypeStream.
std::string phoenix_getTypeName< DaemonStatAccumulator >()
Get the name of the class DaemonStatAccumulator for PhoenixTypeStream.
std::string phoenix_getTypeName< Function >()
Get the name of the class Function for PhoenixTypeStream.
std::string phoenix_getTypeName< Data >()
Get the name of the class Data for PhoenixTypeStream.
std::string phoenix_getTypeName< Message >()
Get the name of the class Message for PhoenixTypeStream.
std::string phoenix_getTypeName< DaemonConfig >()
Get the name of the class DaemonConfig for PhoenixTypeStream.
std::string phoenix_getTypeName< DaemonStat >()
Get the name of the class DaemonStat for PhoenixTypeStream.
Describe a Daemon of the Swarm.
const PString & getName() const
Gets the name of the DaemonConfig.
float p_statHistLowerBound
Lower bound for the histogram of the communication statistics.
DaemonConfig()
Constructor of class DaemonConfig.
DaemonConfig & operator=(const DaemonConfig &other)
Operator = of class DaemonConfig.
size_t getStatNbBin() const
Gets the statNbBin of the DaemonConfig.
size_t p_statNbBin
Number of bin for the histogram of the communication statistics.
void setDescription(const PString &description)
Sets the description of the DaemonConfig.
const time_t & getStatTimerPeriodMs() const
Gets the statTimerPeriodMs of the DaemonConfig.
PString p_description
Description of the Daemon.
const DaemonStatAccumulator & getDaemonStatAccumulator() const
Gets the daemonStatAccumulator of the DaemonConfig.
size_t p_receivingPort
Port which is used by the Daemon to receive messages.
const PString & getStatDaemonName() const
Gets the statDaemonName of the DaemonConfig.
float p_statHistUpperBound
Upper bound for the histogram of the communication statistics.
PString p_hostName
Name of the host where the daemon is running.
const PString & getDescription() const
Gets the description of the DaemonConfig.
void setStatHistLowerBound(float statHistLowerBound)
Sets the statHistLowerBound of the DaemonConfig.
const std::map< PString, time_t > & getMapTimeout() const
Gets the mapTimeout of the DaemonConfig.
DaemonStatAccumulator p_daemonStatAccumulator
Accumulator used to create statistics of the current Daemon.
void setDaemonStatAccumulator(const DaemonStatAccumulator &daemonStatAccumulator)
Sets the daemonStatAccumulator of the DaemonConfig.
virtual ~DaemonConfig()
Destructor of class DaemonConfig.
void setStatHistUpperBound(float statHistUpperBound)
Sets the statHistUpperBound of the DaemonConfig.
std::map< PString, time_t > p_mapTimeout
Map of the timeout for each daemon in the configuration file.
float getStatHistLowerBound() const
Gets the statHistLowerBound of the DaemonConfig.
void setReceivingPort(size_t receivingPort)
Sets the receivingPort of the DaemonConfig.
void setName(const PString &name)
Sets the name of the DaemonConfig.
PString p_name
Name of the Daemon.
void setStatDaemonName(const PString &statDaemonName)
Sets the statDaemonName of the DaemonConfig.
float getStatHistUpperBound() const
Gets the statHistUpperBound of the DaemonConfig.
const PString & getHostName() const
Gets the hostName of the DaemonConfig.
void copyDaemonConfig(const DaemonConfig &other)
Copy Function of class DaemonConfig.
size_t getReceivingPort() const
Gets the receivingPort of the DaemonConfig.
void initialisationDaemonConfig()
Initialisation Function of class DaemonConfig.
time_t p_statTimerPeriodMs
Period (in ms) to send statistics to the stat daemon.
PString p_statDaemonName
Name of the Daemon which is used to gather statistics of the swarm (empty if no stat daemon is used)
void setHostName(const PString &hostName)
Sets the hostName of the DaemonConfig.
void setStatTimerPeriodMs(const time_t &statTimerPeriodMs)
Sets the statTimerPeriodMs of the DaemonConfig.
void setMapTimeout(const std::map< PString, time_t > &mapTimeout)
Sets the mapTimeout of the DaemonConfig.
void setStatNbBin(size_t statNbBin)
Sets the statNbBin of the DaemonConfig.
Accumulator of all events occurence on a Daemon (processing functions and communication latencies) to...
void initialisationDaemonStatAccumulator()
Initialisation Function of class DaemonStatAccumulator.
const std::map< PString, StatAccumulator > & getMapStatComputing() const
Gets the mapStatComputing of the DaemonStatAccumulator.
const std::map< PString, std::map< PString, StatAccumulator > > & getMapStatCommunication() const
Gets the mapStatCommunication of the DaemonStatAccumulator.
std::map< PString, StatAccumulator > p_mapStatComputing
Map of the computing statistics (key: stat name, value vector of stat)
std::map< PString, std::map< PString, StatAccumulator > > p_mapStatCommunication
Map of the communication statistics (key: destination daemon name, value: {key: data type,...
DaemonStatAccumulator & operator=(const DaemonStatAccumulator &other)
Operator = of class DaemonStatAccumulator.
void setMapStatComputing(const std::map< PString, StatAccumulator > &mapStatComputing)
Sets the mapStatComputing of the DaemonStatAccumulator.
DaemonStatAccumulator()
Constructor of class DaemonStatAccumulator.
void setMapStatCommunication(const std::map< PString, std::map< PString, StatAccumulator > > &mapStatCommunication)
Sets the mapStatCommunication of the DaemonStatAccumulator.
void copyDaemonStatAccumulator(const DaemonStatAccumulator &other)
Copy Function of class DaemonStatAccumulator.
virtual ~DaemonStatAccumulator()
Destructor of class DaemonStatAccumulator.
Statistics of a Daemon.
void setName(const PString &name)
Sets the name of the DaemonStat.
std::map< PString, VecStat > p_mapStatComputing
Map of the computing statistics (key: stat name, value vector of stat)
const std::map< PString, VecStat > & getMapStatComputing() const
Gets the mapStatComputing of the DaemonStat.
std::map< PString, std::map< PString, VecStat > > p_mapStatCommunication
Map of the communication statistics (key: destination daemon name, value: {key: data type,...
PString p_name
Name of the Daemon where the stats come from.
virtual ~DaemonStat()
Destructor of class DaemonStat.
const std::map< PString, std::map< PString, VecStat > > & getMapStatCommunication() const
Gets the mapStatCommunication of the DaemonStat.
void setMapStatCommunication(const std::map< PString, std::map< PString, VecStat > > &mapStatCommunication)
Sets the mapStatCommunication of the DaemonStat.
const PString & getName() const
Gets the name of the DaemonStat.
void setMapStatComputing(const std::map< PString, VecStat > &mapStatComputing)
Sets the mapStatComputing of the DaemonStat.
void initialisationDaemonStat()
Initialisation Function of class DaemonStat.
DaemonStat & operator=(const DaemonStat &other)
Operator = of class DaemonStat.
void copyDaemonStat(const DaemonStat &other)
Copy Function of class DaemonStat.
DaemonStat()
Constructor of class DaemonStat.
Basic Data exchanged in the swarm.
void initialisationData()
Initialisation Function of class Data.
void setValue(const DataStreamMsg &value)
Sets the value of the Data.
PString p_description
Description of the Data.
const PString & getDescription() const
Gets the description of the Data.
void setType(const PString &type)
Sets the type of the Data.
const PString & getType() const
Gets the type of the Data.
virtual ~Data()
Destructor of class Data.
const DataStreamMsg & getValue() const
Gets the value of the Data.
PString p_name
Name of the Data.
Data & operator=(const Data &other)
Operator = of class Data.
void setDescription(const PString &description)
Sets the description of the Data.
const PString & getName() const
Gets the name of the Data.
void copyData(const Data &other)
Copy Function of class Data.
PString p_type
Type of the Data.
DataStreamMsg p_value
Value of the Data.
void setName(const PString &name)
Sets the name of the Data.
Data()
Constructor of class Data.
Basic function which can be called from an other Daemon.
const std::vector< Data > & getVecParam() const
Gets the vecParam of the Function.
const PString & getName() const
Gets the name of the Function.
PString p_description
Description of the Function.
virtual ~Function()
Destructor of class Function.
void copyFunction(const Function &other)
Copy Function of class Function.
void setName(const PString &name)
Sets the name of the Function.
Data p_returnValue
Return value of the Function.
Function & operator=(const Function &other)
Operator = of class Function.
void setVecParam(const std::vector< Data > &vecParam)
Sets the vecParam of the Function.
std::vector< Data > p_vecParam
Vector of parameters of the Function.
void setReturnValue(const Data &returnValue)
Sets the returnValue of the Function.
const Data & getReturnValue() const
Gets the returnValue of the Function.
void setDescription(const PString &description)
Sets the description of the Function.
void initialisationFunction()
Initialisation Function of class Function.
const PString & getDescription() const
Gets the description of the Function.
Function()
Constructor of class Function.
PString p_name
Name of the Function.
Message exchanged by Daemons.
MessageType::MessageType p_type
Type of the message.
const PString & getSender() const
Gets the sender of the Message.
void setVecRecver(const std::vector< PString > &vecRecver)
Sets the vecRecver of the Message.
Data p_data
Data in the message.
bool p_isConfirmationNeeded
True if the MESSAGE_CONFIRMATION is needed.
virtual ~Message()
Destructor of class Message.
std::vector< PString > p_vecRecver
Addresses of Daemons which receive the message.
Message & operator=(const Message &other)
Operator = of class Message.
void copyMessage(const Message &other)
Copy Function of class Message.
Message()
Constructor of class Message.
PString p_sender
Address of the Daemon which sends the message.
void setType(const MessageType::MessageType &type)
Sets the type of the Message.
const std::vector< PString > & getVecRecver() const
Gets the vecRecver of the Message.
time_t p_sendTime
Time when the message was sent.
void setSendTime(const time_t &sendTime)
Sets the sendTime of the Message.
void initialisationMessage()
Initialisation Function of class Message.
void setSender(const PString &sender)
Sets the sender of the Message.
const Data & getData() const
Gets the data of the Message.
size_t getId() const
Gets the id of the Message.
bool getIsConfirmationNeeded() const
Gets the isConfirmationNeeded of the Message.
void setIsConfirmationNeeded(bool isConfirmationNeeded)
Sets the isConfirmationNeeded of the Message.
void setId(size_t id)
Sets the id of the Message.
const MessageType::MessageType & getType() const
Gets the type of the Message.
const time_t & getSendTime() const
Gets the sendTime of the Message.
void setData(const Data &data)
Sets the data of the Message.
size_t p_id
Id of the message (will be usefull to trigger method when a transmission is confirmed)
Accumulator of event occurence to build swarm statistics over a time period.
float getHistUpperBound() const
Gets the histUpperBound of the StatAccumulator.
void setMin(float min)
Sets the min of the StatAccumulator.
float getSum() const
Gets the sum of the StatAccumulator.
void setVecHistogram(const std::vector< size_t > &vecHistogram)
Sets the vecHistogram of the StatAccumulator.
float p_min
Minimum value of the stat.
void initialisationStatAccumulator()
Initialisation Function of class StatAccumulator.
size_t getNbEvent() const
Gets the nbEvent of the StatAccumulator.
float getMax() const
Gets the max of the StatAccumulator.
size_t getNbEventAboveUpperBound() const
Gets the nbEventAboveUpperBound of the StatAccumulator.
float getMin() const
Gets the min of the StatAccumulator.
size_t p_nbEventBelowLowerBound
Number of events below the lower bound.
float getHistLowerBound() const
Gets the histLowerBound of the StatAccumulator.
void setHistUpperBound(float histUpperBound)
Sets the histUpperBound of the StatAccumulator.
void setMax(float max)
Sets the max of the StatAccumulator.
StatAccumulator & operator=(const StatAccumulator &other)
Operator = of class StatAccumulator.
float p_histLowerBound
Minimum value in the histogram.
float p_max
Maximum value of the stat.
StatAccumulator()
Constructor of class StatAccumulator.
void copyStatAccumulator(const StatAccumulator &other)
Copy Function of class StatAccumulator.
void setNbEventAboveUpperBound(size_t nbEventAboveUpperBound)
Sets the nbEventAboveUpperBound of the StatAccumulator.
float p_histUpperBound
Maximum value in the histogram.
void setHistLowerBound(float histLowerBound)
Sets the histLowerBound of the StatAccumulator.
size_t p_nbEventAboveUpperBound
Number of events above the upper boundary.
size_t p_nbEvent
Number of events used to make this statistic.
virtual ~StatAccumulator()
Destructor of class StatAccumulator.
void setNbEventBelowLowerBound(size_t nbEventBelowLowerBound)
Sets the nbEventBelowLowerBound of the StatAccumulator.
float p_sum
Sum of all values.
void setSum(float sum)
Sets the sum of the StatAccumulator.
size_t getNbEventBelowLowerBound() const
Gets the nbEventBelowLowerBound of the StatAccumulator.
const std::vector< size_t > & getVecHistogram() const
Gets the vecHistogram of the StatAccumulator.
std::vector< size_t > p_vecHistogram
Histogram to acccumulate event counts per quantile.
void setNbEvent(size_t nbEvent)
Sets the nbEvent of the StatAccumulator.
General statistics in the swarm.
void setVecRateQuantile(const std::vector< std::vector< float > > &vecRateQuantile)
Sets the vecRateQuantile of the VecStat.
std::vector< time_t > p_endTimestamp
Timestamp where this stat was finished to be accumulated by the clock of the current daemon (TODO: ne...
std::vector< float > p_max
Maximum value of the stat.
const std::vector< float > & getMax() const
Gets the max of the VecStat.
const std::vector< time_t > & getEndTimestamp() const
Gets the endTimestamp of the VecStat.
void setEndTimestamp(const std::vector< time_t > &endTimestamp)
Sets the endTimestamp of the VecStat.
void setMin(const std::vector< float > &min)
Sets the min of the VecStat.
const std::vector< float > & getRate() const
Gets the rate of the VecStat.
std::vector< float > p_rateEventAboveUpperBound
Number of events above the upper boundary per second.
void setNbEvent(const std::vector< size_t > &nbEvent)
Sets the nbEvent of the VecStat.
void setStartTimestamp(const std::vector< time_t > &startTimestamp)
Sets the startTimestamp of the VecStat.
void setRateEventAboveUpperBound(const std::vector< float > &rateEventAboveUpperBound)
Sets the rateEventAboveUpperBound of the VecStat.
void setRate(const std::vector< float > &rate)
Sets the rate of the VecStat.
VecStat & operator=(const VecStat &other)
Operator = of class VecStat.
const std::vector< time_t > & getStartTimestamp() const
Gets the startTimestamp of the VecStat.
std::vector< float > p_rateEventBelowLowerBound
Number of events below the lower boundary per second.
std::vector< float > p_min
Minimum value of the stat.
virtual ~VecStat()
Destructor of class VecStat.
std::vector< float > p_average
Mean of the stat.
const std::vector< float > & getAverage() const
Gets the average of the VecStat.
const std::vector< float > & getRateEventBelowLowerBound() const
Gets the rateEventBelowLowerBound of the VecStat.
std::vector< time_t > p_startTimestamp
Timestamp where this stat started to be accumulated by the clock of the current daemon (TODO: need un...
const std::vector< float > & getRateEventAboveUpperBound() const
Gets the rateEventAboveUpperBound of the VecStat.
std::vector< float > p_rate
Number of events per second.
std::vector< std::vector< float > > p_vecRateQuantile
Vector of binned event rate per quantile (quartile decile, etc)
std::vector< size_t > p_nbEvent
Number of events used to make this statistic.
const std::vector< float > & getMin() const
Gets the min of the VecStat.
void setRateEventBelowLowerBound(const std::vector< float > &rateEventBelowLowerBound)
Sets the rateEventBelowLowerBound of the VecStat.
void copyVecStat(const VecStat &other)
Copy Function of class VecStat.
VecStat()
Constructor of class VecStat.
void initialisationVecStat()
Initialisation Function of class VecStat.
const std::vector< size_t > & getNbEvent() const
Gets the nbEvent of the VecStat.
const std::vector< std::vector< float > > & getVecRateQuantile() const
Gets the vecRateQuantile of the VecStat.
void setMax(const std::vector< float > &max)
Sets the max of the VecStat.
void setAverage(const std::vector< float > &average)
Sets the average of the VecStat.
MessageType
Type of the Message which can be exchanged by Daemon.
Definition MessageType.h:16
static bool check_stream(const std::string &fieldDescription, const DaemonConfig &data, const DaemonConfig &reference, std::ostream &out)
Check Stream for a DaemonConfig.
static bool check_stream(const std::string &fieldDescription, const DaemonStatAccumulator &data, const DaemonStatAccumulator &reference, std::ostream &out)
Check Stream for a DaemonStatAccumulator.
static bool check_stream(const std::string &fieldDescription, const DaemonStat &data, const DaemonStat &reference, std::ostream &out)
Check Stream for a DaemonStat.
static bool check_stream(const std::string &fieldDescription, const Data &data, const Data &reference, std::ostream &out)
Check Stream for a Data.
static bool check_stream(const std::string &fieldDescription, const Function &data, const Function &reference, std::ostream &out)
Check Stream for a Function.
static bool check_stream(const std::string &fieldDescription, const Message &data, const Message &reference, std::ostream &out)
Check Stream for a Message.
static bool check_stream(const std::string &fieldDescription, const StatAccumulator &data, const StatAccumulator &reference, std::ostream &out)
Check Stream for a StatAccumulator.
static bool check_stream(const std::string &fieldDescription, const VecStat &data, const VecStat &reference, std::ostream &out)
Check Stream for a VecStat.