11.2.4.1.2 : Le fichier RawHdf5.cpp


Le RawHdf5.cpp 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/***************************************
	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


#include <string.h>
#include <sstream>
#include "RawHdf5.h"

///Constructor of the class RawHdf5
RawHdf5::RawHdf5(){
	initialisationRawHdf5();
}

///Copy constructor of the class RawHdf5
/**	@param other : RawHdf5 to be copied
*/
RawHdf5::RawHdf5(const RawHdf5 & other){
	initialisationRawHdf5();
	copyRawHdf5(other);
}

///Destructor of the class RawHdf5
RawHdf5::~RawHdf5(){
	clear();
}

///Equal operator of the class RawHdf5
/**	@param other : RawHdf5 to be copied
 * 	@return copied RawHdf5
*/
RawHdf5 & RawHdf5::operator = (const RawHdf5 & other){
	copyRawHdf5(other);
	return *this;
}

///Clone the columns of other in the current RawHdf5 without copy
/**	@param other : RawHdf5 to be cloned
*/
void RawHdf5::clone(RawHdf5 & other){
	p__isOwnData = false;
	p__nbRow = other.p__nbRow;
	p__nbReservedRow = other.p__nbReservedRow;
	//Let's copy proper attributes of the RawHdf5
	//Let's clone the columns
	p_signal = other.p_signal;
	p__isEnableSignal = other.p__isEnableSignal;
}

///Get the total number of rows in the current Table RawHdf5
/**	@return total number of rows
*/
size_t RawHdf5::getNbEntries() const{
	return p__nbRow;
}

///Resize the table RawHdf5
/*	@param nbRow : new number of rows of the Table
*/
void RawHdf5::resize(size_t nbRow){
	if(nbRow == p__nbRow || !p__isOwnData){return;}	//Nothing to do
	clear();
	allocate(nbRow);
}

///Soft Resize of the table RawHdf5
/*	@param nbRow : new number of rows of the Table (if already allocated)
 * 	The soft resize is used to reduce the number of rows of the current table
*/
void RawHdf5::softResize(size_t nbRow){
	if(nbRow < p__nbReservedRow){
		p__nbRow = nbRow;
	}
}

///Enable/Disable for all columns
/**	@param isEnableSignal : True to enable the signal column, false to disable it
*/
void RawHdf5::setIsEnable(bool isEnableSignal){
	setIsEnableSignal(isEnableSignal);
}

///Enable/Disable the signal column
/**	@param isEnableSignal : true to enable the signal column, false to disable it
*/
void RawHdf5::setIsEnableSignal(bool isEnableSignal){
	p__isEnableSignal = isEnableSignal;
}

///Get is the signal column is Enable or Disable
/**	@return true to enable the signal column, false to disable it
*/
bool RawHdf5::getIsEnableSignal() const{
	return p__isEnableSignal;
}

///Clear the table RawHdf5 (delete all column)
void RawHdf5::clear(){
	if(p_signal != NULL && p__isOwnData){delete [] p_signal;p_signal = NULL;}
}

///Set a full row of the table RawHdf5
/**	@param i : index of the row to be set
 * 	@param signal : attribute to be set
*/
void RawHdf5::setRow(size_t i, const float * signal){
	setSignal(i, signal);
}

///Get a full row of the table RawHdf5 (without tensor copy, only with pointer)
/**	@param i : index of the row to get its values
 * 	@param[out] signal : attribute to be get
*/
void RawHdf5::getRow(size_t i, float *& signal){
	signal = getSignal(i);
}

///Get a full row of the table RawHdf5 (without tensor copy, only with pointer)
/**	@param i : index of the row to get its values
 * 	@param[out] signal : attribute to be get
*/
void RawHdf5::getRow(size_t i, const float *& signal) const{
	signal = getSignal(i);
}

///Set the attribute signal (column signal)
/**	@param i : index of the row to be used
 * 	@param tabVal : table of value to be copied
*/
void RawHdf5::setSignal(size_t i, const float * tabVal){
	size_t sizeRow(RAWHDF5_SIGNAL_0);
	memcpy(p_signal + i*sizeRow, tabVal, sizeRow*sizeof(float));
}

///Get the full column of the attribute signal (column signal)
/**	@return pointer of the full column
*/
const float * RawHdf5::getSignalFull() const{
	return p_signal;
}

///Get the full column of the attribute signal (column signal)
/**	@return pointer of the full column
*/
float * RawHdf5::getSignalFull(){
	return p_signal;
}

///Get the tensor i of the attribute signal (column signal)
/**	@param i : index of the row to be used
 * 	@return pointer to the corresponding tensor
*/
const float * RawHdf5::getSignal(size_t i) const{
	return p_signal + i*RAWHDF5_SIGNAL_0;
}

///Get the tensor i of the attribute signal (column signal)
/**	@param i : index of the row to be used
 * 	@return pointer to the corresponding tensor
*/
float * RawHdf5::getSignal(size_t i){
	return p_signal + i*RAWHDF5_SIGNAL_0;
}

///Initialises the table RawHdf5
void RawHdf5::initialisationRawHdf5(){
	p__isOwnData = true;
	p__nbRow = 0lu;
	p__nbReservedRow = 0lu;
	p_signal = NULL;
	p__isEnableSignal = true;
}

///Allocate the table RawHdf5 (delete all column)
/**	@param nbRow : new number of rows of the Table
*/
void RawHdf5::allocate(size_t nbRow){
	p__isOwnData = true;
	p__nbRow = nbRow;
	p__nbReservedRow = p__nbRow;
	if(p__nbRow == 0lu){
		clear();
		return;
	}
	allocateColumn(p_signal, p__nbRow*RAWHDF5_SIGNAL_0, p__isEnableSignal);
}

///Copy function of the class RawHdf5
/**	@param other : RawHdf5 to be copied
*/
void RawHdf5::copyRawHdf5(const RawHdf5 & other){
	//Let's copy proper attributes of the RawHdf5
	//Let's allocate columns of RawHdf5
	allocate(other.p__nbRow);	//Let's allocate properly everything
	//Let's copy columns of RawHdf5
	copyColumn(p_signal, p__isEnableSignal, other.p_signal, p__nbRow*RAWHDF5_SIGNAL_0, other.p__isEnableSignal);
}
Le fichier RawHdf5.cpp est disponible ici.