src/buffer.h File Reference

Header file for the management of buffers. More...

This graph shows which files directly or indirectly include this file:


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.

Detailed Description

Header file for the management of buffers.

Author:
Benjamin Grenier-Boley <benjamin.grenier-boley@inria.fr>
Version:
1.02
Date:
September 2008
This file will define all defines and functions for bufffers

Define Documentation

#define BUFFER_EMPTY ( Buf   )     ((Buf)->size=0)

Defines a function to declare an empty buffer.

Parameters:
[in,out] Buf : the buffer to empty
This definition defines a function to declare a buffer with a size of 0

#define BUFFER_IS_FULL ( Buf   )     ((Buf)->size == (Buf)->max_size)

Defines a function to know if a buffer is full.

Parameters:
[in] Buf : the buffer to know if its capacity is full
This definition defines a function which returns the fact that the buffer has reached its maximum size

#define BUFFER_MAXSIZE ( Buf   )     ((Buf)->max_size)

Defines a function to get the buffer maximum size.

Parameters:
[in] Buf : the buffer to know the maximum size
This definition defines a function which returns the current buffer maximum size

#define BUFFER_PUT ( Buf,
Val   )     ((Buf)->data[((Buf)->size)++] = (Val))

Defines a function to add a value in the buffer.

Parameters:
[in,out] Buf : the buffer where to add the value
[in] Val : the value to add
This definition defines a function which will add the value in the buffer and increase its actual size

#define BUFFER_PUT_ALL ( Buf,
Oth   ) 

Value:

strncpy(&((Buf)->data[(Buf)->size]), (Oth)->data, (Oth)->size); \
  (Buf)->size += (Oth)->size
Defines a function to add a several values in the buffer.

Parameters:
[in,out] Buf : the buffer where to add the values
[in] Oth : the buffer containing the values to add
This definition defines a function which will add the values of a buffer into another one

#define BUFFER_RELEASE ( Buf   )     ((Buf)->data[(Buf)->size] = '\0')

Defines a function to release a buffer.

Parameters:
[in,out] Buf : the buffer to release
This definition defines a function which add the end string char at the end of the buffer data to release it

#define BUFFER_RESIZE ( Buf,
MSiz   ) 

Value:

RENEW((Buf)->data, char, (1 + (MSiz))); \
  (Buf)->max_size = (MSiz);                     \
  (Buf)->data[(Buf)->max_size]='\0'
Defines a function to resize a buffer.

Parameters:
[in,out] Buf : the buffer to resize
[in] MSiz : the new size of the buffer
This definition defines a function which will resize the buffer with the wanted size

#define BUFFER_SIZE ( Buf   )     ((Buf)->size)

Defines a function to get the buffer size.

Parameters:
[in] Buf : the buffer to know the size
This definition defines a function which returns the current buffer size

#define BUFFER_TOSTRING ( Buf   )     ((Buf)->data)

Defines a function to get the buffer data into a string.

Parameters:
[in] Buf : the buffer to get the data
This definition defines a function which will return the data of the buffer into a string

#define DESTROY_BUFFER ( Buf   ) 

Value:

DESTROY(((Buf)->data));                 \
  DESTROY((Buf))
Defines a function to destroy a buffer.

Parameters:
[in,out] Buf : the buffer to destriy
This definition defines a function which will detroy the buffer data and then the buffer itself

#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'
Defines a function to initialize the buffer.

Parameters:
[in,out] Buf : the buffer to initialize
[in] MSiz : the maximum buffer size
This definition defines a function to initialize the buffer given with the maximum size defined


Generated on Mon Sep 22 16:34:09 2008 for matt_ygraph by  doxygen 1.5.5