-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmartArray.h
More file actions
43 lines (29 loc) · 848 Bytes
/
SmartArray.h
File metadata and controls
43 lines (29 loc) · 848 Bytes
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
// Smart array, for storing multiple values in a
// variable size array
#ifndef SmartArray_h
#define SmartArray_h
class SmartArray
{
public:
SmartArray(int size);
SmartArray(int size, SmartArray* initial_data);
~SmartArray();
void pushValue(double value);
double getAvg();
double getStdDev();
boolean isFull();
/// Get the number of valid values in the array
int getValueCount();
/// true, if this is the value that completes a full cirle
boolean isLooping();
void clear();
private:
/// Get average of an array
static double getAvg(double values[], int count);
int getValue(int i);
double* _values;
int _currentIndex;
bool _isFull;
const int _size;
};
#endif //SmartArray_h