* add C027_Support fork

Fork of C027_Support by u-blox

Embed: (wiki syntax)

« Back to documentation index

Pipe< T > Class Template Reference

Pipe< T > Class Template Reference

pipe, this class implements a buffered pipe that can be savely written and read between two context. More...

#include <Pipe.h>

Public Member Functions

 ~Pipe (void)
 Destructor frees a allocated buffer.
bool writeable (void)
 Check if buffer is writeable (=not full)
int free (void)
 Return the number of free elements in the buffer.
bool readable (void)
 Check if there are any emelemnt available (readble / not empty)
int size (void)
 Get the number of values available in the buffer return the number of element available.
getc (void)
 get a single value from buffered pipe (this function will block if no values available)
int get (T *p, int n, bool t=false)
int set (int ix)
 set the parsing index and return the number of available elments starting this position.
next (void)
 get the next element from parsing position and increment parsing index
void done (void)
 commit the index, mark the current parsing index as consumed data.

Detailed Description

template<class T>
class Pipe< T >

pipe, this class implements a buffered pipe that can be savely written and read between two context.

E.g. Written from a task and read from a interrupt.

Definition at line 8 of file Pipe.h.


Constructor & Destructor Documentation

~Pipe ( void   )

Destructor frees a allocated buffer.

Definition at line 27 of file Pipe.h.


Member Function Documentation

void done ( void   )

commit the index, mark the current parsing index as consumed data.

Definition at line 217 of file Pipe.h.

int free ( void   )

Return the number of free elements in the buffer.

Returns:
the number of free elements

Definition at line 62 of file Pipe.h.

int get ( T *  p,
int  n,
bool  t = false 
)

get elements from the buffered pipe

Parameters:
pthe elements extracted
nthe maximum number elements to extract
tset to true if blocking, false otherwise
Returns:
number elements extracted

Definition at line 160 of file Pipe.h.

T getc ( void   )

get a single value from buffered pipe (this function will block if no values available)

Returns:
the element extracted

Definition at line 144 of file Pipe.h.

T next ( void   )

get the next element from parsing position and increment parsing index

Returns:
the extracted element.

Definition at line 207 of file Pipe.h.

bool readable ( void   )

Check if there are any emelemnt available (readble / not empty)

Returns:
true if readable/not empty

Definition at line 125 of file Pipe.h.

int set ( int  ix )

set the parsing index and return the number of available elments starting this position.

Parameters:
ixthe index to set.
Returns:
the number of elements starting at this position

Definition at line 196 of file Pipe.h.

int size ( void   )

Get the number of values available in the buffer return the number of element available.

Definition at line 133 of file Pipe.h.

bool writeable ( void   )

Check if buffer is writeable (=not full)

Returns:
true if writeable

Definition at line 54 of file Pipe.h.