Traitement-signal-plantes/Code-C/include/queue.h

127 lines
2.6 KiB
C
Raw Permalink Normal View History

2022-06-10 10:47:17 +02:00
typedef struct queue *Pqueue;
2022-06-10 15:16:13 +02:00
2022-06-21 15:13:10 +02:00
/**
* @brief Create Element of queue
*
* @param lenChar size of char array that will be created
* @return Pqueue new element created
*/
Pqueue queueCreateE(int lenChar, const char *_tabChar);
2022-06-13 15:03:51 +02:00
2022-06-21 15:13:10 +02:00
/**
* @brief create an empty element of queue
*
* @return Pqueue
*/
Pqueue queueCreateEmpty();
2022-06-10 15:16:13 +02:00
2022-06-21 15:13:10 +02:00
/************** Getters **************/
/**
* @brief switch to the next element
*
* @param elem current element
* @return Pqueue next element
*/
2022-06-13 15:03:51 +02:00
Pqueue queueGetNextE(Pqueue elem);
2022-06-21 15:13:10 +02:00
/**
* @brief get the size char array
*
* @param elem targeted element
* @return int
*/
2022-06-13 15:03:51 +02:00
int queueGetCharLen(Pqueue elem);
2022-06-10 15:16:13 +02:00
2022-06-21 15:13:10 +02:00
/**
* @brief get the pointer of char array
*
* @param elem targeted elemnt
* @return char*
*/
char *queueGetTabChar(Pqueue elem);
/************** Setters **************/
/**
* @brief set char size array
*
* @param elem targeted element
* @param _charLen size of char array
*/
2022-06-13 15:03:51 +02:00
void queueSetCharLen(Pqueue elem, int _charLen);
2022-06-21 15:13:10 +02:00
/**
* @brief set the char array in the element
*
* @param elem targeted element
* @param _charLen char array size
* @param _tabChar pointer to static char array
*/
2022-06-13 15:03:51 +02:00
void queueSetTabChar(Pqueue elem, int _charLen, const char *_tabChar);
2022-06-10 15:50:27 +02:00
2022-06-21 15:13:10 +02:00
/**
* @brief set next pqueue element
*
* @param elem target element
* @param next next element
*/
void queueSetNextE(Pqueue elem, Pqueue next);
/**
* @brief add in the end of queue element with string parameter
*
* @param elem Pqueue will be added at the end of queue
* @param str the string will be bind at the element
* @param len the lenght of char array
*/
void queueAddLastQ(Pqueue elem, const char *str, int len);
2022-06-10 15:16:13 +02:00
2022-06-21 15:13:10 +02:00
/************** Removers **************/
/**
* @brief remove and free the last element of queue
*
* @param elem current element
* @return Pqueue current element
*/
2022-06-13 15:03:51 +02:00
Pqueue queueRmLastE(Pqueue elem);
2022-06-21 15:13:10 +02:00
/**
* @brief remove and free the first element of queue
*
* @param elem target to remove (the element need to be the first)
2022-06-23 16:24:47 +02:00
* @return the next element of elem
2022-06-21 15:13:10 +02:00
*/
2022-06-23 16:24:47 +02:00
Pqueue queueRmFrstE(Pqueue elem); // same of queueNextDelFrst()
2022-06-21 15:13:10 +02:00
/**
* @brief delete the first value and return the next value
*
* @param elem
* @return Pqueue
*/
2022-06-23 16:24:47 +02:00
Pqueue queueNextDelFrst(Pqueue elem); // same of queueRmFrstE()
2022-06-10 15:16:13 +02:00
2022-06-21 15:13:10 +02:00
/************** print function **************/
/**
* @brief Print targeted element
*
* @param elem targeted element
*/
2022-06-13 15:03:51 +02:00
void queuePrintE(Pqueue elem);
2022-06-21 15:13:10 +02:00
/**
* @brief Print all the element starting from @param firstE till the end of the linked list
*
* @param firstE
*/
void queuePrintWholeQ(Pqueue firstE);
/**
* @brief free all queue list
*
* @param elem the first element of comdemned queue
*/
void queueDelAll(Pqueue elem);