![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
RenderingFormatLoad* atomicAsciiInit (); int readFile_is_comment (char *str); void freeDataAscii (gpointer data); void putValTypeInAsciiType (gpointer key, gpointer value, gpointer data); void putValNbInAsciiType (gpointer key, gpointer value, gpointer data);
Ascii format is a plain text format to store elements and their position. The first line is a commentary and is not read. Then, the next two lines must contains each three numbers, describing the box containing the data. The first number is the length on x direction. The next two numbers are on one hand the component on the same x direction and on the other hand the other component on a direction orthogonal to the x direction, setting thus the y direction. The three other numbers are the component of the z direction on first, the x direction, then the y direction and finally in a direction orthogonal both to x and y directions. After these three first lines, all other lines can be blank, beginning with a '#' character or containing three numbers and a label name for the element.
The read_ascii_file()
method is used to try to load an ascii
file in memory. Other methods are quite private and just put here
for other loader which wants to share the code of this loader (see
read_xyz_file()
for instance).
RenderingFormatLoad* atomicAsciiInit ();
Create the structure that gives access to a load method and some description of it (file formats associated, name...).
Returns : | a loading method. |
int readFile_is_comment (char *str);
Lines beginning with a '#' are treated as commentaries.
str : |
a null terminated string. |
Returns : | 1 if the line is a comment. |
void freeDataAscii (gpointer data);
This method is used to free an allocated stuct dataAscii, and can be used as a destructor when creating an hashtable with such datas.
data : |
a pointer to stuct dataAscii instances. |
void putValTypeInAsciiType (gpointer key, gpointer value, gpointer data);
This method is used in a g_hash_table_foreach()
method that work on data
.
data
is an array of pointers to VisuElement and this method puts its
nth value to point to key
. The value nth is read from the pos
attribute of
the structure object pointed by value
.
key : |
a VisuElement pointer ; |
value : |
a struct dataAscii pointer ; |
data : |
a pointer on array of pointers of VisuElement. |
void putValNbInAsciiType (gpointer key, gpointer value, gpointer data);
This method is used in a g_hash_table_foreach()
method that work on data
.
data
is an array of int and this method puts its
nth value to the value read from the nbNodes
attribute of
the structure object pointed by value
.
key : |
a VisuElement pointer ; |
value : |
a struct dataAscii pointer ; |
data : |
a pointer on array of int. |