3D-ICE 3.0.0
|
Go to the source code of this file.
Data Structures | |
struct | PowersQueue_t |
A First In - First Out circular queue to store power values. More... | |
Typedefs | |
typedef struct PowersQueue_t | PowersQueue_t |
Functions | |
void | powers_queue_init (PowersQueue_t *pqueue) |
void | powers_queue_copy (PowersQueue_t *dst, PowersQueue_t *src) |
void | powers_queue_build (PowersQueue_t *pqueue, Quantity_t capacity) |
void | powers_queue_destroy (PowersQueue_t *pqueue) |
PowersQueue_t * | powers_queue_calloc (void) |
PowersQueue_t * | powers_queue_clone (PowersQueue_t *pqueue) |
void | powers_queue_free (PowersQueue_t *pqueue) |
void | powers_queue_print (PowersQueue_t *pqueue, FILE *stream, String_t prefix) |
bool | is_empty_powers_queue (PowersQueue_t *pqueue) |
bool | is_full_powers_queue (PowersQueue_t *pqueue) |
void | put_into_powers_queue (PowersQueue_t *pqueue, Power_t power) |
Power_t | get_from_powers_queue (PowersQueue_t *pqueue) |
typedef struct PowersQueue_t PowersQueue_t |
Definition of the type PowersQueue_t
Definition at line 87 of file powers_queue.h.
Power_t get_from_powers_queue | ( | PowersQueue_t * | pqueue | ) |
Returns and remve the power value at the beginning of a powers queue
pqueue | the powers queue |
0
if the power queue pqueue is empty Definition at line 244 of file powers_queue.c.
bool is_empty_powers_queue | ( | PowersQueue_t * | pqueue | ) |
Returns the state of the powers queue
pqueue | the powers queue |
TRUE
if the queue is empty FALSE
otherwise Definition at line 190 of file powers_queue.c.
bool is_full_powers_queue | ( | PowersQueue_t * | pqueue | ) |
Returns the state of the powers queue
pqueue | the powers queue |
TRUE
if the queue is full FALSE
otherwise Definition at line 197 of file powers_queue.c.
void powers_queue_build | ( | PowersQueue_t * | pqueue, |
Quantity_t | capacity | ||
) |
Reserves space to store power values
The function deletes old memory, if any, calling powers_queue_destroy on the parameter pqueue. Then, it reserves new memory.
pqueue | the address of the power queue |
capacity | the new capacity of the power queue |
Definition at line 56 of file powers_queue.c.
PowersQueue_t * powers_queue_calloc | ( | void | ) |
Allocates memory for a structure of type PowersQueue_t
The content of the new structure is set to default values calling powers_queue_init
NULL
if the memory allocation fails Definition at line 119 of file powers_queue.c.
PowersQueue_t * powers_queue_clone | ( | PowersQueue_t * | pqueue | ) |
Allocates memory for a new copy of the structure pqueue
pqueue | the address of the structure to clone |
NULL
if the memory allocation fails NULL
if the parameter pqueue is NULL
Definition at line 132 of file powers_queue.c.
void powers_queue_copy | ( | PowersQueue_t * | dst, |
PowersQueue_t * | src | ||
) |
Copies the structure src into dst , as an assignement
If src is an empty queue, then dst will be set as an empty queue as well. Its capacity will not be affected.
If src is not empty, then the capacity of dst will change (i.e. set as the capacity of src ) only if it is less than the capacity of src. Otherwise, it will not be affected by the copy.
dst | the address of the left term sructure (destination) |
src | the address of the right term structure (source) |
Definition at line 87 of file powers_queue.c.
void powers_queue_destroy | ( | PowersQueue_t * | pqueue | ) |
Destroys the content of the fields of the structure pqueue
The function releases any dynamic memory used by the structure and resets its state calling powers_queue_init .
pqueue | the address of the structure to destroy |
Definition at line 76 of file powers_queue.c.
void powers_queue_free | ( | PowersQueue_t * | pqueue | ) |
Frees the memory space pointed by pqueue
The function destroys the structure pqueue and then frees its memory. The pointer pqueue must have been returned by a previous call to powers_queue_calloc or powers_queue_clone .
If pqueue is NULL
, no operation is performed.
pqueue | the pointer to free |
Definition at line 149 of file powers_queue.c.
void powers_queue_init | ( | PowersQueue_t * | pqueue | ) |
Inits the fields of the pqueue structure with default values
pqueue | the address of the structure to initalize |
Definition at line 45 of file powers_queue.c.
void powers_queue_print | ( | PowersQueue_t * | pqueue, |
FILE * | stream, | ||
String_t | prefix | ||
) |
Prints the list of power values as it looks in the floorplan file
pqueue | the powers queue to print |
stream | the output stream (must be already open) |
prefix | a string to be printed as prefix at the beginning of each line |
Definition at line 162 of file powers_queue.c.
void put_into_powers_queue | ( | PowersQueue_t * | pqueue, |
Power_t | power | ||
) |
Inserts a power value at the end of the powers queue
If the power queue pqueue is full, the Capacity will be doubled.
pqueue | the powers queue |
power | the power value to insert |
Definition at line 204 of file powers_queue.c.