10.2.4.1.1 : Le fichier RawHdf5.h


Le RawHdf5.h complet :
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/***************************************
	Auteur : Pierre Aubert
	Mail : pierre.aubert@lapp.in2p3.fr
	Licence : CeCILL-C
****************************************/


//Warning : this file has been generated automatically by the phoenix_hdf5 program
//You can find it at https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixHDF5
//Do NOT modify it


#ifndef __RAWHDF5_H__
#define __RAWHDF5_H__

#include <iostream>

///Macro to describes fixed value n°0 of Tensor attribute signal
#define RAWHDF5_SIGNAL_0 2lu


///@brief Raw data to be used to perform FFT on it
class RawHdf5{
	public:
		RawHdf5();
		RawHdf5(const RawHdf5 & other);
		virtual ~RawHdf5();

		RawHdf5 & operator = (const RawHdf5 & other);
		void clone(RawHdf5 & other);
		size_t getNbEntries() const;
		void resize(size_t nbRow);
		void softResize(size_t nbRow);
		void clear();

		void setIsEnable(bool isEnableSignal);
		void setIsEnableSignal(bool isEnableSignal);
		bool getIsEnableSignal() const;
		void setRow(size_t i, const float * signal);
		void getRow(size_t i, float *& signal);
		void getRow(size_t i, const float *& signal) const;
		void setSignal(size_t i, const float * tabVal);
		const float * getSignalFull() const;
		float * getSignalFull();
		const float * getSignal(size_t i) const;
		float * getSignal(size_t i);


	protected:
		void initialisationRawHdf5();
		///Allocate a column of the RawHdf5
		/**	@param[out] colPtr : pointer of the column to be updated
		 * 	@param nbElement : number of elements of the column
		 * 	@param isEnabled : true to allocate the column, false to skip it
		*/
		template<typename T>
		void allocateColumn(T*& colPtr, size_t nbElement, bool isEnabled){
			if(isEnabled){
				colPtr = new T[nbElement];
			}else{	//Let's free the column if it is not necessary
				if(colPtr != NULL && p__isOwnData){
					delete[] colPtr;
				}
				colPtr = NULL;
			}
		}
		void allocate(size_t nbRow);
		///Copy a column of the RawHdf5
		/**	@param[out] colOutPtr : pointer of the copied column
		 * 	@param outIsEnabled : true if the copied column is enabled
		 * 	@param nbElement : number of elements of the column
		 * 	@param isEnabled : true to allocate the column, false to skip it
		*/
		template<typename T>
		void copyColumn(T*& colOutPtr, bool & outIsEnabled, const T* colInPtr, size_t nbElement, bool isEnabled){
			outIsEnabled = isEnabled;
			if(outIsEnabled){
				memcpy(colOutPtr, colInPtr, sizeof(T)*nbElement);
			}else{	//Let's free the column if it is not necessary
				if(colOutPtr != NULL && p__isOwnData){
					delete[] colOutPtr;
				}
				colOutPtr = NULL;
			}
		}
		void copyRawHdf5(const RawHdf5 & other);

		//True if the RawHdf5 own its data, false if not
		bool p__isOwnData;
		///Number of rows in the table RawHdf5
		size_t p__nbRow;

		///Number of reserved (or allocated) rows in the table RawHdf5
		size_t p__nbReservedRow;

		///Signal in some unit with a phase (can be seen as complex number)
		float * p_signal;
		///Enable the read/write of column signal
		bool p__isEnableSignal;
};

#endif
Le fichier RawHdf5.h est disponible ici.