GCC Code Coverage Report


Directory: ./
File: src/Daemon/Daemon.h
Date: 2026-01-15 15:35:36
Exec Total Coverage
Lines: 2 2 100.0%
Functions: 3 4 75.0%
Branches: 2 2 100.0%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #ifndef __DAEMON_H__
8 #define __DAEMON_H__
9
10 #include "daemon_config_exception.h"
11 #include "DaemonEmptyBackend.h"
12 #include "BaseDaemon.h"
13 #include "PTimer.h"
14
15 ///@brief Class which describes a Daemon with connections to other daemons
16 template<class _TBackend>
17 class Daemon : public BaseDaemon{
18 public:
19 Daemon();
20 virtual ~Daemon();
21
22 void setSocketMode(PSocketMode::PSocketMode mode);
23 void setClockMode(PClockMode::PClockMode mode);
24 PRecvStatus::PRecvStatus checkRecvStatus(PRecvStatus::PRecvStatus recvStatus);
25 void checkSendStatus(PSendStatus::PSendStatus sendStatus);
26 bool run();
27
28 bool sendMessage(const Message & message);
29 bool sendMessage(const PString & destinationName, const Message & message);
30
31 ///Send data to other Daemon
32 /** @param destinationName : name of the destination Daemon of the data
33 * @param data : data to be sent
34 * @param isConfirmationNeeded : true if a confirmation is needed
35 * @return true on success, false otherwise (maybe received method does not exist)
36 */
37 template<typename T>
38 10 bool sendValue(const PString & destinationName, const T & data, bool isConfirmationNeeded = true){
39
2/2
✓ Branch 0 (2→3) taken 10 times.
✓ Branch 2 (3→4) taken 10 times.
10 return sendData(destinationName, phoenix_createData(data), isConfirmationNeeded);
40 }
41
42 bool sendData(const PString & destinationName, const Data & data, bool isConfirmationNeeded);
43
44 virtual void extraLoopProcessing();
45 virtual void executeOnStop();
46
47 protected:
48 ///Full backend of the Daemon (for Socket and clock)
49 _TBackend p_backend;
50 ///Timer to send statistics to the Stat Daemon
51 PTimer p_statTimer;
52 ///Start timestamp of the current accumulation of statistics
53 time_t p_startTimestamp;
54
55 void processInputMessage(Message & message);
56
57 private:
58 void initialisationDaemon();
59 void initialisationDaemonSocket();
60 void sendStatToStatDaemon(time_t currentTime);
61
62 };
63
64 #include "Daemon_impl.h"
65
66
67 #endif
68
69