My Project
programmer's documentation
cs_gui_util.h
Go to the documentation of this file.
1 #ifndef __CS_GUI_UTIL_H__
2 #define __CS_GUI_UTIL_H__
3 
4 /*============================================================================
5  * Management of the GUI parameters file: xpath request and utilities
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2019 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_base.h"
35 #include "cs_tree.h"
36 
37 /*----------------------------------------------------------------------------*/
38 
40 
41 /*=============================================================================
42  * Public function prototypes
43  *============================================================================*/
44 
45 /*-----------------------------------------------------------------------------
46  * Indicate if an XML file has been loaded
47  *
48  * returns:
49  * 1 if an XML file has been loaded, 0 otherwise
50  *----------------------------------------------------------------------------*/
51 
52 int
54 
55 /*----------------------------------------------------------------------------
56  * Load the XML file in memory.
57  *
58  * parameter:
59  * filename <-- XML file containing the parameters
60  *
61  * returns:
62  * error code (0 in case of success)
63  *----------------------------------------------------------------------------*/
64 
65 int
66 cs_gui_load_file(const char *filename);
67 
68 /*-----------------------------------------------------------------------------
69  * Check the xml file version.
70  *----------------------------------------------------------------------------*/
71 
72 void
74 
75 /*-----------------------------------------------------------------------------
76  * Return the number of characters needed to print an integer number
77  *
78  * parameters:
79  * num <-- integer number
80  *
81  * returns:
82  * number of characters required
83  *----------------------------------------------------------------------------*/
84 
85 int
87 
88 /*-----------------------------------------------------------------------------
89  * Compare two strings.
90  *
91  * parameters:
92  * s1 <-- first string
93  * s2 <-- second string
94  *
95  * returns:
96  * 1 if the strings are equal, 0 otherwise.
97  *----------------------------------------------------------------------------*/
98 
99 int
100 cs_gui_strcmp(const char *s1,
101  const char *s2);
102 
103 /*-----------------------------------------------------------------------------
104  * Test if 2 real values are equal (avoiding compiler warnings)
105  *
106  * parameters:
107  * v1 <-- first value to compare
108  * v2 <-- second value to compare
109  *
110  * returns:
111  * 1 if values are equal, 0 otherwise
112  *----------------------------------------------------------------------------*/
113 
114 int
116  cs_real_t v2);
117 
118 /*----------------------------------------------------------------------------*/
128 /*----------------------------------------------------------------------------*/
129 
130 void
131 cs_gui_node_get_int(cs_tree_node_t *node,
132  int *value);
133 
134 /*----------------------------------------------------------------------------*/
144 /*----------------------------------------------------------------------------*/
145 
146 void
147 cs_gui_node_get_real(cs_tree_node_t *node,
148  cs_real_t *value);
149 
150 /*----------------------------------------------------------------------------*/
160 /*----------------------------------------------------------------------------*/
161 
162 void
163 cs_gui_node_get_status_int(cs_tree_node_t *node,
164  int *status);
165 
166 /*----------------------------------------------------------------------------*/
176 /*----------------------------------------------------------------------------*/
177 
178 void
179 cs_gui_node_get_status_bool(cs_tree_node_t *node,
180  bool *status);
181 
182 /*----------------------------------------------------------------------------*/
194 /*----------------------------------------------------------------------------*/
195 
196 const char *
197 cs_gui_node_get_tag(cs_tree_node_t *node,
198  const char *tag_name);
199 
200 /*----------------------------------------------------------------------------*/
211 /*----------------------------------------------------------------------------*/
212 
213 void
214 cs_gui_node_get_child_int(cs_tree_node_t *node,
215  const char *child_name,
216  int *value);
217 
218 /*----------------------------------------------------------------------------*/
229 /*----------------------------------------------------------------------------*/
230 
231 void
232 cs_gui_node_get_child_real(cs_tree_node_t *node,
233  const char *child_name,
234  cs_real_t *value);
235 
236 /*----------------------------------------------------------------------------*/
248 /*----------------------------------------------------------------------------*/
249 
250 void
251 cs_gui_node_get_child_status_int(cs_tree_node_t *node,
252  const char *child_name,
253  int *status);
254 
255 /*----------------------------------------------------------------------------*/
267 /*----------------------------------------------------------------------------*/
268 
269 void
271  const char *child_name,
272  bool *status);
273 
274 /*-----------------------------------------------------------------------------
275  * Add timing increment to global MEI time counter.
276  *
277  * parameters:
278  * t <-- timing increment to add
279  *----------------------------------------------------------------------------*/
280 
281 void
282 cs_gui_add_mei_time(double t);
283 
284 /*-----------------------------------------------------------------------------
285  * Get cumulative global MEI time counter.
286  *
287  * returns:
288  * cumulative global MEI time counter
289  *----------------------------------------------------------------------------*/
290 
291 double
293 
294 /*----------------------------------------------------------------------------*/
295 
297 
298 #endif /* __CS_GUI_UTIL_H__ */
cs_gui_strcmp
int cs_gui_strcmp(const char *s1, const char *s2)
Definition: cs_gui_util.c:220
cs_gui_node_get_int
void cs_gui_node_get_int(cs_tree_node_t *node, int *value)
Update an integer value based on a tree node.
Definition: cs_gui_util.c:271
cs_gui_load_file
int cs_gui_load_file(const char *filename)
Load the XML file in memory.
Definition: cs_gui_util.c:120
cs_gui_is_equal_real
int cs_gui_is_equal_real(cs_real_t v1, cs_real_t v2)
Definition: cs_gui_util.c:241
cs_gui_node_get_status_int
void cs_gui_node_get_status_int(cs_tree_node_t *node, int *status)
Update an integer-valued status value based on a node's status tag.
Definition: cs_gui_util.c:337
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_gui_node_get_child_int
void cs_gui_node_get_child_int(cs_tree_node_t *node, const char *child_name, int *value)
Update an integer value based on a tree's child node.
Definition: cs_gui_util.c:423
cs_gui_node_get_child_status_int
void cs_gui_node_get_child_status_int(cs_tree_node_t *node, const char *child_name, int *status)
Update an integer-valued status value based on a node child's status tag.
Definition: cs_gui_util.c:498
cs_gui_node_get_tag
const char * cs_gui_node_get_tag(cs_tree_node_t *node, const char *tag_name)
Return a string value associated with a "tag" child node and whose presence should be guaranteed.
Definition: cs_gui_util.c:393
cs_gui_add_mei_time
void cs_gui_add_mei_time(double t)
Definition: cs_gui_util.c:559
cs_gui_check_version
void cs_gui_check_version(void)
Check the XML file version.
Definition: cs_gui_util.c:140
cs_gui_get_mei_times
double cs_gui_get_mei_times(void)
Definition: cs_gui_util.c:572
cs_gui_file_is_loaded
int cs_gui_file_is_loaded(void)
Indicate if an XML file has been loaded.
Definition: cs_gui_util.c:101
cs_gui_characters_number
int cs_gui_characters_number(int num)
Definition: cs_gui_util.c:192
cs_gui_node_get_child_status_bool
void cs_gui_node_get_child_status_bool(cs_tree_node_t *node, const char *child_name, bool *status)
Update a bool-valued status value based on a node child's status tag.
Definition: cs_gui_util.c:532
node
void const cs_int_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t cs_int_t * node
Definition: cs_prototypes.h:122
t
Definition: cs_field_pointer.h:98
cs_tree.h
cs_gui_node_get_child_real
void cs_gui_node_get_child_real(cs_tree_node_t *node, const char *child_name, cs_real_t *value)
Update an integer value based on a tree's child node.
Definition: cs_gui_util.c:460
cs_gui_node_get_status_bool
void cs_gui_node_get_status_bool(cs_tree_node_t *node, bool *status)
Update an bool-valued status value based on a node's status tag.
Definition: cs_gui_util.c:364
cs_gui_node_get_real
void cs_gui_node_get_real(cs_tree_node_t *node, cs_real_t *value)
Update an real value based on a tree node.
Definition: cs_gui_util.c:304
cs_base.h