PhoenixSwarm  5.1.1
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
10using namespace Swarm;
11
13
15template<>
17 return "Data";
18}
19
21
27bool CheckStream<Swarm::Data>::check_stream(const std::string & fieldDescription, const Swarm::Data & data, const Swarm::Data & reference, std::ostream & out){
28 bool b(true);
29 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Data::name", data.getName(), reference.getName(), out);
30 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Data::description", data.getDescription(), reference.getDescription(), out);
31 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Data::type", data.getType(), reference.getType(), out);
32 b &= CheckStream<DataStreamMsg>::check_stream(fieldDescription + "\n- Data::value", data.getValue(), reference.getValue(), out);
33 return b;
34}
35
36
41
44
45}
46
48
50Data::Data(const Data & other){
51 copyData(other);
52}
53
55
58Data & Data::operator = (const Data & other){
59 copyData(other);
60 return *this;
61}
62
64
66void Data::setName(const PString & name){
67 p_name = name;
68}
69
71
73void Data::setDescription(const PString & description){
74 p_description = description;
75}
76
78
80void Data::setType(const PString & type){
81 p_type = type;
82}
83
85
87void Data::setValue(const DataStreamMsg & value){
88 p_value = value;
89}
90
92
94const PString & Data::getName() const{
95 return p_name;
96}
97
99
101PString & Data::getName(){
102 return p_name;
103}
104
106
108const PString & Data::getDescription() const{
109 return p_description;
110}
111
113
116 return p_description;
117}
118
120
122const PString & Data::getType() const{
123 return p_type;
124}
125
127
129PString & Data::getType(){
130 return p_type;
131}
132
134
136const DataStreamMsg & Data::getValue() const{
137 return p_value;
138}
139
141
143DataStreamMsg & Data::getValue(){
144 return p_value;
145}
146
148
150void Data::copyData(const Data & other){
151 p_name = other.p_name;
153 p_type = other.p_type;
154 p_value = other.p_value;
155}
156
159 p_name = "";
160 p_description = "";
161 p_type = "";
162}
163
165
167template<>
169 return "Function";
170}
171
173
179bool CheckStream<Swarm::Function>::check_stream(const std::string & fieldDescription, const Swarm::Function & data, const Swarm::Function & reference, std::ostream & out){
180 bool b(true);
181 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Function::name", data.getName(), reference.getName(), out);
182 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Function::description", data.getDescription(), reference.getDescription(), out);
183 b &= CheckStream<std::vector<Swarm::Data>>::check_stream(fieldDescription + "\n- Function::vecParam", data.getVecParam(), reference.getVecParam(), out);
184 b &= CheckStream<Swarm::Data>::check_stream(fieldDescription + "\n- Function::returnValue", data.getReturnValue(), reference.getReturnValue(), out);
185 return b;
186}
187
188
193
198
200
203 copyFunction(other);
204}
205
207
211 copyFunction(other);
212 return *this;
213}
214
216
218void Function::setName(const PString & name){
219 p_name = name;
220}
221
223
225void Function::setDescription(const PString & description){
226 p_description = description;
227}
228
230
232void Function::setVecParam(const std::vector<Swarm::Data> & vecParam){
233 p_vecParam = vecParam;
234}
235
237
239void Function::setReturnValue(const Swarm::Data & returnValue){
240 p_returnValue = returnValue;
241}
242
244
246const PString & Function::getName() const{
247 return p_name;
248}
249
251
254 return p_name;
255}
256
258
260const PString & Function::getDescription() const{
261 return p_description;
262}
263
265
268 return p_description;
269}
270
272
274const std::vector<Swarm::Data> & Function::getVecParam() const{
275 return p_vecParam;
276}
277
279
281std::vector<Swarm::Data> & Function::getVecParam(){
282 return p_vecParam;
283}
284
286
289 return p_returnValue;
290}
291
293
298
300
303 p_name = other.p_name;
305 p_vecParam = other.p_vecParam;
307}
308
314
316
318template<>
320 return "Message";
321}
322
324
330bool CheckStream<Swarm::Message>::check_stream(const std::string & fieldDescription, const Swarm::Message & data, const Swarm::Message & reference, std::ostream & out){
331 bool b(true);
332 b &= CheckStream<time_t>::check_stream(fieldDescription + "\n- Message::sendTime", data.getSendTime(), reference.getSendTime(), out);
333 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- Message::id", data.getId(), reference.getId(), out);
334 b &= CheckStream<bool>::check_stream(fieldDescription + "\n- Message::isConfirmationNeeded", data.getIsConfirmationNeeded(), reference.getIsConfirmationNeeded(), out);
335 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Message::sender", data.getSender(), reference.getSender(), out);
336 b &= CheckStream<std::vector<PString>>::check_stream(fieldDescription + "\n- Message::vecRecver", data.getVecRecver(), reference.getVecRecver(), out);
337 b &= CheckStream<MessageType::MessageType>::check_stream(fieldDescription + "\n- Message::type", data.getType(), reference.getType(), out);
338 b &= CheckStream<Swarm::Data>::check_stream(fieldDescription + "\n- Message::data", data.getData(), reference.getData(), out);
339 return b;
340}
341
342
347
352
354
357 copyMessage(other);
358}
359
361
365 copyMessage(other);
366 return *this;
367}
368
370
372void Message::setSendTime(const time_t & sendTime){
373 p_sendTime = sendTime;
374}
375
377
379void Message::setId(size_t id){
380 p_id = id;
381}
382
384
386void Message::setIsConfirmationNeeded(bool isConfirmationNeeded){
387 p_isConfirmationNeeded = isConfirmationNeeded;
388}
389
391
393void Message::setSender(const PString & sender){
394 p_sender = sender;
395}
396
398
400void Message::setVecRecver(const std::vector<PString> & vecRecver){
401 p_vecRecver = vecRecver;
402}
403
405
408 p_type = type;
409}
410
412
414void Message::setData(const Swarm::Data & data){
415 p_data = data;
416}
417
419
421const time_t & Message::getSendTime() const{
422 return p_sendTime;
423}
424
426
429 return p_sendTime;
430}
431
433
435size_t Message::getId() const{
436 return p_id;
437}
438
440
442size_t & Message::getId(){
443 return p_id;
444}
445
447
452
454
459
461
463const PString & Message::getSender() const{
464 return p_sender;
465}
466
468
471 return p_sender;
472}
473
475
477const std::vector<PString> & Message::getVecRecver() const{
478 return p_vecRecver;
479}
480
482
484std::vector<PString> & Message::getVecRecver(){
485 return p_vecRecver;
486}
487
489
492 return p_type;
493}
494
496
501
503
506 return p_data;
507}
508
510
513 return p_data;
514}
515
517
519void Message::copyMessage(const Message & other){
520 p_sendTime = other.p_sendTime;
521 p_id = other.p_id;
523 p_sender = other.p_sender;
524 p_vecRecver = other.p_vecRecver;
525 p_type = other.p_type;
526 p_data = other.p_data;
527}
528
531 p_id = 0lu;
533 p_sender = "";
534}
535
537
539template<>
541 return "VecStat";
542}
543
545
551bool CheckStream<Swarm::VecStat>::check_stream(const std::string & fieldDescription, const Swarm::VecStat & data, const Swarm::VecStat & reference, std::ostream & out){
552 bool b(true);
553 b &= CheckStream<std::vector<size_t>>::check_stream(fieldDescription + "\n- VecStat::nbEvent", data.getNbEvent(), reference.getNbEvent(), out);
554 b &= CheckStream<std::vector<time_t>>::check_stream(fieldDescription + "\n- VecStat::startTimestamp", data.getStartTimestamp(), reference.getStartTimestamp(), out);
555 b &= CheckStream<std::vector<time_t>>::check_stream(fieldDescription + "\n- VecStat::endTimestamp", data.getEndTimestamp(), reference.getEndTimestamp(), out);
556 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::min", data.getMin(), reference.getMin(), out);
557 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::max", data.getMax(), reference.getMax(), out);
558 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::average", data.getAverage(), reference.getAverage(), out);
559 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::rate", data.getRate(), reference.getRate(), out);
560 b &= CheckStream<std::vector<std::vector<float> >>::check_stream(fieldDescription + "\n- VecStat::vecRateQuantile", data.getVecRateQuantile(), reference.getVecRateQuantile(), out);
561 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::rateEventBelowLowerBound", data.getRateEventBelowLowerBound(), reference.getRateEventBelowLowerBound(), out);
562 b &= CheckStream<std::vector<float>>::check_stream(fieldDescription + "\n- VecStat::rateEventAboveUpperBound", data.getRateEventAboveUpperBound(), reference.getRateEventAboveUpperBound(), out);
563 return b;
564}
565
566
571
576
578
581 copyVecStat(other);
582}
583
585
589 copyVecStat(other);
590 return *this;
591}
592
594
596void VecStat::setNbEvent(const std::vector<size_t> & nbEvent){
597 p_nbEvent = nbEvent;
598}
599
601
603void VecStat::setStartTimestamp(const std::vector<time_t> & startTimestamp){
604 p_startTimestamp = startTimestamp;
605}
606
608
610void VecStat::setEndTimestamp(const std::vector<time_t> & endTimestamp){
611 p_endTimestamp = endTimestamp;
612}
613
615
617void VecStat::setMin(const std::vector<float> & min){
618 p_min = min;
619}
620
622
624void VecStat::setMax(const std::vector<float> & max){
625 p_max = max;
626}
627
629
631void VecStat::setAverage(const std::vector<float> & average){
632 p_average = average;
633}
634
636
638void VecStat::setRate(const std::vector<float> & rate){
639 p_rate = rate;
640}
641
643
645void VecStat::setVecRateQuantile(const std::vector<std::vector<float> > & vecRateQuantile){
646 p_vecRateQuantile = vecRateQuantile;
647}
648
650
652void VecStat::setRateEventBelowLowerBound(const std::vector<float> & rateEventBelowLowerBound){
653 p_rateEventBelowLowerBound = rateEventBelowLowerBound;
654}
655
657
659void VecStat::setRateEventAboveUpperBound(const std::vector<float> & rateEventAboveUpperBound){
660 p_rateEventAboveUpperBound = rateEventAboveUpperBound;
661}
662
664
666const std::vector<size_t> & VecStat::getNbEvent() const{
667 return p_nbEvent;
668}
669
671
673std::vector<size_t> & VecStat::getNbEvent(){
674 return p_nbEvent;
675}
676
678
680const std::vector<time_t> & VecStat::getStartTimestamp() const{
681 return p_startTimestamp;
682}
683
685
687std::vector<time_t> & VecStat::getStartTimestamp(){
688 return p_startTimestamp;
689}
690
692
694const std::vector<time_t> & VecStat::getEndTimestamp() const{
695 return p_endTimestamp;
696}
697
699
701std::vector<time_t> & VecStat::getEndTimestamp(){
702 return p_endTimestamp;
703}
704
706
708const std::vector<float> & VecStat::getMin() const{
709 return p_min;
710}
711
713
715std::vector<float> & VecStat::getMin(){
716 return p_min;
717}
718
720
722const std::vector<float> & VecStat::getMax() const{
723 return p_max;
724}
725
727
729std::vector<float> & VecStat::getMax(){
730 return p_max;
731}
732
734
736const std::vector<float> & VecStat::getAverage() const{
737 return p_average;
738}
739
741
743std::vector<float> & VecStat::getAverage(){
744 return p_average;
745}
746
748
750const std::vector<float> & VecStat::getRate() const{
751 return p_rate;
752}
753
755
757std::vector<float> & VecStat::getRate(){
758 return p_rate;
759}
760
762
764const std::vector<std::vector<float> > & VecStat::getVecRateQuantile() const{
765 return p_vecRateQuantile;
766}
767
769
771std::vector<std::vector<float> > & VecStat::getVecRateQuantile(){
772 return p_vecRateQuantile;
773}
774
776
778const std::vector<float> & VecStat::getRateEventBelowLowerBound() const{
780}
781
783
788
790
792const std::vector<float> & VecStat::getRateEventAboveUpperBound() const{
794}
795
797
802
804
818
822
824
826template<>
828 return "Stat";
829}
830
832
838bool CheckStream<Swarm::Stat>::check_stream(const std::string & fieldDescription, const Swarm::Stat & data, const Swarm::Stat & reference, std::ostream & out){
839 bool b(true);
840 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- Stat::name", data.getName(), reference.getName(), out);
841 b &= CheckStream<std::map<PString, Swarm::VecStat >>::check_stream(fieldDescription + "\n- Stat::mapStatComputing", data.getMapStatComputing(), reference.getMapStatComputing(), out);
842 b &= CheckStream<std::map<DaemonName, std::map<DataType, Swarm::VecStat > >>::check_stream(fieldDescription + "\n- Stat::mapStatCommunication", data.getMapStatCommunication(), reference.getMapStatCommunication(), out);
843 return b;
844}
845
846
851
854
855}
856
858
860Stat::Stat(const Stat & other){
861 copyStat(other);
862}
863
865
868Stat & Stat::operator = (const Stat & other){
869 copyStat(other);
870 return *this;
871}
872
874
876void Stat::setName(const PString & name){
877 p_name = name;
878}
879
881
883void Stat::setMapStatComputing(const std::map<PString, Swarm::VecStat > & mapStatComputing){
884 p_mapStatComputing = mapStatComputing;
885}
886
888
890void Stat::setMapStatCommunication(const std::map<DaemonName, std::map<DataType, Swarm::VecStat > > & mapStatCommunication){
891 p_mapStatCommunication = mapStatCommunication;
892}
893
895
897const PString & Stat::getName() const{
898 return p_name;
899}
900
902
904PString & Stat::getName(){
905 return p_name;
906}
907
909
911const std::map<PString, Swarm::VecStat > & Stat::getMapStatComputing() const{
912 return p_mapStatComputing;
913}
914
916
918std::map<PString, Swarm::VecStat > & Stat::getMapStatComputing(){
919 return p_mapStatComputing;
920}
921
923
925const std::map<DaemonName, std::map<DataType, Swarm::VecStat > > & Stat::getMapStatCommunication() const{
927}
928
930
932std::map<DaemonName, std::map<DataType, Swarm::VecStat > > & Stat::getMapStatCommunication(){
934}
935
937
944
947 p_name = "";
948}
949
951
953template<>
955 return "StatAccumulator";
956}
957
959
965bool CheckStream<Swarm::StatAccumulator>::check_stream(const std::string & fieldDescription, const Swarm::StatAccumulator & data, const Swarm::StatAccumulator & reference, std::ostream & out){
966 bool b(true);
967 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- StatAccumulator::nbEvent", data.getNbEvent(), reference.getNbEvent(), out);
968 b &= CheckStream<float>::check_stream(fieldDescription + "\n- StatAccumulator::sum", data.getSum(), reference.getSum(), out);
969 b &= CheckStream<float>::check_stream(fieldDescription + "\n- StatAccumulator::min", data.getMin(), reference.getMin(), out);
970 b &= CheckStream<float>::check_stream(fieldDescription + "\n- StatAccumulator::max", data.getMax(), reference.getMax(), out);
971 b &= CheckStream<std::vector<size_t>>::check_stream(fieldDescription + "\n- StatAccumulator::vecHistogram", data.getVecHistogram(), reference.getVecHistogram(), out);
972 b &= CheckStream<float>::check_stream(fieldDescription + "\n- StatAccumulator::histLowerBound", data.getHistLowerBound(), reference.getHistLowerBound(), out);
973 b &= CheckStream<float>::check_stream(fieldDescription + "\n- StatAccumulator::histUpperBound", data.getHistUpperBound(), reference.getHistUpperBound(), out);
974 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- StatAccumulator::nbEventBelowLowerBound", data.getNbEventBelowLowerBound(), reference.getNbEventBelowLowerBound(), out);
975 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- StatAccumulator::nbEventAboveUpperBound", data.getNbEventAboveUpperBound(), reference.getNbEventAboveUpperBound(), out);
976 return b;
977}
978
979
984
989
991
996
998
1002 copyStatAccumulator(other);
1003 return *this;
1004}
1005
1007
1009void StatAccumulator::setNbEvent(size_t nbEvent){
1010 p_nbEvent = nbEvent;
1011}
1012
1014
1017 p_sum = sum;
1018}
1019
1021
1024 p_min = min;
1025}
1026
1028
1031 p_max = max;
1032}
1033
1035
1037void StatAccumulator::setVecHistogram(const std::vector<size_t> & vecHistogram){
1038 p_vecHistogram = vecHistogram;
1039}
1040
1042
1044void StatAccumulator::setHistLowerBound(float histLowerBound){
1045 p_histLowerBound = histLowerBound;
1046}
1047
1049
1051void StatAccumulator::setHistUpperBound(float histUpperBound){
1052 p_histUpperBound = histUpperBound;
1053}
1054
1056
1058void StatAccumulator::setNbEventBelowLowerBound(size_t nbEventBelowLowerBound){
1059 p_nbEventBelowLowerBound = nbEventBelowLowerBound;
1060}
1061
1063
1065void StatAccumulator::setNbEventAboveUpperBound(size_t nbEventAboveUpperBound){
1066 p_nbEventAboveUpperBound = nbEventAboveUpperBound;
1067}
1068
1070
1073 return p_nbEvent;
1074}
1075
1077
1080 return p_nbEvent;
1081}
1082
1084
1087 return p_sum;
1088}
1089
1091
1094 return p_sum;
1095}
1096
1098
1101 return p_min;
1102}
1103
1105
1108 return p_min;
1109}
1110
1112
1115 return p_max;
1116}
1117
1119
1122 return p_max;
1123}
1124
1126
1128const std::vector<size_t> & StatAccumulator::getVecHistogram() const{
1129 return p_vecHistogram;
1130}
1131
1133
1135std::vector<size_t> & StatAccumulator::getVecHistogram(){
1136 return p_vecHistogram;
1137}
1138
1140
1145
1147
1152
1154
1159
1161
1166
1168
1173
1175
1180
1182
1187
1189
1194
1196
1209
1212 p_nbEvent = 0lu;
1213 p_sum = 0.0f;
1214 p_min = 0.0f;
1215 p_max = 0.0f;
1216 p_histLowerBound = 0.0f;
1217 p_histUpperBound = 0.0f;
1220}
1221
1223
1225template<>
1227 return "DaemonStatAccumulator";
1228}
1229
1231
1237bool CheckStream<Swarm::DaemonStatAccumulator>::check_stream(const std::string & fieldDescription, const Swarm::DaemonStatAccumulator & data, const Swarm::DaemonStatAccumulator & reference, std::ostream & out){
1238 bool b(true);
1239 b &= CheckStream<std::map<PString, Swarm::StatAccumulator >>::check_stream(fieldDescription + "\n- DaemonStatAccumulator::mapStatComputing", data.getMapStatComputing(), reference.getMapStatComputing(), out);
1240 b &= CheckStream<std::map<DaemonName, std::map<DataType, Swarm::StatAccumulator > >>::check_stream(fieldDescription + "\n- DaemonStatAccumulator::mapStatCommunication", data.getMapStatCommunication(), reference.getMapStatCommunication(), out);
1241 return b;
1242}
1243
1244
1249
1254
1256
1261
1263
1270
1272
1274void DaemonStatAccumulator::setMapStatComputing(const std::map<PString, Swarm::StatAccumulator > & mapStatComputing){
1275 p_mapStatComputing = mapStatComputing;
1276}
1277
1279
1281void DaemonStatAccumulator::setMapStatCommunication(const std::map<DaemonName, std::map<DataType, Swarm::StatAccumulator > > & mapStatCommunication){
1282 p_mapStatCommunication = mapStatCommunication;
1283}
1284
1286
1288const std::map<PString, Swarm::StatAccumulator > & DaemonStatAccumulator::getMapStatComputing() const{
1289 return p_mapStatComputing;
1290}
1291
1293
1295std::map<PString, Swarm::StatAccumulator > & DaemonStatAccumulator::getMapStatComputing(){
1296 return p_mapStatComputing;
1297}
1298
1300
1302const std::map<DaemonName, std::map<DataType, Swarm::StatAccumulator > > & DaemonStatAccumulator::getMapStatCommunication() const{
1304}
1305
1307
1309std::map<DaemonName, std::map<DataType, Swarm::StatAccumulator > > & DaemonStatAccumulator::getMapStatCommunication(){
1311}
1312
1314
1320
1324
1326
1328template<>
1330 return "DaemonConfig";
1331}
1332
1334
1340bool CheckStream<Swarm::DaemonConfig>::check_stream(const std::string & fieldDescription, const Swarm::DaemonConfig & data, const Swarm::DaemonConfig & reference, std::ostream & out){
1341 bool b(true);
1342 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- DaemonConfig::hostName", data.getHostName(), reference.getHostName(), out);
1343 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- DaemonConfig::receivingPort", data.getReceivingPort(), reference.getReceivingPort(), out);
1344 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- DaemonConfig::name", data.getName(), reference.getName(), out);
1345 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- DaemonConfig::description", data.getDescription(), reference.getDescription(), out);
1346 b &= CheckStream<std::map<PString, time_t>>::check_stream(fieldDescription + "\n- DaemonConfig::mapTimeout", data.getMapTimeout(), reference.getMapTimeout(), out);
1347 b &= CheckStream<size_t>::check_stream(fieldDescription + "\n- DaemonConfig::statNbBin", data.getStatNbBin(), reference.getStatNbBin(), out);
1348 b &= CheckStream<float>::check_stream(fieldDescription + "\n- DaemonConfig::statHistLowerBound", data.getStatHistLowerBound(), reference.getStatHistLowerBound(), out);
1349 b &= CheckStream<float>::check_stream(fieldDescription + "\n- DaemonConfig::statHistUpperBound", data.getStatHistUpperBound(), reference.getStatHistUpperBound(), out);
1350 b &= CheckStream<time_t>::check_stream(fieldDescription + "\n- DaemonConfig::statTimerPeriodMs", data.getStatTimerPeriodMs(), reference.getStatTimerPeriodMs(), out);
1351 b &= CheckStream<Swarm::DaemonStatAccumulator>::check_stream(fieldDescription + "\n- DaemonConfig::daemonStatAccumulator", data.getDaemonStatAccumulator(), reference.getDaemonStatAccumulator(), out);
1352 b &= CheckStream<PString>::check_stream(fieldDescription + "\n- DaemonConfig::statDaemonName", data.getStatDaemonName(), reference.getStatDaemonName(), out);
1353 return b;
1354}
1355
1356
1361
1366
1368
1373
1375
1379 copyDaemonConfig(other);
1380 return *this;
1381}
1382
1384
1386void DaemonConfig::setHostName(const PString & hostName){
1387 p_hostName = hostName;
1388}
1389
1391
1393void DaemonConfig::setReceivingPort(size_t receivingPort){
1394 p_receivingPort = receivingPort;
1395}
1396
1398
1400void DaemonConfig::setName(const PString & name){
1401 p_name = name;
1402}
1403
1405
1407void DaemonConfig::setDescription(const PString & description){
1408 p_description = description;
1409}
1410
1412
1414void DaemonConfig::setMapTimeout(const std::map<PString, time_t> & mapTimeout){
1415 p_mapTimeout = mapTimeout;
1416}
1417
1419
1421void DaemonConfig::setStatNbBin(size_t statNbBin){
1422 p_statNbBin = statNbBin;
1423}
1424
1426
1428void DaemonConfig::setStatHistLowerBound(float statHistLowerBound){
1429 p_statHistLowerBound = statHistLowerBound;
1430}
1431
1433
1435void DaemonConfig::setStatHistUpperBound(float statHistUpperBound){
1436 p_statHistUpperBound = statHistUpperBound;
1437}
1438
1440
1442void DaemonConfig::setStatTimerPeriodMs(const time_t & statTimerPeriodMs){
1443 p_statTimerPeriodMs = statTimerPeriodMs;
1444}
1445
1447
1450 p_daemonStatAccumulator = daemonStatAccumulator;
1451}
1452
1454
1456void DaemonConfig::setStatDaemonName(const PString & statDaemonName){
1457 p_statDaemonName = statDaemonName;
1458}
1459
1461
1463const PString & DaemonConfig::getHostName() const{
1464 return p_hostName;
1465}
1466
1468
1471 return p_hostName;
1472}
1473
1475
1478 return p_receivingPort;
1479}
1480
1482
1487
1489
1491const PString & DaemonConfig::getName() const{
1492 return p_name;
1493}
1494
1496
1499 return p_name;
1500}
1501
1503
1505const PString & DaemonConfig::getDescription() const{
1506 return p_description;
1507}
1508
1510
1513 return p_description;
1514}
1515
1517
1519const std::map<PString, time_t> & DaemonConfig::getMapTimeout() const{
1520 return p_mapTimeout;
1521}
1522
1524
1526std::map<PString, time_t> & DaemonConfig::getMapTimeout(){
1527 return p_mapTimeout;
1528}
1529
1531
1534 return p_statNbBin;
1535}
1536
1538
1541 return p_statNbBin;
1542}
1543
1545
1550
1552
1557
1559
1564
1566
1571
1573
1576 return p_statTimerPeriodMs;
1577}
1578
1580
1585
1587
1592
1594
1599
1601
1603const PString & DaemonConfig::getStatDaemonName() const{
1604 return p_statDaemonName;
1605}
1606
1608
1613
1615
1630
1633 p_hostName = "";
1634 p_receivingPort = 0lu;
1635 p_name = "";
1636 p_description = "";
1637 p_statNbBin = 0lu;
1638 p_statHistLowerBound = 0.0f;
1639 p_statHistUpperBound = 0.0f;
1640 p_statDaemonName = "";
1641}
1642
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< Stat >()
Get the name of the class Stat for PhoenixTypeStream.
Describe a Daemon of the Swarm.
const PString & getName() const
Gets the name of the DaemonConfig.
DaemonConfig()
Constructor of class DaemonConfig.
float p_statHistLowerBound
Lower bound for the histogram of the communication statistics.
DaemonConfig & operator=(const DaemonConfig &other)
Operator = of class DaemonConfig.
size_t getStatNbBin() const
Gets the statNbBin of the DaemonConfig.
const Swarm::DaemonStatAccumulator & getDaemonStatAccumulator() const
Gets the daemonStatAccumulator of the DaemonConfig.
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.
time_t p_statTimerPeriodMs
Period (in ms) to send statistics to the stat daemon.
const PString & getStatDaemonName() const
Gets the statDaemonName of the DaemonConfig.
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.
float p_statHistUpperBound
Upper bound for the histogram of the communication statistics.
const std::map< PString, time_t > & getMapTimeout() const
Gets the mapTimeout of the DaemonConfig.
virtual ~DaemonConfig()
Destructor of class DaemonConfig.
void setStatHistUpperBound(float statHistUpperBound)
Sets the statHistUpperBound of the DaemonConfig.
float getStatHistLowerBound() const
Gets the statHistLowerBound of the DaemonConfig.
void setReceivingPort(size_t receivingPort)
Sets the receivingPort of the DaemonConfig.
Swarm::DaemonStatAccumulator p_daemonStatAccumulator
Accumulator used to create statistics of the current Daemon.
void setName(const PString &name)
Sets the name of the DaemonConfig.
void setDaemonStatAccumulator(const Swarm::DaemonStatAccumulator &daemonStatAccumulator)
Sets the daemonStatAccumulator of the DaemonConfig.
std::map< PString, time_t > p_mapTimeout
Map of the timeout for each daemon in the configuration file.
PString p_statDaemonName
Name of the Daemon which is used to gather statistics of the swarm (empty if no stat daemon is used)
size_t p_statNbBin
Number of bin for the histogram of the communication statistics.
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.
size_t p_receivingPort
Port which is used by the Daemon to receive messages.
void setHostName(const PString &hostName)
Sets the hostName of the DaemonConfig.
PString p_name
Name of the Daemon.
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.
void setMapStatCommunication(const std::map< DaemonName, std::map< DataType, Swarm::StatAccumulator > > &mapStatCommunication)
Sets the mapStatCommunication of the DaemonStatAccumulator.
DaemonStatAccumulator & operator=(const DaemonStatAccumulator &other)
Operator = of class DaemonStatAccumulator.
void setMapStatComputing(const std::map< PString, Swarm::StatAccumulator > &mapStatComputing)
Sets the mapStatComputing of the DaemonStatAccumulator.
DaemonStatAccumulator()
Constructor of class DaemonStatAccumulator.
std::map< PString, Swarm::StatAccumulator > p_mapStatComputing
Map of the computing statistics (key: stat name, value vector of stat)
void copyDaemonStatAccumulator(const DaemonStatAccumulator &other)
Copy Function of class DaemonStatAccumulator.
std::map< DaemonName, std::map< DataType, Swarm::StatAccumulator > > p_mapStatCommunication
Map of the communication statistics (key: destination daemon name, value: {key: data type,...
const std::map< PString, Swarm::StatAccumulator > & getMapStatComputing() const
Gets the mapStatComputing of the DaemonStatAccumulator.
virtual ~DaemonStatAccumulator()
Destructor of class DaemonStatAccumulator.
const std::map< DaemonName, std::map< DataType, Swarm::StatAccumulator > > & getMapStatCommunication() const
Gets the mapStatCommunication of the DaemonStatAccumulator.
Basic Data exchanged in the swarm.
PString p_type
Type of the Data.
PString p_name
Name of the Data.
DataStreamMsg p_value
Value of the Data.
void initialisationData()
Initialisation Function of class Data.
void setValue(const DataStreamMsg &value)
Sets the value of the Data.
const PString & getDescription() const
Gets the description of the Data.
void setType(const PString &type)
Sets the type of the Data.
PString p_description
Description 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.
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.
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.
void setVecParam(const std::vector< Swarm::Data > &vecParam)
Sets the vecParam of the Function.
const PString & getName() const
Gets the name of the Function.
virtual ~Function()
Destructor of class Function.
void copyFunction(const Function &other)
Copy Function of class Function.
std::vector< Swarm::Data > p_vecParam
Vector of parameters of the Function.
void setReturnValue(const Swarm::Data &returnValue)
Sets the returnValue of the Function.
void setName(const PString &name)
Sets the name of the Function.
const std::vector< Swarm::Data > & getVecParam() const
Gets the vecParam of the Function.
PString p_description
Description of the Function.
PString p_name
Name of the Function.
Function & operator=(const Function &other)
Operator = of class 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.
const Swarm::Data & getReturnValue() const
Gets the returnValue of the Function.
Swarm::Data p_returnValue
Return value of the Function.
Message exchanged by Daemons.
bool p_isConfirmationNeeded
True if the MESSAGE_CONFIRMATION is needed.
const PString & getSender() const
Gets the sender of the Message.
void setData(const Swarm::Data &data)
Sets the data of the Message.
void setVecRecver(const std::vector< PString > &vecRecver)
Sets the vecRecver of the Message.
virtual ~Message()
Destructor of class 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.
size_t p_id
Id of the message (will be usefull to trigger method when a transmission is confirmed)
void setSendTime(const time_t &sendTime)
Sets the sendTime of the Message.
std::vector< PString > p_vecRecver
Addresses of Daemons which receive the message.
const Swarm::Data & getData() const
Gets the data of the Message.
void initialisationMessage()
Initialisation Function of class Message.
time_t p_sendTime
Time when the message was sent.
void setSender(const PString &sender)
Sets the sender of the Message.
size_t getId() const
Gets the id of the Message.
bool getIsConfirmationNeeded() const
Gets the isConfirmationNeeded of the Message.
Swarm::Data p_data
Data in 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.
MessageType::MessageType p_type
Type of the message.
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.
float p_histLowerBound
Minimum value in the histogram.
float p_histUpperBound
Maximum value in the histogram.
void setVecHistogram(const std::vector< size_t > &vecHistogram)
Sets the vecHistogram of the StatAccumulator.
void initialisationStatAccumulator()
Initialisation Function of class StatAccumulator.
float p_sum
Sum of all values.
size_t p_nbEvent
Number of events used to make this statistic.
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.
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_min
Minimum 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.
void setHistLowerBound(float histLowerBound)
Sets the histLowerBound of the StatAccumulator.
virtual ~StatAccumulator()
Destructor of class StatAccumulator.
std::vector< size_t > p_vecHistogram
Histogram to acccumulate event counts per quantile.
void setNbEventBelowLowerBound(size_t nbEventBelowLowerBound)
Sets the nbEventBelowLowerBound of the StatAccumulator.
void setSum(float sum)
Sets the sum of the StatAccumulator.
float p_max
Maximum value of the stat.
size_t p_nbEventBelowLowerBound
Number of events below the lower bound.
size_t getNbEventBelowLowerBound() const
Gets the nbEventBelowLowerBound of the StatAccumulator.
const std::vector< size_t > & getVecHistogram() const
Gets the vecHistogram of the StatAccumulator.
size_t p_nbEventAboveUpperBound
Number of events above the upper boundary.
void setNbEvent(size_t nbEvent)
Sets the nbEvent of the StatAccumulator.
Statistics of a Daemon.
virtual ~Stat()
Destructor of class Stat.
std::map< DaemonName, std::map< DataType, Swarm::VecStat > > p_mapStatCommunication
Map of the communication statistics (key: destination daemon name, value: {key: data type,...
std::map< PString, Swarm::VecStat > p_mapStatComputing
Map of the computing statistics (key: stat name, value vector of stat)
void setName(const PString &name)
Sets the name of the Stat.
void initialisationStat()
Initialisation Function of class Stat.
void copyStat(const Stat &other)
Copy Function of class Stat.
const std::map< DaemonName, std::map< DataType, Swarm::VecStat > > & getMapStatCommunication() const
Gets the mapStatCommunication of the Stat.
Stat & operator=(const Stat &other)
Operator = of class Stat.
void setMapStatCommunication(const std::map< DaemonName, std::map< DataType, Swarm::VecStat > > &mapStatCommunication)
Sets the mapStatCommunication of the Stat.
PString p_name
Name of the Daemon where the stats come from.
void setMapStatComputing(const std::map< PString, Swarm::VecStat > &mapStatComputing)
Sets the mapStatComputing of the Stat.
Stat()
Constructor of class Stat.
const PString & getName() const
Gets the name of the Stat.
const std::map< PString, Swarm::VecStat > & getMapStatComputing() const
Gets the mapStatComputing of the Stat.
General statistics in the swarm.
std::vector< float > p_min
Minimum value of the stat.
void setVecRateQuantile(const std::vector< std::vector< float > > &vecRateQuantile)
Sets the vecRateQuantile of the VecStat.
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.
std::vector< float > p_average
Mean of the stat.
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.
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.
virtual ~VecStat()
Destructor of class VecStat.
std::vector< float > p_rateEventAboveUpperBound
Number of events above the upper boundary per second.
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 > & getAverage() const
Gets the average of the VecStat.
const std::vector< float > & getRateEventBelowLowerBound() const
Gets the rateEventBelowLowerBound of the VecStat.
const std::vector< float > & getRateEventAboveUpperBound() const
Gets the rateEventAboveUpperBound 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_rateEventBelowLowerBound
Number of events below the lower boundary per second.
std::vector< std::vector< float > > p_vecRateQuantile
Vector of binned event rate per quantile (quartile decile, etc)
std::vector< float > p_max
Maximum value of the stat.
std::vector< size_t > p_nbEvent
Number of events used to make this statistic.
std::vector< float > p_rate
Number of events per second.
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 Swarm::DaemonConfig &data, const Swarm::DaemonConfig &reference, std::ostream &out)
Check Stream for a DaemonConfig.
static bool check_stream(const std::string &fieldDescription, const Swarm::DaemonStatAccumulator &data, const Swarm::DaemonStatAccumulator &reference, std::ostream &out)
Check Stream for a DaemonStatAccumulator.
static bool check_stream(const std::string &fieldDescription, const Swarm::Data &data, const Swarm::Data &reference, std::ostream &out)
Check Stream for a Data.
static bool check_stream(const std::string &fieldDescription, const Swarm::Function &data, const Swarm::Function &reference, std::ostream &out)
Check Stream for a Function.
static bool check_stream(const std::string &fieldDescription, const Swarm::Message &data, const Swarm::Message &reference, std::ostream &out)
Check Stream for a Message.
static bool check_stream(const std::string &fieldDescription, const Swarm::StatAccumulator &data, const Swarm::StatAccumulator &reference, std::ostream &out)
Check Stream for a StatAccumulator.
static bool check_stream(const std::string &fieldDescription, const Swarm::Stat &data, const Swarm::Stat &reference, std::ostream &out)
Check Stream for a Stat.
static bool check_stream(const std::string &fieldDescription, const Swarm::VecStat &data, const Swarm::VecStat &reference, std::ostream &out)
Check Stream for a VecStat.
PString DaemonName