127 lines
2.6 KiB
C
127 lines
2.6 KiB
C
typedef struct queue *Pqueue;
|
|
|
|
/**
|
|
* @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);
|
|
|
|
/**
|
|
* @brief create an empty element of queue
|
|
*
|
|
* @return Pqueue
|
|
*/
|
|
Pqueue queueCreateEmpty();
|
|
|
|
/************** Getters **************/
|
|
|
|
/**
|
|
* @brief switch to the next element
|
|
*
|
|
* @param elem current element
|
|
* @return Pqueue next element
|
|
*/
|
|
Pqueue queueGetNextE(Pqueue elem);
|
|
|
|
/**
|
|
* @brief get the size char array
|
|
*
|
|
* @param elem targeted element
|
|
* @return int
|
|
*/
|
|
int queueGetCharLen(Pqueue elem);
|
|
|
|
/**
|
|
* @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
|
|
*/
|
|
void queueSetCharLen(Pqueue elem, int _charLen);
|
|
|
|
/**
|
|
* @brief set the char array in the element
|
|
*
|
|
* @param elem targeted element
|
|
* @param _charLen char array size
|
|
* @param _tabChar pointer to static char array
|
|
*/
|
|
void queueSetTabChar(Pqueue elem, int _charLen, const char *_tabChar);
|
|
|
|
/**
|
|
* @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);
|
|
|
|
/************** Removers **************/
|
|
|
|
/**
|
|
* @brief remove and free the last element of queue
|
|
*
|
|
* @param elem current element
|
|
* @return Pqueue current element
|
|
*/
|
|
Pqueue queueRmLastE(Pqueue elem);
|
|
|
|
/**
|
|
* @brief remove and free the first element of queue
|
|
*
|
|
* @param elem target to remove (the element need to be the first)
|
|
* @return the next element of elem
|
|
*/
|
|
Pqueue queueRmFrstE(Pqueue elem); // same of queueNextDelFrst()
|
|
|
|
/**
|
|
* @brief delete the first value and return the next value
|
|
*
|
|
* @param elem
|
|
* @return Pqueue
|
|
*/
|
|
Pqueue queueNextDelFrst(Pqueue elem); // same of queueRmFrstE()
|
|
|
|
/************** print function **************/
|
|
|
|
/**
|
|
* @brief Print targeted element
|
|
*
|
|
* @param elem targeted element
|
|
*/
|
|
void queuePrintE(Pqueue elem);
|
|
|
|
/**
|
|
* @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); |