#include <Fifo.h>
Public Member Functions | |
FIFO (int size) | |
constructor | |
~FIFO () | |
destructor | |
int | size () const |
returns the size of the fifo | |
bool | empty () |
tells if the fifo is empty | |
int | read (char *buf, int) |
reads from the fifo | |
int | write (char *buf, int, bool force=false) |
writes to the fifo If force is false, the data will be lost when there is not enough space in the buffer. | |
void | reset () |
resets the fifo | |
int | space_left () |
Returns the space left in the FIFO buffer. | |
int | data_available () |
Returns the ammount of data not yet read from the FIFO. | |
Private Attributes | |
DataCondition | condition |
The data condition. | |
int | bfsiz |
buffer size | |
char * | buff |
buffer | |
char * | rdptr |
read pointer | |
char * | wrptr |
write pointer | |
char * | end |
End of the buffer. | |
Classes | |
class | DataCondition |
Condition flagging data availavility. More... |
This class implements a fifo. It can be used as a data communication channel between different threads, for instance the RunManager::writeData() and a data logger.
int FIFO::write | ( | char * | buf, | |
int | count, | |||
bool | force = false | |||
) |
writes to the fifo If force is false, the data will be lost when there is not enough space in the buffer.
If force is true, the Fifo buffer will be enlarged to ensure that this block of data is not lost
References DAQpp::Mutex::acquire(), bfsiz, buff, condition, end, DAQpp::Condition::notify(), rdptr, DAQpp::Mutex::release(), space_left(), and wrptr.