2016-11-15 13:13:50 +00:00
|
|
|
#ifndef CELLELMNT_H
|
|
|
|
#define CELLELMNT_H
|
|
|
|
|
|
|
|
|
|
|
|
/*---bool---
|
|
|
|
*@true : 1
|
|
|
|
*@false : 0
|
|
|
|
*/
|
|
|
|
typedef enum Bool{
|
2016-12-10 04:04:13 +00:00
|
|
|
|
|
|
|
true = 1,
|
|
|
|
false = 0
|
2016-11-15 13:13:50 +00:00
|
|
|
|
|
|
|
} bool;
|
|
|
|
|
|
|
|
|
|
|
|
/*---cellElement---
|
|
|
|
*Pointer on a cell of the matrix
|
|
|
|
*
|
|
|
|
*@colIndex : index (int) of the column of this cell
|
|
|
|
*@rowIndex : index (int) of the row of this cell
|
|
|
|
*
|
|
|
|
*@value : a boolean that is the content of the cell
|
|
|
|
*
|
|
|
|
*@nextCol : pointer on the next cellElement in the same column
|
|
|
|
*@nextRow : pointer on the next cellElement in the same row
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct cellElement {
|
2016-12-10 20:11:46 +00:00
|
|
|
|
2016-11-15 13:13:50 +00:00
|
|
|
int colIndex;
|
|
|
|
int rowIndex;
|
|
|
|
|
|
|
|
bool value;
|
|
|
|
|
|
|
|
struct cellElement * nextCol;
|
|
|
|
struct cellElement * nextRow;
|
|
|
|
|
|
|
|
};
|
2016-12-10 20:11:46 +00:00
|
|
|
typedef struct cellElement cellElement;
|
|
|
|
|
2016-12-10 23:33:02 +00:00
|
|
|
/*---CreateCellElem---
|
|
|
|
*Allocates a cellElement and returns it
|
|
|
|
*
|
|
|
|
*@return : pointer on the allocated cellElement
|
|
|
|
*
|
|
|
|
*/
|
2016-12-10 20:11:46 +00:00
|
|
|
cellElement * CreateCellElem();
|
|
|
|
|
2016-12-10 23:33:02 +00:00
|
|
|
|
|
|
|
/*---AddNextCol---
|
|
|
|
*Allocates a cellElement and sets it as the NextCol of the tree
|
|
|
|
*
|
|
|
|
*@tree : an allocated cellElement
|
|
|
|
*
|
|
|
|
*/
|
2016-12-10 20:11:46 +00:00
|
|
|
int AddNextCol(cellElement* tree);
|
2016-12-10 23:33:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*---AddNextRow---
|
|
|
|
*Allocates a cellElement and sets it as the NextRow of the tree
|
|
|
|
*
|
|
|
|
*@tree : an allocated cellElement
|
|
|
|
*
|
|
|
|
*/
|
2016-12-10 20:11:46 +00:00
|
|
|
int AddNextRow(cellElement* tree);
|
|
|
|
|
2016-12-10 23:33:02 +00:00
|
|
|
/*---removeNextCol---
|
|
|
|
*Free the nextCol cellElement of the tree
|
|
|
|
*
|
|
|
|
*@tree : an allocated cellElement
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void removeNextCol(cellElement* tree);
|
|
|
|
|
|
|
|
/*---removeNextRow---
|
|
|
|
*Free the nextRow cellElement of the tree
|
|
|
|
*
|
|
|
|
*@tree : an allocated cellElement
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void removeNextRow(cellElement* tree);
|
2016-11-15 13:13:50 +00:00
|
|
|
|
2016-12-10 20:11:46 +00:00
|
|
|
void recursivePrint(cellElement * tree);
|
2016-11-15 13:13:50 +00:00
|
|
|
|
2016-12-10 23:33:02 +00:00
|
|
|
|
|
|
|
/*---FreeCellElem---
|
|
|
|
*Allocates a cellElement and returns it
|
|
|
|
*
|
|
|
|
*@return : pointer on the allocated cellElement
|
|
|
|
*
|
|
|
|
*/
|
2016-12-10 04:04:13 +00:00
|
|
|
void FreeCellElement(cellElement* element);
|
2016-11-15 13:13:50 +00:00
|
|
|
|
2016-12-10 04:04:13 +00:00
|
|
|
#endif
|