Tree creator from a formatted CSV file. It write its results in a TeX file which is a Beamer document.
More...
Go to the source code of this file.
|
| struct | person |
| | A structure representing an indivual as a tree node. More...
|
| |
|
|
#define | MAXDEPTH 5 |
| | A macro representing the maximum depth of the TEX tree.
|
| |
|
#define | MAXLEN 255 |
| | A macro representing the maximum length of a string.
|
| |
|
#define | CSVSEP ";" |
| | A macro representing the CSV separator (by default a semi-colon).
|
| |
|
#define | CSVEOL ";\n" |
| | A macro representing the CSV end of line (by default a semi-colon and a carriage return).
|
| |
|
#define | LOGS "logs/treeBuilder.log" |
| | A macro representing the path to the log file.
|
| |
|
#define | SRC "data.csv" |
| | A macro representing the path to the CSV data file.
|
| |
|
#define | TEX "tree.tex" |
| | A macro representing the path to the build TEX file.
|
| |
|
| Tree | createNode (int id, char name[], int value) |
| | Create a new indivudal (node). More...
|
| |
|
int | buildTree (Tree *t, int id, char name[], int value, FILE *logs) |
| |
| void | getFields (char line[], char *tokens[]) |
| | Read a CSV file row. More...
|
| |
| int | toInt (char *str) |
| | Convert a string to an integer. More...
|
| |
|
int | readCSV (FILE *file, Tree *t, FILE *logs) |
| |
| void | displayPerson (Tree t) |
| | Display a tree in the standard output. More...
|
| |
| void | rowMissingChildren (FILE *file, int children) |
| | Add missing children to the tree in the TEX file. More...
|
| |
| void | missingChildren (int id, FILE *file, int rootId) |
| | Compute the number of missing children for the given node according to the root id. More...
|
| |
| void | color (int value, char strColor[]) |
| | Set the node color according to its value. More...
|
| |
| void | writeLatexPerson (FILE *file, Tree t, int depth, int rootId) |
| | Write an individual as a node in the TEX file. More...
|
| |
| void | writeLatexFile (FILE *file, Tree t, int rootId) |
| | Write a TEX file from a binary tree. More...
|
| |
| void | writeLogs (FILE *logs, char message[]) |
| | Add a line to the log file. More...
|
| |
| void | formateInteger (int val, char ch[], char addOn[]) |
| | Formate an integer to a specific string for the logs. More...
|
| |
Tree creator from a formatted CSV file. It write its results in a TeX file which is a Beamer document.
- Author
- Bruno Verchère
- Version
- 1.0.0
- Date
- 2021
Example of a PDF output
◆ Person
The type definition of an individual.
- See also
- person
◆ Tree
The type definition of the binary tree.
- See also
- person
◆ color()
| void color |
( |
int |
value, |
|
|
char |
strColor[] |
|
) |
| |
Set the node color according to its value.
- Parameters
-
| value | The current node value. |
| strColor | The node color as a string. |
◆ createNode()
| Tree createNode |
( |
int |
id, |
|
|
char |
name[], |
|
|
int |
value |
|
) |
| |
Create a new indivudal (node).
- Parameters
-
| id | The node identifier. |
| name | A string representing the individual name. |
| value | The node value (representing the genetic character). |
- Returns
- A new node.
◆ displayPerson()
| void displayPerson |
( |
Tree |
t | ) |
|
Display a tree in the standard output.
- Parameters
-
◆ formateInteger()
| void formateInteger |
( |
int |
val, |
|
|
char |
ch[], |
|
|
char |
addOn[] |
|
) |
| |
Formate an integer to a specific string for the logs.
- Parameters
-
| val | The integer to format. |
| ch | The logs string. |
| addOn | The string to place before the integer. |
◆ getFields()
| void getFields |
( |
char |
line[], |
|
|
char * |
tokens[] |
|
) |
| |
Read a CSV file row.
- Parameters
-
| line | The line to parse. |
| tokens | The parsed values of this line. |
◆ missingChildren()
| void missingChildren |
( |
int |
id, |
|
|
FILE * |
file, |
|
|
int |
rootId |
|
) |
| |
Compute the number of missing children for the given node according to the root id.
- Parameters
-
| id | The current identifider. |
| file | The TEX file to write. |
| rootId | The tree root identifier. |
◆ rowMissingChildren()
| void rowMissingChildren |
( |
FILE * |
file, |
|
|
int |
children |
|
) |
| |
Add missing children to the tree in the TEX file.
- Parameters
-
| file | The TEX file to write. |
| children | The number of missing children to add. |
◆ toInt()
Convert a string to an integer.
- Parameters
-
| str | The string to convert. |
- Returns
- The converted string as an integer.
◆ writeLatexFile()
| void writeLatexFile |
( |
FILE * |
file, |
|
|
Tree |
t, |
|
|
int |
rootId |
|
) |
| |
Write a TEX file from a binary tree.
- Parameters
-
| file | The TEX file to write. |
| t | The binary tree. |
| rootId | The tree root identifier. |
◆ writeLatexPerson()
| void writeLatexPerson |
( |
FILE * |
file, |
|
|
Tree |
t, |
|
|
int |
depth, |
|
|
int |
rootId |
|
) |
| |
Write an individual as a node in the TEX file.
- Parameters
-
| file | The TEX file. |
| t | The binary tree. |
| depth | The current node depth. |
| rootId | The tree root identifier. |
◆ writeLogs()
| void writeLogs |
( |
FILE * |
logs, |
|
|
char |
message[] |
|
) |
| |
Add a line to the log file.
- Parameters
-
| logs | The log file. |
| message | The message to add to the logs. |
© 2021 Bruno Verchère