QDaq
0.2.6
Qt-based Data Aqcuisition
|
A buffer for storing double numbers. More...
#include <QDaqVector.h>
Public Member Functions | |
QDaqVector (int n=0) | |
Create a buffer with n elements, initially filled with 0. | |
int | size () const |
Return the number of elememts stored in the buffer. | |
void | setSize (int n) |
set the size | |
bool | isCircular () const |
Return true if Circular. | |
void | setCircular (bool on) |
Set circular on or off. | |
int | capacity () const |
Return the currently allocated memory capacity (in number of elements). | |
void | setCapacity (int c) |
Set the capacity. | |
void | clear () |
Empty the buffer. | |
double | get (int i) const |
Get the i-th element. | |
double | operator[] (int i) const |
Return the i-th element. | |
double & | operator[] (int i) |
Return the i-th element. | |
void | push (double v) |
Append a value to the buffer. More... | |
void | push (const double *v, int n) |
Append n values stored in memory location v to the buffer. | |
void | push (const QDaqVector &v) |
Append another vector. | |
void | pop () |
Remove the last point. | |
QDaqVector & | operator<< (const double &v) |
Append a value to the buffer. | |
QDaqVector & | operator<< (const QDaqVector &v) |
Append another vector. | |
const double * | constData () const |
Return a const pointer to the data. | |
double * | data () |
Return a pointer to the data. | |
double | vmin () const |
Minimum value in the buffer. | |
double | vmax () const |
Maximum value in the buffer. | |
double | mean () const |
Mean value in the buffer. | |
double | std () const |
Standard deviation the buffer values. | |
A buffer for storing double numbers.
It is used for storing data from QDaqChannel objects.
The buffer has 3 modes, according to its StorageType property: it can be circular, i.e., new data overwrite old data, it can have fixed size or it can be expandable.
Data are inserted at the end of the buffer by the function push() or the operator<<(). The contents can be read by the function get() or the operator[](). The class provides read-only access to the data. It is not possible to change the value of a stored element.
The class defines functions for getting the min/max value, the mean and std deviation. The calculation of these quantities is stored internally and multiple calls to these functions do not cause a recalculation (except if the buffer contents have changed).
The buffer is explicitly shared, i.e., multiple instances share the same underlying data. This is used primarily for displaying real-time plots of data without copying the buffer.
Definition at line 40 of file QDaqVector.h.
|
inline |
Append a value to the buffer.
Pushing to a circular vector of 0 capacity 0 leads to an error.
Definition at line 86 of file QDaqVector.h.