Data Structures | |
struct | sequence_buffer_s |
buffer sequence implementation More... | |
Defines | |
#define | NEW_BUFFER(Buf, MSiz) |
Defines a function to initialize the buffer. | |
#define | BUFFER_EMPTY(Buf) ((Buf)->size=0) |
Defines a function to declare an empty buffer. | |
#define | BUFFER_MAXSIZE(Buf) ((Buf)->max_size) |
Defines a function to get the buffer maximum size. | |
#define | BUFFER_SIZE(Buf) ((Buf)->size) |
Defines a function to get the buffer size. | |
#define | BUFFER_IS_FULL(Buf) ((Buf)->size == (Buf)->max_size) |
Defines a function to know if a buffer is full. | |
#define | BUFFER_RESIZE(Buf, MSiz) |
Defines a function to resize a buffer. | |
#define | BUFFER_PUT(Buf, Val) ((Buf)->data[((Buf)->size)++] = (Val)) |
Defines a function to add a value in the buffer. | |
#define | BUFFER_PUT_ALL(Buf, Oth) |
Defines a function to add a several values in the buffer. | |
#define | BUFFER_RELEASE(Buf) ((Buf)->data[(Buf)->size] = '\0') |
Defines a function to release a buffer. | |
#define | BUFFER_TOSTRING(Buf) ((Buf)->data) |
Defines a function to get the buffer data into a string. | |
#define | DESTROY_BUFFER(Buf) |
Defines a function to destroy a buffer. |
#define BUFFER_EMPTY | ( | Buf | ) | ((Buf)->size=0) |
Defines a function to declare an empty buffer.
[in,out] | Buf | : the buffer to empty |
#define BUFFER_IS_FULL | ( | Buf | ) | ((Buf)->size == (Buf)->max_size) |
Defines a function to know if a buffer is full.
[in] | Buf | : the buffer to know if its capacity is full |
#define BUFFER_MAXSIZE | ( | Buf | ) | ((Buf)->max_size) |
Defines a function to get the buffer maximum size.
[in] | Buf | : the buffer to know the maximum size |
#define BUFFER_PUT | ( | Buf, | |||
Val | ) | ((Buf)->data[((Buf)->size)++] = (Val)) |
Defines a function to add a value in the buffer.
[in,out] | Buf | : the buffer where to add the value |
[in] | Val | : the value to add |
#define BUFFER_PUT_ALL | ( | Buf, | |||
Oth | ) |
Value:
strncpy(&((Buf)->data[(Buf)->size]), (Oth)->data, (Oth)->size); \ (Buf)->size += (Oth)->size
[in,out] | Buf | : the buffer where to add the values |
[in] | Oth | : the buffer containing the values to add |
#define BUFFER_RELEASE | ( | Buf | ) | ((Buf)->data[(Buf)->size] = '\0') |
Defines a function to release a buffer.
[in,out] | Buf | : the buffer to release |
#define BUFFER_RESIZE | ( | Buf, | |||
MSiz | ) |
Value:
RENEW((Buf)->data, char, (1 + (MSiz))); \ (Buf)->max_size = (MSiz); \ (Buf)->data[(Buf)->max_size]='\0'
[in,out] | Buf | : the buffer to resize |
[in] | MSiz | : the new size of the buffer |
#define BUFFER_SIZE | ( | Buf | ) | ((Buf)->size) |
Defines a function to get the buffer size.
[in] | Buf | : the buffer to know the size |
#define BUFFER_TOSTRING | ( | Buf | ) | ((Buf)->data) |
Defines a function to get the buffer data into a string.
[in] | Buf | : the buffer to get the data |
#define DESTROY_BUFFER | ( | Buf | ) |
#define NEW_BUFFER | ( | Buf, | |||
MSiz | ) |
Value:
NEW((Buf), sequence_buffer_s, 1); \ (Buf)->size=0; \ (Buf)->max_size=(MSiz); \ NEW(((Buf)->data), char, (1 + (MSiz))); \ (Buf)->data[(Buf)->max_size]='\0'
[in,out] | Buf | : the buffer to initialize |
[in] | MSiz | : the maximum buffer size |