quadEM  7-0
NDArrayRing.h
Go to the documentation of this file.
1 #ifndef NDARRAYRING_H
2 #define NDARRAYRING_H
3 
4 #include "NDArray.h"
5 
7 {
8  public:
9 
10  // Creates a ring with pointers to buffers.
11  NDArrayRing(int noOfBuffers);
12 
13  // Destructor.
14  ~NDArrayRing();
15 
16  // Read the current size
17  int size();
18 
19  // Add a new buffer reference to the end of the ring
20  NDArray *addToEnd(NDArray *pArray);
21 
22  // Read out the first buffer reference from the ring
24 
25  // Read out the next buffer reference from the ring
26  NDArray *readNext();
27 
28  // Does the ring have any other data
29  bool hasNext();
30 
31  // Removes all the elements from the ring.
32  void clear();
33 
34  private:
35  // Array of pointers to NDArrays
36  NDArray** buffers_;
37 
38  // The size of the ring
39  int noOfBuffers_;
40 
41  // Index to read the next buffer
42  int readIndex_;
43 
44  // Index to write a new NDArray pointer into the ring
45  int writeIndex_;
46 
47  // Has the ring wrapped yet
48  int wrapped_;
49 };
50 
51 #endif
52 
bool hasNext()
Definition: NDArrayRing.cpp:81
void clear()
Definition: NDArrayRing.cpp:90
int size()
Definition: NDArrayRing.cpp:32
NDArray * readNext()
Definition: NDArrayRing.cpp:74
Definition: NDArrayRing.h:6
NDArray * readFromStart()
Definition: NDArrayRing.cpp:62
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data...
Definition: NDArray.h:93
NDArray * addToEnd(NDArray *pArray)
Definition: NDArrayRing.cpp:40
~NDArrayRing()
Definition: NDArrayRing.cpp:26
NDArrayRing(int noOfBuffers)
Definition: NDArrayRing.cpp:12