PhoenixSwarm  3.5.0
Library to ease communication between daemons
Loading...
Searching...
No Matches
Representation.h
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#ifndef __REPRESENTATION_H__
8#define __REPRESENTATION_H__
9
10#include <string>
11#include "phoenix_data_stream.h"
12#include "phoenix_path_stream.h"
13#include "PString.h"
14#include "MessageType.h"
15
16#include "phoenix_type_stream.h"
17#include "phoenix_data_stream.h"
18#include "phoenix_check_stream.h"
19
21class Data{
22 public:
23 Data();
24 virtual ~Data();
25 Data(const Data & other);
26 Data & operator = (const Data & other);
27 void setName(const PString & name);
28 void setDescription(const PString & description);
29 void setType(const PString & type);
30 void setValue(const DataStreamMsg & value);
31 const PString & getName() const;
32 PString & getName();
33 const PString & getDescription() const;
34 PString & getDescription();
35 const PString & getType() const;
36 PString & getType();
37 const DataStreamMsg & getValue() const;
38 DataStreamMsg & getValue();
39
41
44 template<typename Stream, DataStreamMode::DataStreamMode Mode>
45 bool readWriteStream(Stream & ds){
46 bool b(true);
47 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_name);
48 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_description);
49 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_type);
50 b &= DataStream<Stream, Mode, DataStreamMsg >::data_stream(ds, p_value);
51 return b;
52 }
53
54 protected:
55 void copyData(const Data & other);
56 private:
57 void initialisationData();
59 PString p_name;
63 PString p_type;
65 DataStreamMsg p_value;
66};
67
68template<>
69std::string phoenix_getTypeName<Data>();
70
72template<typename Stream, DataStreamMode::DataStreamMode Mode>
73struct DataStream<Stream, Mode, Data>{
75
79 static bool data_stream(Stream & ds, Data & data){
80 return data.readWriteStream<Stream, Mode>(ds);
81 }
82};
83
85template<>
86struct CheckStream<Data>{
87 static bool check_stream(const std::string & fieldDescription, const Data & data, const Data & reference, std::ostream & out);
88};
89
90
91
92
95 public:
96 Function();
97 virtual ~Function();
98 Function(const Function & other);
99 Function & operator = (const Function & other);
100 void setName(const PString & name);
101 void setDescription(const PString & description);
102 void setVecParam(const std::vector<Data> & vecParam);
103 void setReturnValue(const Data & returnValue);
104 const PString & getName() const;
105 PString & getName();
106 const PString & getDescription() const;
107 PString & getDescription();
108 const std::vector<Data> & getVecParam() const;
109 std::vector<Data> & getVecParam();
110 const Data & getReturnValue() const;
112
114
117 template<typename Stream, DataStreamMode::DataStreamMode Mode>
118 bool readWriteStream(Stream & ds){
119 bool b(true);
120 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_name);
121 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_description);
122 b &= DataStream<Stream, Mode, std::vector<Data> >::data_stream(ds, p_vecParam);
124 return b;
125 }
126
127 protected:
128 void copyFunction(const Function & other);
129 private:
132 PString p_name;
136 std::vector<Data> p_vecParam;
139};
140
141template<>
143
145template<typename Stream, DataStreamMode::DataStreamMode Mode>
146struct DataStream<Stream, Mode, Function>{
148
152 static bool data_stream(Stream & ds, Function & data){
153 return data.readWriteStream<Stream, Mode>(ds);
154 }
155};
156
158template<>
159struct CheckStream<Function>{
160 static bool check_stream(const std::string & fieldDescription, const Function & data, const Function & reference, std::ostream & out);
161};
162
163
164
165
168 public:
169 Message();
170 virtual ~Message();
171 Message(const Message & other);
172 Message & operator = (const Message & other);
173 void setSendTime(const time_t & sendTime);
174 void setId(size_t id);
175 void setIsConfirmationNeeded(bool isConfirmationNeeded);
176 void setSender(const PString & sender);
177 void setVecRecver(const std::vector<PString> & vecRecver);
178 void setType(const MessageType::MessageType & type);
179 void setData(const Data & data);
180 const time_t & getSendTime() const;
181 time_t & getSendTime();
182 size_t getId() const;
183 size_t & getId();
184 bool getIsConfirmationNeeded() const;
186 const PString & getSender() const;
187 PString & getSender();
188 const std::vector<PString> & getVecRecver() const;
189 std::vector<PString> & getVecRecver();
190 const MessageType::MessageType & getType() const;
192 const Data & getData() const;
193 Data & getData();
194
196
199 template<typename Stream, DataStreamMode::DataStreamMode Mode>
200 bool readWriteStream(Stream & ds){
201 bool b(true);
202 b &= DataStream<Stream, Mode, time_t >::data_stream(ds, p_sendTime);
203 b &= DataStream<Stream, Mode, size_t >::data_stream(ds, p_id);
204 b &= DataStream<Stream, Mode, bool >::data_stream(ds, p_isConfirmationNeeded);
205 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_sender);
206 b &= DataStream<Stream, Mode, std::vector<PString> >::data_stream(ds, p_vecRecver);
207 b &= DataStream<Stream, Mode, MessageType::MessageType >::data_stream(ds, p_type);
209 return b;
210 }
211
212 protected:
213 void copyMessage(const Message & other);
214 private:
219 size_t p_id;
223 PString p_sender;
225 std::vector<PString> p_vecRecver;
230};
231
232template<>
233std::string phoenix_getTypeName<Message>();
234
236template<typename Stream, DataStreamMode::DataStreamMode Mode>
237struct DataStream<Stream, Mode, Message>{
239
243 static bool data_stream(Stream & ds, Message & data){
244 return data.readWriteStream<Stream, Mode>(ds);
245 }
246};
247
249template<>
250struct CheckStream<Message>{
251 static bool check_stream(const std::string & fieldDescription, const Message & data, const Message & reference, std::ostream & out);
252};
253
254
255
256
259 public:
260 VecStat();
261 virtual ~VecStat();
262 VecStat(const VecStat & other);
263 VecStat & operator = (const VecStat & other);
264 void setNbEvent(const std::vector<size_t> & nbEvent);
265 void setStartTimestamp(const std::vector<time_t> & startTimestamp);
266 void setEndTimestamp(const std::vector<time_t> & endTimestamp);
267 void setMin(const std::vector<float> & min);
268 void setMax(const std::vector<float> & max);
269 void setAverage(const std::vector<float> & average);
270 void setRate(const std::vector<float> & rate);
271 void setVecRateQuantile(const std::vector<std::vector<float> > & vecRateQuantile);
272 void setRateEventBelowLowerBound(const std::vector<float> & rateEventBelowLowerBound);
273 void setRateEventAboveUpperBound(const std::vector<float> & rateEventAboveUpperBound);
274 const std::vector<size_t> & getNbEvent() const;
275 std::vector<size_t> & getNbEvent();
276 const std::vector<time_t> & getStartTimestamp() const;
277 std::vector<time_t> & getStartTimestamp();
278 const std::vector<time_t> & getEndTimestamp() const;
279 std::vector<time_t> & getEndTimestamp();
280 const std::vector<float> & getMin() const;
281 std::vector<float> & getMin();
282 const std::vector<float> & getMax() const;
283 std::vector<float> & getMax();
284 const std::vector<float> & getAverage() const;
285 std::vector<float> & getAverage();
286 const std::vector<float> & getRate() const;
287 std::vector<float> & getRate();
288 const std::vector<std::vector<float> > & getVecRateQuantile() const;
289 std::vector<std::vector<float> > & getVecRateQuantile();
290 const std::vector<float> & getRateEventBelowLowerBound() const;
291 std::vector<float> & getRateEventBelowLowerBound();
292 const std::vector<float> & getRateEventAboveUpperBound() const;
293 std::vector<float> & getRateEventAboveUpperBound();
294
296
299 template<typename Stream, DataStreamMode::DataStreamMode Mode>
300 bool readWriteStream(Stream & ds){
301 bool b(true);
302 b &= DataStream<Stream, Mode, std::vector<size_t> >::data_stream(ds, p_nbEvent);
303 b &= DataStream<Stream, Mode, std::vector<time_t> >::data_stream(ds, p_startTimestamp);
304 b &= DataStream<Stream, Mode, std::vector<time_t> >::data_stream(ds, p_endTimestamp);
305 b &= DataStream<Stream, Mode, std::vector<float> >::data_stream(ds, p_min);
306 b &= DataStream<Stream, Mode, std::vector<float> >::data_stream(ds, p_max);
307 b &= DataStream<Stream, Mode, std::vector<float> >::data_stream(ds, p_average);
308 b &= DataStream<Stream, Mode, std::vector<float> >::data_stream(ds, p_rate);
309 b &= DataStream<Stream, Mode, std::vector<std::vector<float> > >::data_stream(ds, p_vecRateQuantile);
310 b &= DataStream<Stream, Mode, std::vector<float> >::data_stream(ds, p_rateEventBelowLowerBound);
311 b &= DataStream<Stream, Mode, std::vector<float> >::data_stream(ds, p_rateEventAboveUpperBound);
312 return b;
313 }
314
315 protected:
316 void copyVecStat(const VecStat & other);
317 private:
320 std::vector<size_t> p_nbEvent;
322 std::vector<time_t> p_startTimestamp;
324 std::vector<time_t> p_endTimestamp;
326 std::vector<float> p_min;
328 std::vector<float> p_max;
330 std::vector<float> p_average;
332 std::vector<float> p_rate;
334 std::vector<std::vector<float> > p_vecRateQuantile;
336 std::vector<float> p_rateEventBelowLowerBound;
338 std::vector<float> p_rateEventAboveUpperBound;
339};
340
341template<>
342std::string phoenix_getTypeName<VecStat>();
343
345template<typename Stream, DataStreamMode::DataStreamMode Mode>
346struct DataStream<Stream, Mode, VecStat>{
348
352 static bool data_stream(Stream & ds, VecStat & data){
353 return data.readWriteStream<Stream, Mode>(ds);
354 }
355};
356
358template<>
359struct CheckStream<VecStat>{
360 static bool check_stream(const std::string & fieldDescription, const VecStat & data, const VecStat & reference, std::ostream & out);
361};
362
363
364
365
368 public:
369 DaemonStat();
370 virtual ~DaemonStat();
371 DaemonStat(const DaemonStat & other);
372 DaemonStat & operator = (const DaemonStat & other);
373 void setName(const PString & name);
374 void setMapStatComputing(const std::map<PString, VecStat > & mapStatComputing);
375 void setMapStatCommunication(const std::map<PString, std::map<PString, VecStat > > & mapStatCommunication);
376 const PString & getName() const;
377 PString & getName();
378 const std::map<PString, VecStat > & getMapStatComputing() const;
379 std::map<PString, VecStat > & getMapStatComputing();
380 const std::map<PString, std::map<PString, VecStat > > & getMapStatCommunication() const;
381 std::map<PString, std::map<PString, VecStat > > & getMapStatCommunication();
382
384
387 template<typename Stream, DataStreamMode::DataStreamMode Mode>
388 bool readWriteStream(Stream & ds){
389 bool b(true);
390 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_name);
391 b &= DataStream<Stream, Mode, std::map<PString, VecStat > >::data_stream(ds, p_mapStatComputing);
392 b &= DataStream<Stream, Mode, std::map<PString, std::map<PString, VecStat > > >::data_stream(ds, p_mapStatCommunication);
393 return b;
394 }
395
396 protected:
397 void copyDaemonStat(const DaemonStat & other);
398 private:
401 PString p_name;
403 std::map<PString, VecStat > p_mapStatComputing;
405 std::map<PString, std::map<PString, VecStat > > p_mapStatCommunication;
406};
407
408template<>
410
412template<typename Stream, DataStreamMode::DataStreamMode Mode>
413struct DataStream<Stream, Mode, DaemonStat>{
415
419 static bool data_stream(Stream & ds, DaemonStat & data){
420 return data.readWriteStream<Stream, Mode>(ds);
421 }
422};
423
425template<>
426struct CheckStream<DaemonStat>{
427 static bool check_stream(const std::string & fieldDescription, const DaemonStat & data, const DaemonStat & reference, std::ostream & out);
428};
429
430
431
432
435 public:
437 virtual ~StatAccumulator();
438 StatAccumulator(const StatAccumulator & other);
440 void setNbEvent(size_t nbEvent);
441 void setSum(float sum);
442 void setMin(float min);
443 void setMax(float max);
444 void setVecHistogram(const std::vector<size_t> & vecHistogram);
445 void setHistLowerBound(float histLowerBound);
446 void setHistUpperBound(float histUpperBound);
447 void setNbEventBelowLowerBound(size_t nbEventBelowLowerBound);
448 void setNbEventAboveUpperBound(size_t nbEventAboveUpperBound);
449 size_t getNbEvent() const;
450 size_t & getNbEvent();
451 float getSum() const;
452 float & getSum();
453 float getMin() const;
454 float & getMin();
455 float getMax() const;
456 float & getMax();
457 const std::vector<size_t> & getVecHistogram() const;
458 std::vector<size_t> & getVecHistogram();
459 float getHistLowerBound() const;
460 float & getHistLowerBound();
461 float getHistUpperBound() const;
462 float & getHistUpperBound();
463 size_t getNbEventBelowLowerBound() const;
464 size_t & getNbEventBelowLowerBound();
465 size_t getNbEventAboveUpperBound() const;
466 size_t & getNbEventAboveUpperBound();
467
469
472 template<typename Stream, DataStreamMode::DataStreamMode Mode>
473 bool readWriteStream(Stream & ds){
474 bool b(true);
475 b &= DataStream<Stream, Mode, size_t >::data_stream(ds, p_nbEvent);
476 b &= DataStream<Stream, Mode, float >::data_stream(ds, p_sum);
477 b &= DataStream<Stream, Mode, float >::data_stream(ds, p_min);
478 b &= DataStream<Stream, Mode, float >::data_stream(ds, p_max);
479 b &= DataStream<Stream, Mode, std::vector<size_t> >::data_stream(ds, p_vecHistogram);
480 b &= DataStream<Stream, Mode, float >::data_stream(ds, p_histLowerBound);
481 b &= DataStream<Stream, Mode, float >::data_stream(ds, p_histUpperBound);
482 b &= DataStream<Stream, Mode, size_t >::data_stream(ds, p_nbEventBelowLowerBound);
483 b &= DataStream<Stream, Mode, size_t >::data_stream(ds, p_nbEventAboveUpperBound);
484 return b;
485 }
486
487 protected:
488 void copyStatAccumulator(const StatAccumulator & other);
489 private:
492 size_t p_nbEvent;
494 float p_sum;
496 float p_min;
498 float p_max;
500 std::vector<size_t> p_vecHistogram;
509};
510
511template<>
513
515template<typename Stream, DataStreamMode::DataStreamMode Mode>
516struct DataStream<Stream, Mode, StatAccumulator>{
518
522 static bool data_stream(Stream & ds, StatAccumulator & data){
523 return data.readWriteStream<Stream, Mode>(ds);
524 }
525};
526
528template<>
529struct CheckStream<StatAccumulator>{
530 static bool check_stream(const std::string & fieldDescription, const StatAccumulator & data, const StatAccumulator & reference, std::ostream & out);
531};
532
533
534
535
538 public:
540 virtual ~DaemonStatAccumulator();
543 void setMapStatComputing(const std::map<PString, StatAccumulator > & mapStatComputing);
544 void setMapStatCommunication(const std::map<PString, std::map<PString, StatAccumulator > > & mapStatCommunication);
545 const std::map<PString, StatAccumulator > & getMapStatComputing() const;
546 std::map<PString, StatAccumulator > & getMapStatComputing();
547 const std::map<PString, std::map<PString, StatAccumulator > > & getMapStatCommunication() const;
548 std::map<PString, std::map<PString, StatAccumulator > > & getMapStatCommunication();
549
551
554 template<typename Stream, DataStreamMode::DataStreamMode Mode>
555 bool readWriteStream(Stream & ds){
556 bool b(true);
557 b &= DataStream<Stream, Mode, std::map<PString, StatAccumulator > >::data_stream(ds, p_mapStatComputing);
558 b &= DataStream<Stream, Mode, std::map<PString, std::map<PString, StatAccumulator > > >::data_stream(ds, p_mapStatCommunication);
559 return b;
560 }
561
562 protected:
564 private:
567 std::map<PString, StatAccumulator > p_mapStatComputing;
569 std::map<PString, std::map<PString, StatAccumulator > > p_mapStatCommunication;
570};
571
572template<>
574
576template<typename Stream, DataStreamMode::DataStreamMode Mode>
577struct DataStream<Stream, Mode, DaemonStatAccumulator>{
579
583 static bool data_stream(Stream & ds, DaemonStatAccumulator & data){
584 return data.readWriteStream<Stream, Mode>(ds);
585 }
586};
587
589template<>
590struct CheckStream<DaemonStatAccumulator>{
591 static bool check_stream(const std::string & fieldDescription, const DaemonStatAccumulator & data, const DaemonStatAccumulator & reference, std::ostream & out);
592};
593
594
595
596
599 public:
600 DaemonConfig();
601 virtual ~DaemonConfig();
602 DaemonConfig(const DaemonConfig & other);
603 DaemonConfig & operator = (const DaemonConfig & other);
604 void setHostName(const PString & hostName);
605 void setReceivingPort(size_t receivingPort);
606 void setName(const PString & name);
607 void setDescription(const PString & description);
608 void setMapTimeout(const std::map<PString, time_t> & mapTimeout);
609 void setStatNbBin(size_t statNbBin);
610 void setStatHistLowerBound(float statHistLowerBound);
611 void setStatHistUpperBound(float statHistUpperBound);
612 void setStatTimerPeriodMs(const time_t & statTimerPeriodMs);
613 void setDaemonStatAccumulator(const DaemonStatAccumulator & daemonStatAccumulator);
614 void setStatDaemonName(const PString & statDaemonName);
615 const PString & getHostName() const;
616 PString & getHostName();
617 size_t getReceivingPort() const;
618 size_t & getReceivingPort();
619 const PString & getName() const;
620 PString & getName();
621 const PString & getDescription() const;
622 PString & getDescription();
623 const std::map<PString, time_t> & getMapTimeout() const;
624 std::map<PString, time_t> & getMapTimeout();
625 size_t getStatNbBin() const;
626 size_t & getStatNbBin();
627 float getStatHistLowerBound() const;
628 float & getStatHistLowerBound();
629 float getStatHistUpperBound() const;
630 float & getStatHistUpperBound();
631 const time_t & getStatTimerPeriodMs() const;
632 time_t & getStatTimerPeriodMs();
635 const PString & getStatDaemonName() const;
636 PString & getStatDaemonName();
637
639
642 template<typename Stream, DataStreamMode::DataStreamMode Mode>
643 bool readWriteStream(Stream & ds){
644 bool b(true);
645 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_hostName);
646 b &= DataStream<Stream, Mode, size_t >::data_stream(ds, p_receivingPort);
647 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_name);
648 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_description);
649 b &= DataStream<Stream, Mode, std::map<PString, time_t> >::data_stream(ds, p_mapTimeout);
650 b &= DataStream<Stream, Mode, size_t >::data_stream(ds, p_statNbBin);
651 b &= DataStream<Stream, Mode, float >::data_stream(ds, p_statHistLowerBound);
652 b &= DataStream<Stream, Mode, float >::data_stream(ds, p_statHistUpperBound);
653 b &= DataStream<Stream, Mode, time_t >::data_stream(ds, p_statTimerPeriodMs);
655 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_statDaemonName);
656 return b;
657 }
658
659 protected:
660 void copyDaemonConfig(const DaemonConfig & other);
661 private:
664 PString p_hostName;
668 PString p_name;
672 std::map<PString, time_t> p_mapTimeout;
685};
686
687template<>
689
691template<typename Stream, DataStreamMode::DataStreamMode Mode>
692struct DataStream<Stream, Mode, DaemonConfig>{
694
698 static bool data_stream(Stream & ds, DaemonConfig & data){
699 return data.readWriteStream<Stream, Mode>(ds);
700 }
701};
702
704template<>
705struct CheckStream<DaemonConfig>{
706 static bool check_stream(const std::string & fieldDescription, const DaemonConfig & data, const DaemonConfig & reference, std::ostream & out);
707};
708
709
710
711
712
713
714#endif
715
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.
bool readWriteStream(Stream &ds)
Load the current DaemonConfig with a stream.
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.
bool readWriteStream(Stream &ds)
Load the current DaemonStatAccumulator with a stream.
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.
bool readWriteStream(Stream &ds)
Load the current DaemonStat with a stream.
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.
bool readWriteStream(Stream &ds)
Load the current Data with a stream.
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.
bool readWriteStream(Stream &ds)
Load the current Function with a stream.
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.
bool readWriteStream(Stream &ds)
Load the current Message with a stream.
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.
bool readWriteStream(Stream &ds)
Load the current StatAccumulator with a stream.
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.
bool readWriteStream(Stream &ds)
Load the current VecStat with a stream.
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.
static bool data_stream(Stream &ds, DaemonConfig &data)
Generic function to load/save/serialise/deserialise DaemonConfig.
static bool data_stream(Stream &ds, DaemonStatAccumulator &data)
Generic function to load/save/serialise/deserialise DaemonStatAccumulator.
static bool data_stream(Stream &ds, DaemonStat &data)
Generic function to load/save/serialise/deserialise DaemonStat.
static bool data_stream(Stream &ds, Data &data)
Generic function to load/save/serialise/deserialise Data.
static bool data_stream(Stream &ds, Function &data)
Generic function to load/save/serialise/deserialise Function.
static bool data_stream(Stream &ds, Message &data)
Generic function to load/save/serialise/deserialise Message.
static bool data_stream(Stream &ds, StatAccumulator &data)
Generic function to load/save/serialise/deserialise StatAccumulator.
static bool data_stream(Stream &ds, VecStat &data)
Generic function to load/save/serialise/deserialise VecStat.