pelib
2.0.0
|
Go to the source code of this file.
#define pelib_alloc | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_alloc) |
Definition at line 39 of file structure.h.
#define pelib_alloc_buffer | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_alloc_buffer) |
Definition at line 36 of file structure.h.
#define pelib_alloc_collection | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_alloc_collection) |
Definition at line 40 of file structure.h.
#define pelib_alloc_from | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_alloc_from) |
Definition at line 41 of file structure.h.
#define pelib_alloc_struct | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_alloc_struct) |
Definition at line 38 of file structure.h.
#define pelib_compare | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_compare) |
Definition at line 48 of file structure.h.
#define pelib_copy | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_copy) |
Definition at line 43 of file structure.h.
#define pelib_destroy | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_destroy) |
Definition at line 47 of file structure.h.
#define pelib_fread | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_fread) |
Definition at line 52 of file structure.h.
#define pelib_free | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_free) |
Definition at line 46 of file structure.h.
#define pelib_free_buffer | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_free_buffer) |
Definition at line 44 of file structure.h.
#define pelib_free_struct | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_free_struct) |
Definition at line 45 of file structure.h.
#define pelib_fwrite | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_fwrite) |
Definition at line 51 of file structure.h.
#define pelib_init | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_init) |
Definition at line 42 of file structure.h.
#define pelib_printf | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_printf) |
Definition at line 49 of file structure.h.
#define pelib_printf_detail | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_printf_detail) |
Definition at line 50 of file structure.h.
#define pelib_set_buffer | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_set_buffer) |
Definition at line 37 of file structure.h.
#define pelib_string | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_string) |
Definition at line 53 of file structure.h.
#define pelib_string_detail | ( | elem | ) | PELIB_CONCAT_3(pelib_,elem,_string_detail) |
Definition at line 54 of file structure.h.
STRUCT_T* pelib_alloc_struct() STRUCT_T | ( | ) |
Allocates the base structure of a pelib object
Allocate a new pelib simple data structure
int pelib_alloc_buffer() STRUCT_T | ( | STRUCT_T * | obj, |
size_t | n | ||
) |
Allocates the buffer of a pelib collection
obj | Pointer to pelib colelction that will receive the buffer |
n | Number of element this buffer should accept |
Replaces the buffer of a pelib collection with a new memory address. The reference to the old buffer is lost and the old buffer is not freed
obj | Pelib collection whose buffer is replaced |
buffer | New buffer for the pelib collection |
n | Number of element the new buffer can hold |
STRUCT_T* pelib_alloc_collection() STRUCT_T | ( | size_t | n | ) |
Allocates a new pelib collection without initializing it
n | Number of element the collection can hold after instanciation |
STRUCT_T* pelib_alloc_from() STRUCT_T | ( | void * | buffer, |
size_t | n | ||
) |
Allocate a new pelib collection and uses an existing memory location as buffer
buffer | Address of the memory to use as buffer |
n | Number of elements the new collection can hold |
int pelib_init() STRUCT_T | ( | STRUCT_T * | obj | ) |
Initializes a newly allocated pelib object
obj | Pelib object instance to be initialized |
Frees the memory associated to the base structure of a pelib object
obj | Pelib object to be freed |
Frees the memory associated to the buffer of a pelib collection
Pelib | collection whose buffer is to be freed |
Frees a comple pelib simple or collection object, including its buffer
int pelib_copy() STRUCT_T | ( | STRUCT_T | src, |
STRUCT_T * | dst | ||
) |
Copies a pelib object instance to another
src | Pelib object source |
dst | Pelib object that receives the copy |
int pelib_destroy() STRUCT_T | ( | STRUCT_T | ) |
Destroys a pelib object before its memory is freed
Returns a simple human-readable string representation of an instance of pelib object
int pelib_compare() STRUCT_T | ( | STRUCT_T | a, |
STRUCT_T | b | ||
) |
Compares two pelib object
FILE* pelib_printf() STRUCT_T | ( | FILE * | str, |
STRUCT_T | obj | ||
) |
Writes a simple human-readable representation of a pelib object instance to some stream
str | Output stream to write the object to |
obj | Pelib object to be written |
FILE* pelib_printf_detail() STRUCT_T | ( | FILE * | str, |
STRUCT_T | obj, | ||
int | lvl | ||
) |
Writes a detailed human-redable representation of a pelib object instance to some stream
str | Output stream to write the object to |
obj | Pelib object to be written |
lvl | Level of details to be written to output stream. For a collection, will write all elements in the collection with detail level = lvl - 1. Useful to display collections of complex objects and visualize all objects in details in a single line of code |
size_t pelib_fwrite() STRUCT_T | ( | STRUCT_T | obj, |
FILE * | str | ||
) |
Writes a pelib object instance to output stream. pelib_fread must be able to read back the written object instance and store it to memory
obj | Pelib object instance to be written |
str | output stream that receives the written pelib object instance |
size_t pelib_fread() STRUCT_T | ( | STRUCT_T * | obj, |
FILE * | str | ||
) |
Reads a pelib object from input stream produced by pelib_fwrite and write it in an existing pelib object instance
obj | Pointer to object that receives the data read from input stream |
str | Input stream whose content is produced by pelib_fwrite to read data from |
char* pelib_string_detail() STRUCT_T | ( | STRUCT_T | , |
int | |||
) |
Returns a detailed view human-readable string representation of an instance of pelib object. For a collection, the same function is run for all pelib object instances held is the collection with a lower level value.
obj | Pelib object to be written to |
lvl | Level of details to be generated |