4.2.1 : The SendDataDaemon.h file



1
2
#ifndef __SENDDATADAEMON_H__
#define __SENDDATADAEMON_H__


First we can include some check and assert :
1
2
#include "phoenix_assert.h"
#include "phoenix_check.h"


Then, the Daemon header :
1
#include "Daemon.h"


Now, we can derive our SendDataDaemon from Daemon<DaemonEmptyBackend> :
1
2
3
///@brief Daemon class to test the sendData function
class SendDataDaemon : public Daemon<DaemonEmptyBackend> {
	public:


Some constructor and destructor :
1
2
		SendDataDaemon();
		virtual ~SendDataDaemon();


The extraLoopProcessing method is called at each internal loop iteration of the Daemon. You can define it to call functionnalities once per loop
1
2
3
		virtual void extraLoopProcessing();
		
	private:


The initialisation method :
1
		void initialisationSendDataDaemon();


The function which sends data (it can also be public) :
1
		void sendInt();


Some specific attribute to our class :
1
2
3
4
5
		/// boolean to know if the first ping has been sent
		bool p_isFirstSend;
};

#endif


Here is the full SendDataDaemon.h file :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/***************************************
	Auteur : Pierre Aubert
	Mail : pierre.aubert@lapp.in2p3.fr
	Licence : CeCILL-C
****************************************/

#ifndef __SENDDATADAEMON_H__
#define __SENDDATADAEMON_H__

#include "phoenix_assert.h"
#include "phoenix_check.h"
#include "Daemon.h"

///@brief Daemon class to test the sendData function
class SendDataDaemon : public Daemon<DaemonEmptyBackend> {
	public:
		SendDataDaemon();
		virtual ~SendDataDaemon();
		virtual void extraLoopProcessing();
		
	private:
		void initialisationSendDataDaemon();
		void sendInt();
		/// boolean to know if the first ping has been sent
		bool p_isFirstSend;
};

#endif
You can get the SendDataDaemon.h file here