gwenhywfar  4.99.8beta
param.c
Go to the documentation of this file.
1 /**********************************************************
2  * This file has been automatically created by "typemaker2"
3  * from the file "param.xml".
4  * Please do not edit this file, all changes will be lost.
5  * Better edit the mentioned source file instead.
6  **********************************************************/
7 
8 #ifdef HAVE_CONFIG_H
9 # include <config.h>
10 #endif
11 
12 #include "param_p.h"
13 
14 #include <gwenhywfar/misc.h>
15 #include <gwenhywfar/debug.h>
16 
17 /* code headers */
18 
19 /* macro functions */
22 GWEN_TREE_FUNCTIONS(GWEN_PARAM, GWEN_Param)
23 
24 
26  if (p_s && *p_s) {
27  if (strcasecmp(p_s, "int")==0)
29  else if (strcasecmp(p_s, "bool")==0)
31  else if (strcasecmp(p_s, "float")==0)
33  else if (strcasecmp(p_s, "string")==0)
35  }
37 }
38 
40  if (p_s && *p_s) {
41  if (strcasecmp(p_s, "simple")==0)
43  else if (strcasecmp(p_s, "choice")==0)
45  }
47 }
48 
50  switch(p_i) {
52  return "int";
54  return "bool";
56  return "float";
58  return "string";
59  default:
60  return "unknown";
61  }
62 }
63 
65  switch(p_i) {
67  return "simple";
69  return "choice";
70  default:
71  return "unknown";
72  }
73 }
74 
76  GWEN_PARAM *p_struct;
77 
78  GWEN_NEW_OBJECT(GWEN_PARAM, p_struct)
79  p_struct->_refCount=1;
80  GWEN_LIST_INIT(GWEN_PARAM, p_struct)
81  GWEN_TREE_INIT(GWEN_PARAM, p_struct)
82  /* members */
83  p_struct->name=NULL;
84  p_struct->flags=0;
85  p_struct->type=GWEN_Param_Type_Unknown;
86  p_struct->dataType=GWEN_Param_DataType_Unknown;
87  p_struct->shortDescription=NULL;
88  p_struct->longDescription=NULL;
89  p_struct->currentValue=NULL;
90  p_struct->defaultValue=NULL;
91  p_struct->choices=NULL;
92  p_struct->internalIntValue=0;
93  p_struct->internalFloatValue=0;
94  p_struct->runtimeFlags=0;
95  /* virtual functions */
96 
97  return p_struct;
98 }
99 
100 void GWEN_Param_free(GWEN_PARAM *p_struct) {
101  if (p_struct) {
102  assert(p_struct->_refCount);
103  if (p_struct->_refCount==1) {
104  GWEN_LIST_FINI(GWEN_PARAM, p_struct)
105  GWEN_TREE_FINI(GWEN_PARAM, p_struct)
106  /* members */
107  free(p_struct->name);
108  free(p_struct->shortDescription);
109  free(p_struct->longDescription);
110  free(p_struct->currentValue);
111  free(p_struct->defaultValue);
112  GWEN_StringList2_free(p_struct->choices);
113  p_struct->_refCount=0;
114  GWEN_FREE_OBJECT(p_struct);
115  }
116  else
117  p_struct->_refCount--;
118  }
119 }
120 
121 void GWEN_Param_Attach(GWEN_PARAM *p_struct) {
122  assert(p_struct);
123  assert(p_struct->_refCount);
124  p_struct->_refCount++;
125 }
126 
128  GWEN_PARAM *p_struct;
129 
130  assert(p_src);
131  p_struct=GWEN_Param_new();
132  /* member "name" */
133  if (p_struct->name) {
134  free(p_struct->name);
135  p_struct->name=NULL;
136  }
137  if (p_src->name) {
138  p_struct->name=strdup(p_src->name);
139  }
140 
141  /* member "flags" */
142  p_struct->flags=p_src->flags;
143 
144  /* member "type" */
145  p_struct->type=p_src->type;
146 
147  /* member "dataType" */
148  p_struct->dataType=p_src->dataType;
149 
150  /* member "shortDescription" */
151  if (p_struct->shortDescription) {
152  free(p_struct->shortDescription);
153  p_struct->shortDescription=NULL;
154  }
155  if (p_src->shortDescription) {
156  p_struct->shortDescription=strdup(p_src->shortDescription);
157  }
158 
159  /* member "longDescription" */
160  if (p_struct->longDescription) {
161  free(p_struct->longDescription);
162  p_struct->longDescription=NULL;
163  }
164  if (p_src->longDescription) {
165  p_struct->longDescription=strdup(p_src->longDescription);
166  }
167 
168  /* member "currentValue" */
169  if (p_struct->currentValue) {
170  free(p_struct->currentValue);
171  p_struct->currentValue=NULL;
172  }
173  if (p_src->currentValue) {
174  p_struct->currentValue=strdup(p_src->currentValue);
175  }
176 
177  /* member "defaultValue" */
178  if (p_struct->defaultValue) {
179  free(p_struct->defaultValue);
180  p_struct->defaultValue=NULL;
181  }
182  if (p_src->defaultValue) {
183  p_struct->defaultValue=strdup(p_src->defaultValue);
184  }
185 
186  /* member "choices" */
187  if (p_struct->choices) {
188  GWEN_StringList2_free(p_struct->choices);
189  p_struct->choices=NULL;
190  }
191  if (p_src->choices) {
192  p_struct->choices=GWEN_StringList2_dup(p_src->choices);
193  }
194 
195  /* member "internalIntValue" */
196  p_struct->internalIntValue=p_src->internalIntValue;
197 
198  /* member "internalFloatValue" */
199  p_struct->internalFloatValue=p_src->internalFloatValue;
200 
201  /* member "runtimeFlags" */
202  p_struct->runtimeFlags=p_src->runtimeFlags;
203 
204  return p_struct;
205 }
206 
207 GWEN_PARAM *GWEN_Param_copy(GWEN_PARAM *p_struct, const GWEN_PARAM *p_src) {
208  assert(p_struct);
209  assert(p_src);
210  /* member "name" */
211  if (p_struct->name) {
212  free(p_struct->name);
213  p_struct->name=NULL;
214  }
215  if (p_src->name) {
216  p_struct->name=strdup(p_src->name);
217  }
218 
219  /* member "flags" */
220  p_struct->flags=p_src->flags;
221 
222  /* member "type" */
223  p_struct->type=p_src->type;
224 
225  /* member "dataType" */
226  p_struct->dataType=p_src->dataType;
227 
228  /* member "shortDescription" */
229  if (p_struct->shortDescription) {
230  free(p_struct->shortDescription);
231  p_struct->shortDescription=NULL;
232  }
233  if (p_src->shortDescription) {
234  p_struct->shortDescription=strdup(p_src->shortDescription);
235  }
236 
237  /* member "longDescription" */
238  if (p_struct->longDescription) {
239  free(p_struct->longDescription);
240  p_struct->longDescription=NULL;
241  }
242  if (p_src->longDescription) {
243  p_struct->longDescription=strdup(p_src->longDescription);
244  }
245 
246  /* member "currentValue" */
247  if (p_struct->currentValue) {
248  free(p_struct->currentValue);
249  p_struct->currentValue=NULL;
250  }
251  if (p_src->currentValue) {
252  p_struct->currentValue=strdup(p_src->currentValue);
253  }
254 
255  /* member "defaultValue" */
256  if (p_struct->defaultValue) {
257  free(p_struct->defaultValue);
258  p_struct->defaultValue=NULL;
259  }
260  if (p_src->defaultValue) {
261  p_struct->defaultValue=strdup(p_src->defaultValue);
262  }
263 
264  /* member "choices" */
265  if (p_struct->choices) {
266  GWEN_StringList2_free(p_struct->choices);
267  p_struct->choices=NULL;
268  }
269  if (p_src->choices) {
270  p_struct->choices=GWEN_StringList2_dup(p_src->choices);
271  }
272 
273  /* member "internalIntValue" */
274  p_struct->internalIntValue=p_src->internalIntValue;
275 
276  /* member "internalFloatValue" */
277  p_struct->internalFloatValue=p_src->internalFloatValue;
278 
279  /* member "runtimeFlags" */
280  p_struct->runtimeFlags=p_src->runtimeFlags;
281 
282  return p_struct;
283 }
284 
285 const char *GWEN_Param_GetName(const GWEN_PARAM *p_struct) {
286  assert(p_struct);
287  return p_struct->name;
288 }
289 
290 uint32_t GWEN_Param_GetFlags(const GWEN_PARAM *p_struct) {
291  assert(p_struct);
292  return p_struct->flags;
293 }
294 
296  assert(p_struct);
297  return p_struct->type;
298 }
299 
301  assert(p_struct);
302  return p_struct->dataType;
303 }
304 
305 const char *GWEN_Param_GetShortDescription(const GWEN_PARAM *p_struct) {
306  assert(p_struct);
307  return p_struct->shortDescription;
308 }
309 
310 const char *GWEN_Param_GetLongDescription(const GWEN_PARAM *p_struct) {
311  assert(p_struct);
312  return p_struct->longDescription;
313 }
314 
315 const char *GWEN_Param_GetCurrentValue(const GWEN_PARAM *p_struct) {
316  assert(p_struct);
317  return p_struct->currentValue;
318 }
319 
320 const char *GWEN_Param_GetDefaultValue(const GWEN_PARAM *p_struct) {
321  assert(p_struct);
322  return p_struct->defaultValue;
323 }
324 
326  assert(p_struct);
327  return p_struct->choices;
328 }
329 
331  assert(p_struct);
332  return p_struct->internalIntValue;
333 }
334 
336  assert(p_struct);
337  return p_struct->internalFloatValue;
338 }
339 
340 uint32_t GWEN_Param_GetRuntimeFlags(const GWEN_PARAM *p_struct) {
341  assert(p_struct);
342  return p_struct->runtimeFlags;
343 }
344 
345 void GWEN_Param_SetName(GWEN_PARAM *p_struct, const char *p_src) {
346  assert(p_struct);
347  if (p_struct->name) {
348  free(p_struct->name);
349  }
350  if (p_src) {
351  p_struct->name=strdup(p_src);
352  }
353  else {
354  p_struct->name=NULL;
355  }
356 }
357 
358 void GWEN_Param_SetFlags(GWEN_PARAM *p_struct, uint32_t p_src) {
359  assert(p_struct);
360  p_struct->flags=p_src;
361 }
362 
363 void GWEN_Param_AddFlags(GWEN_PARAM *p_struct, uint32_t p_src) {
364  assert(p_struct);
365  p_struct->flags|=p_src;
366 }
367 
368 void GWEN_Param_SubFlags(GWEN_PARAM *p_struct, uint32_t p_src) {
369  assert(p_struct);
370  p_struct->flags&=~p_src;
371 }
372 
374  assert(p_struct);
375  p_struct->type=p_src;
376 }
377 
379  assert(p_struct);
380  p_struct->dataType=p_src;
381 }
382 
383 void GWEN_Param_SetShortDescription(GWEN_PARAM *p_struct, const char *p_src) {
384  assert(p_struct);
385  if (p_struct->shortDescription) {
386  free(p_struct->shortDescription);
387  }
388  if (p_src) {
389  p_struct->shortDescription=strdup(p_src);
390  }
391  else {
392  p_struct->shortDescription=NULL;
393  }
394 }
395 
396 void GWEN_Param_SetLongDescription(GWEN_PARAM *p_struct, const char *p_src) {
397  assert(p_struct);
398  if (p_struct->longDescription) {
399  free(p_struct->longDescription);
400  }
401  if (p_src) {
402  p_struct->longDescription=strdup(p_src);
403  }
404  else {
405  p_struct->longDescription=NULL;
406  }
407 }
408 
409 void GWEN_Param_SetCurrentValue(GWEN_PARAM *p_struct, const char *p_src) {
410  assert(p_struct);
411  if (p_struct->currentValue) {
412  free(p_struct->currentValue);
413  }
414  if (p_src) {
415  p_struct->currentValue=strdup(p_src);
416  }
417  else {
418  p_struct->currentValue=NULL;
419  }
420 }
421 
422 void GWEN_Param_SetDefaultValue(GWEN_PARAM *p_struct, const char *p_src) {
423  assert(p_struct);
424  if (p_struct->defaultValue) {
425  free(p_struct->defaultValue);
426  }
427  if (p_src) {
428  p_struct->defaultValue=strdup(p_src);
429  }
430  else {
431  p_struct->defaultValue=NULL;
432  }
433 }
434 
436  assert(p_struct);
437  if (p_struct->choices) {
438  GWEN_StringList2_free(p_struct->choices);
439  }
440  p_struct->choices=p_src;
441 }
442 
443 void GWEN_Param_SetInternalIntValue(GWEN_PARAM *p_struct, int p_src) {
444  assert(p_struct);
445  p_struct->internalIntValue=p_src;
446 }
447 
448 void GWEN_Param_SetInternalFloatValue(GWEN_PARAM *p_struct, double p_src) {
449  assert(p_struct);
450  p_struct->internalFloatValue=p_src;
451 }
452 
453 void GWEN_Param_SetRuntimeFlags(GWEN_PARAM *p_struct, uint32_t p_src) {
454  assert(p_struct);
455  p_struct->runtimeFlags=p_src;
456 }
457 
458 void GWEN_Param_AddRuntimeFlags(GWEN_PARAM *p_struct, uint32_t p_src) {
459  assert(p_struct);
460  p_struct->runtimeFlags|=p_src;
461 }
462 
463 void GWEN_Param_SubRuntimeFlags(GWEN_PARAM *p_struct, uint32_t p_src) {
464  assert(p_struct);
465  p_struct->runtimeFlags&=~p_src;
466 }
467 
468 /* list1 functions */
470  GWEN_PARAM_LIST *p_dest;
471  GWEN_PARAM *p_elem;
472 
473  assert(p_src);
474  p_dest=GWEN_Param_List_new();
475  p_elem=GWEN_Param_List_First(p_src);
476  while(p_elem) {
477  GWEN_PARAM *p_cpy;
478 
479  p_cpy=GWEN_Param_dup(p_elem);
480  GWEN_Param_List_Add(p_cpy, p_dest);
481  p_elem=GWEN_Param_List_Next(p_elem);
482  }
483 
484  return p_dest;
485 }
486 
487 void GWEN_Param_ReadDb(GWEN_PARAM *p_struct, GWEN_DB_NODE *p_db) {
488  assert(p_struct);
489  /* member "name" */
490  if (p_struct->name) {
491  free(p_struct->name);
492  }
493  { const char *s; s=GWEN_DB_GetCharValue(p_db, "name", 0, NULL); if (s) p_struct->name=strdup(s); }
494  if (p_struct->name==NULL) {
495  p_struct->name=NULL;
496  }
497 
498  /* member "flags" */
499  p_struct->flags=GWEN_DB_GetIntValue(p_db, "flags", 0, 0);
500 
501  /* member "type" */
502  { const char *s; s=GWEN_DB_GetCharValue(p_db, "type", 0, NULL); if (s) p_struct->type=GWEN_Param_Type_fromString(s); else p_struct->type=GWEN_Param_Type_Unknown; }
503 
504  /* member "dataType" */
505  { const char *s; s=GWEN_DB_GetCharValue(p_db, "dataType", 0, NULL); if (s) p_struct->dataType=GWEN_Param_DataType_fromString(s); else p_struct->dataType=GWEN_Param_DataType_Unknown; }
506 
507  /* member "shortDescription" */
508  if (p_struct->shortDescription) {
509  free(p_struct->shortDescription);
510  }
511  { const char *s; s=GWEN_DB_GetCharValue(p_db, "shortDescription", 0, NULL); if (s) p_struct->shortDescription=strdup(s); }
512  if (p_struct->shortDescription==NULL) {
513  p_struct->shortDescription=NULL;
514  }
515 
516  /* member "longDescription" */
517  if (p_struct->longDescription) {
518  free(p_struct->longDescription);
519  }
520  { const char *s; s=GWEN_DB_GetCharValue(p_db, "longDescription", 0, NULL); if (s) p_struct->longDescription=strdup(s); }
521  if (p_struct->longDescription==NULL) {
522  p_struct->longDescription=NULL;
523  }
524 
525  /* member "currentValue" */
526  if (p_struct->currentValue) {
527  free(p_struct->currentValue);
528  }
529  { const char *s; s=GWEN_DB_GetCharValue(p_db, "currentValue", 0, NULL); if (s) p_struct->currentValue=strdup(s); }
530  if (p_struct->currentValue==NULL) {
531  p_struct->currentValue=NULL;
532  }
533 
534  /* member "defaultValue" */
535  if (p_struct->defaultValue) {
536  free(p_struct->defaultValue);
537  }
538  { const char *s; s=GWEN_DB_GetCharValue(p_db, "defaultValue", 0, NULL); if (s) p_struct->defaultValue=strdup(s); }
539  if (p_struct->defaultValue==NULL) {
540  p_struct->defaultValue=NULL;
541  }
542 
543  /* member "choices" */
544  if (p_struct->choices) {
545  GWEN_StringList2_free(p_struct->choices);
546  }
547  { p_struct->choices=GWEN_StringList2_fromDb(p_db, "choices", GWEN_StringList2_IntertMode_AlwaysAdd); }
548  if (p_struct->choices==NULL) {
549  p_struct->choices=NULL;
550  }
551 
552  /* member "internalIntValue" */
553  /* member "internalIntValue" is volatile, just presetting */
554  p_struct->internalIntValue=0;
555 
556  /* member "internalFloatValue" */
557  /* member "internalFloatValue" is volatile, just presetting */
558  p_struct->internalFloatValue=0;
559 
560  /* member "runtimeFlags" */
561  /* member "runtimeFlags" is volatile, just presetting */
562  p_struct->runtimeFlags=0;
563 
564 }
565 
566 int GWEN_Param_WriteDb(const GWEN_PARAM *p_struct, GWEN_DB_NODE *p_db) {
567  int p_rv;
568 
569  assert(p_struct);
570  /* member "name" */
571  if (p_struct->name) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "name", p_struct->name);
572  else { GWEN_DB_DeleteVar(p_db, "name"); p_rv=0; }
573  if (p_rv<0) {
574  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
575  return p_rv;
576  }
577 
578  /* member "flags" */
579  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "flags", p_struct->flags);
580  if (p_rv<0) {
581  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
582  return p_rv;
583  }
584 
585  /* member "type" */
587  if (p_rv<0) {
588  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
589  return p_rv;
590  }
591 
592  /* member "dataType" */
593  p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "dataType", GWEN_Param_DataType_toString(p_struct->dataType));
594  if (p_rv<0) {
595  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
596  return p_rv;
597  }
598 
599  /* member "shortDescription" */
600  if (p_struct->shortDescription) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "shortDescription", p_struct->shortDescription);
601  else { GWEN_DB_DeleteVar(p_db, "shortDescription"); p_rv=0; }
602  if (p_rv<0) {
603  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
604  return p_rv;
605  }
606 
607  /* member "longDescription" */
608  if (p_struct->longDescription) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "longDescription", p_struct->longDescription);
609  else { GWEN_DB_DeleteVar(p_db, "longDescription"); p_rv=0; }
610  if (p_rv<0) {
611  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
612  return p_rv;
613  }
614 
615  /* member "currentValue" */
616  if (p_struct->currentValue) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "currentValue", p_struct->currentValue);
617  else { GWEN_DB_DeleteVar(p_db, "currentValue"); p_rv=0; }
618  if (p_rv<0) {
619  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
620  return p_rv;
621  }
622 
623  /* member "defaultValue" */
624  if (p_struct->defaultValue) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "defaultValue", p_struct->defaultValue);
625  else { GWEN_DB_DeleteVar(p_db, "defaultValue"); p_rv=0; }
626  if (p_rv<0) {
627  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
628  return p_rv;
629  }
630 
631  /* member "choices" */
632  if (p_struct->choices) { p_rv=GWEN_StringList2_toDb(p_struct->choices, p_db, "choices"); }
633  else { GWEN_DB_DeleteVar(p_db, "choices"); p_rv=0; }
634  if (p_rv<0) {
635  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
636  return p_rv;
637  }
638 
639  /* member "internalIntValue" is volatile, not writing to db */
640 
641  /* member "internalFloatValue" is volatile, not writing to db */
642 
643  /* member "runtimeFlags" is volatile, not writing to db */
644 
645  return 0;
646 }
647 
649  GWEN_PARAM *p_struct;
650  p_struct=GWEN_Param_new();
651  GWEN_Param_ReadDb(p_struct, p_db);
652  return p_struct;
653 }
654 
655 int GWEN_Param_toDb(const GWEN_PARAM *p_struct, GWEN_DB_NODE *p_db) {
656  return GWEN_Param_WriteDb(p_struct, p_db);
657 }
658 
660  assert(p_struct);
661  /* member "name" */
662  if (p_struct->name) {
663  free(p_struct->name);
664  }
665  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "name", NULL); if (s) p_struct->name=strdup(s); }
666  if (p_struct->name==NULL) { /* member "name" is volatile, just presetting */
667  p_struct->name=NULL;
668  }
669 
670  /* member "flags" */
671  p_struct->flags=GWEN_XMLNode_GetIntValue(p_db, "flags", 0);
672 
673  /* member "type" */
674  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "type", NULL); if (s) p_struct->type=GWEN_Param_Type_fromString(s); else p_struct->type=GWEN_Param_Type_Unknown; }
675 
676  /* member "dataType" */
677  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "dataType", NULL); if (s) p_struct->dataType=GWEN_Param_DataType_fromString(s); else p_struct->dataType=GWEN_Param_DataType_Unknown; }
678 
679  /* member "shortDescription" */
680  if (p_struct->shortDescription) {
681  free(p_struct->shortDescription);
682  }
683  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "shortDescription", NULL); if (s) p_struct->shortDescription=strdup(s); }
684  if (p_struct->shortDescription==NULL) { /* member "shortDescription" is volatile, just presetting */
685  p_struct->shortDescription=NULL;
686  }
687 
688  /* member "longDescription" */
689  if (p_struct->longDescription) {
690  free(p_struct->longDescription);
691  }
692  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "longDescription", NULL); if (s) p_struct->longDescription=strdup(s); }
693  if (p_struct->longDescription==NULL) { /* member "longDescription" is volatile, just presetting */
694  p_struct->longDescription=NULL;
695  }
696 
697  /* member "currentValue" */
698  if (p_struct->currentValue) {
699  free(p_struct->currentValue);
700  }
701  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "currentValue", NULL); if (s) p_struct->currentValue=strdup(s); }
702  if (p_struct->currentValue==NULL) { /* member "currentValue" is volatile, just presetting */
703  p_struct->currentValue=NULL;
704  }
705 
706  /* member "defaultValue" */
707  if (p_struct->defaultValue) {
708  free(p_struct->defaultValue);
709  }
710  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "defaultValue", NULL); if (s) p_struct->defaultValue=strdup(s); }
711  if (p_struct->defaultValue==NULL) { /* member "defaultValue" is volatile, just presetting */
712  p_struct->defaultValue=NULL;
713  }
714 
715  /* member "choices" */
716  if (p_struct->choices) {
717  GWEN_StringList2_free(p_struct->choices);
718  }
719  { GWEN_XMLNODE *n; n=GWEN_XMLNode_FindFirstTag(p_db, "choices", 0, 0); if(n) { p_struct->choices=GWEN_StringList2_fromXml(n, GWEN_StringList2_IntertMode_AlwaysAdd); } else p_struct->choices=NULL; }
720  if (p_struct->choices==NULL) { /* member "choices" is volatile, just presetting */
721  p_struct->choices=NULL;
722  }
723 
724  /* member "internalIntValue" */
725  /* member "internalIntValue" is volatile, just presetting */
726  p_struct->internalIntValue=0;
727 
728  /* member "internalFloatValue" */
729  /* member "internalFloatValue" is volatile, just presetting */
730  p_struct->internalFloatValue=0;
731 
732  /* member "runtimeFlags" */
733  /* member "runtimeFlags" is volatile, just presetting */
734  p_struct->runtimeFlags=0;
735 
736 }
737 
738 void GWEN_Param_WriteXml(const GWEN_PARAM *p_struct, GWEN_XMLNODE *p_db) {
739  assert(p_struct);
740  /* member "name" */
741  GWEN_XMLNode_SetCharValue(p_db, "name", p_struct->name);
742 
743  /* member "flags" */
744  GWEN_XMLNode_SetIntValue(p_db, "flags", p_struct->flags);
745 
746  /* member "type" */
747  GWEN_XMLNode_SetCharValue(p_db, "type", GWEN_Param_Type_toString(p_struct->type));
748 
749  /* member "dataType" */
750  GWEN_XMLNode_SetCharValue(p_db, "dataType", GWEN_Param_DataType_toString(p_struct->dataType));
751 
752  /* member "shortDescription" */
753  GWEN_XMLNode_SetCharValue(p_db, "shortDescription", p_struct->shortDescription);
754 
755  /* member "longDescription" */
756  GWEN_XMLNode_SetCharValue(p_db, "longDescription", p_struct->longDescription);
757 
758  /* member "currentValue" */
759  GWEN_XMLNode_SetCharValue(p_db, "currentValue", p_struct->currentValue);
760 
761  /* member "defaultValue" */
762  GWEN_XMLNode_SetCharValue(p_db, "defaultValue", p_struct->defaultValue);
763 
764  /* member "choices" */
765  if (p_struct->choices) { GWEN_XMLNODE *n; n=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "choices"); GWEN_StringList2_toXml(p_struct->choices, n); GWEN_XMLNode_AddChild(p_db, n); }
766 
767  /* member "internalIntValue" is volatile, not writing to xml */
768 
769  /* member "internalFloatValue" is volatile, not writing to xml */
770 
771  /* member "runtimeFlags" is volatile, not writing to xml */
772 
773 }
774 
775 void GWEN_Param_toXml(const GWEN_PARAM *p_struct, GWEN_XMLNODE *p_db) {
776  GWEN_Param_WriteXml(p_struct, p_db);
777 }
778 
780  GWEN_PARAM *p_struct;
781  p_struct=GWEN_Param_new();
782  GWEN_Param_ReadXml(p_struct, p_db);
783  return p_struct;
784 }
785 
786 GWEN_PARAM *GWEN_Param_List_GetByName(const GWEN_PARAM_LIST *p_list, const char *p_cmp) {
787  GWEN_PARAM *p_struct;
788 
789  assert(p_list);
790  p_struct = GWEN_Param_List_First(p_list);
791  while(p_struct) {
792  int p_rv;
793 
794  if (p_struct->name && p_cmp) p_rv=strcasecmp(p_cmp, p_struct->name);
795  else if (p_cmp) p_rv=1;
796  else if (p_struct->name) p_rv=-1;
797  else p_rv=0;
798  if (p_rv == 0)
799  return p_struct;
800  p_struct = GWEN_Param_List_Next(p_struct);
801  }
802  return NULL;
803 }
804 
805 GWEN_PARAM *GWEN_Param_Tree_GetByName(const GWEN_PARAM_TREE *p_tree, const char *p_cmp) {
806  GWEN_PARAM *p_struct;
807 
808  assert(p_tree);
809  p_struct = GWEN_Param_Tree_GetFirst(p_tree);
810  while(p_struct) {
811  int p_rv;
812 
813  if (p_struct->name && p_cmp) p_rv=strcasecmp(p_cmp, p_struct->name);
814  else if (p_cmp) p_rv=1;
815  else if (p_struct->name) p_rv=-1;
816  else p_rv=0;
817  if (p_rv == 0)
818  return p_struct;
819  p_struct = GWEN_Param_Tree_GetBelow(p_struct);
820  }
821  return NULL;
822 }
823 
824 
825 /* code headers */
826 #include "param_fns.c"
827 
GWEN_PARAM_DATATYPE GWEN_Param_DataType_fromString(const char *p_s)
Definition: param.c:25
GWEN_PARAM * GWEN_Param_List_First(const GWEN_PARAM_LIST *l)
int GWEN_StringList2_toDb(GWEN_STRINGLIST2 *sl2, GWEN_DB_NODE *db, const char *name)
Definition: stringlist2.c:83
GWEN_PARAM * GWEN_Param_dup(const GWEN_PARAM *p_src)
Definition: param.c:127
#define GWEN_DB_FLAGS_OVERWRITE_VARS
Definition: db.h:121
struct GWEN_DB_NODE GWEN_DB_NODE
Definition: db.h:228
void GWEN_Param_SubFlags(GWEN_PARAM *p_struct, uint32_t p_src)
Definition: param.c:368
GWEN_PARAM_DATATYPE GWEN_Param_GetDataType(const GWEN_PARAM *p_struct)
Definition: param.c:300
const char * GWEN_Param_GetDefaultValue(const GWEN_PARAM *p_struct)
Definition: param.c:320
const char * GWEN_Param_Type_toString(GWEN_PARAM_TYPE p_i)
Definition: param.c:64
GWEN_STRINGLIST2 * GWEN_StringList2_dup(GWEN_STRINGLIST2 *sl2)
Definition: stringlist2.c:71
GWEN_PARAM_TYPE GWEN_Param_GetType(const GWEN_PARAM *p_struct)
Definition: param.c:295
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:92
#define NULL
Definition: binreloc.c:290
void GWEN_Param_SetDataType(GWEN_PARAM *p_struct, GWEN_PARAM_DATATYPE p_src)
Definition: param.c:378
void GWEN_Param_SetType(GWEN_PARAM *p_struct, GWEN_PARAM_TYPE p_src)
Definition: param.c:373
void GWEN_Param_toXml(const GWEN_PARAM *p_struct, GWEN_XMLNODE *p_db)
Definition: param.c:775
struct GWEN_PARAM GWEN_PARAM
Definition: param.h:34
int GWEN_StringList2_toXml(GWEN_STRINGLIST2 *sl2, GWEN_XMLNODE *node)
Definition: stringlist2.c:133
double GWEN_Param_GetInternalFloatValue(const GWEN_PARAM *p_struct)
Definition: param.c:335
GWEN_PARAM_TYPE
Definition: param.h:49
void GWEN_Param_AddFlags(GWEN_PARAM *p_struct, uint32_t p_src)
Definition: param.c:363
void GWEN_XMLNode_SetCharValue(GWEN_XMLNODE *n, const char *name, const char *value)
Definition: xml.c:812
#define GWEN_LOGDOMAIN
Definition: logger.h:35
const char * GWEN_Param_DataType_toString(GWEN_PARAM_DATATYPE p_i)
Definition: param.c:49
GWEN_STRINGLIST2 * GWEN_StringList2_fromXml(GWEN_XMLNODE *node, GWEN_STRINGLIST2_INSERTMODE m)
Definition: stringlist2.c:153
GWEN_PARAM * GWEN_Param_fromXml(GWEN_XMLNODE *p_db)
Definition: param.c:779
GWEN_XMLNODE * GWEN_XMLNode_new(GWEN_XMLNODE_TYPE t, const char *data)
Definition: xml.c:137
int GWEN_XMLNode_GetIntValue(const GWEN_XMLNODE *n, const char *name, int defValue)
Definition: xml.c:837
void GWEN_Param_AddRuntimeFlags(GWEN_PARAM *p_struct, uint32_t p_src)
Definition: param.c:458
GWEN_XMLNODE * GWEN_XMLNode_FindFirstTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
Definition: xml.c:695
void GWEN_Param_free(GWEN_PARAM *p_struct)
Definition: param.c:100
GWEN_PARAM * GWEN_Param_Tree_GetByName(const GWEN_PARAM_TREE *p_tree, const char *p_cmp)
Definition: param.c:805
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:86
void GWEN_Param_SubRuntimeFlags(GWEN_PARAM *p_struct, uint32_t p_src)
Definition: param.c:463
const char * GWEN_XMLNode_GetCharValue(const GWEN_XMLNODE *n, const char *name, const char *defValue)
Definition: xml.c:729
GWEN_STRINGLIST2 * GWEN_Param_GetChoices(const GWEN_PARAM *p_struct)
Definition: param.c:325
GWEN_PARAM_LIST * GWEN_Param_List_dup(const GWEN_PARAM_LIST *p_src)
Definition: param.c:469
void GWEN_StringList2_free(GWEN_STRINGLIST2 *sl2)
Definition: stringlist2.c:62
#define GWEN_TREE_FINI(t, element)
Definition: tree.h:554
GWEN_PARAM * GWEN_Param_new(void)
Definition: param.c:75
void GWEN_Param_SetLongDescription(GWEN_PARAM *p_struct, const char *p_src)
Definition: param.c:396
void GWEN_Param_SetInternalFloatValue(GWEN_PARAM *p_struct, double p_src)
Definition: param.c:448
GWEN_PARAM * GWEN_Param_List_Next(const GWEN_PARAM *element)
GWEN_PARAM * GWEN_Param_fromDb(GWEN_DB_NODE *p_db)
Definition: param.c:648
void GWEN_Param_ReadXml(GWEN_PARAM *p_struct, GWEN_XMLNODE *p_db)
Definition: param.c:659
const char * GWEN_DB_GetCharValue(GWEN_DB_NODE *n, const char *path, int idx, const char *defVal)
Definition: db.c:897
uint32_t GWEN_Param_GetFlags(const GWEN_PARAM *p_struct)
Definition: param.c:290
int GWEN_DB_DeleteVar(GWEN_DB_NODE *n, const char *path)
Definition: db.c:828
GWEN_PARAM_LIST * GWEN_Param_List_new()
GWEN_LIST2_FUNCTIONS(TYPEMAKER2_TYPE, Typemaker2_Type)
void GWEN_Param_Attach(GWEN_PARAM *p_struct)
Definition: param.c:121
int GWEN_Param_GetInternalIntValue(const GWEN_PARAM *p_struct)
Definition: param.c:330
const char * GWEN_Param_GetName(const GWEN_PARAM *p_struct)
Definition: param.c:285
void GWEN_Param_SetCurrentValue(GWEN_PARAM *p_struct, const char *p_src)
Definition: param.c:409
GWEN_PARAM_DATATYPE
Definition: param.h:40
void GWEN_Param_SetDefaultValue(GWEN_PARAM *p_struct, const char *p_src)
Definition: param.c:422
int GWEN_Param_toDb(const GWEN_PARAM *p_struct, GWEN_DB_NODE *p_db)
Definition: param.c:655
struct GWEN_STRINGLIST2 GWEN_STRINGLIST2
Definition: stringlist2.h:43
int GWEN_DB_SetCharValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, const char *val)
Definition: db.c:922
GWEN_PARAM_TYPE GWEN_Param_Type_fromString(const char *p_s)
Definition: param.c:39
#define DBG_INFO(dbg_logger, format, args...)
Definition: debug.h:164
#define GWEN_TREE_INIT(t, element)
Definition: tree.h:545
#define GWEN_LIST_INIT(t, element)
Definition: list1.h:465
const char * GWEN_Param_GetCurrentValue(const GWEN_PARAM *p_struct)
Definition: param.c:315
GWEN_PARAM * GWEN_Param_copy(GWEN_PARAM *p_struct, const GWEN_PARAM *p_src)
Definition: param.c:207
int GWEN_DB_GetIntValue(GWEN_DB_NODE *n, const char *path, int idx, int defVal)
Definition: db.c:1048
void GWEN_Param_SetInternalIntValue(GWEN_PARAM *p_struct, int p_src)
Definition: param.c:443
void GWEN_Param_SetFlags(GWEN_PARAM *p_struct, uint32_t p_src)
Definition: param.c:358
void GWEN_Param_SetChoices(GWEN_PARAM *p_struct, GWEN_STRINGLIST2 *p_src)
Definition: param.c:435
const char * GWEN_Param_GetLongDescription(const GWEN_PARAM *p_struct)
Definition: param.c:310
void GWEN_Param_SetShortDescription(GWEN_PARAM *p_struct, const char *p_src)
Definition: param.c:383
int GWEN_DB_SetIntValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, int val)
Definition: db.c:1086
#define GWEN_LIST_FUNCTIONS(t, pr)
Definition: list1.h:366
void GWEN_Param_List_Add(GWEN_PARAM *element, GWEN_PARAM_LIST *list)
const char * GWEN_Param_GetShortDescription(const GWEN_PARAM *p_struct)
Definition: param.c:305
uint32_t GWEN_Param_GetRuntimeFlags(const GWEN_PARAM *p_struct)
Definition: param.c:340
int GWEN_Param_WriteDb(const GWEN_PARAM *p_struct, GWEN_DB_NODE *p_db)
Definition: param.c:566
void GWEN_Param_SetName(GWEN_PARAM *p_struct, const char *p_src)
Definition: param.c:345
void GWEN_Param_ReadDb(GWEN_PARAM *p_struct, GWEN_DB_NODE *p_db)
Definition: param.c:487
#define GWEN_LIST_FINI(t, element)
Definition: list1.h:474
struct GWEN__XMLNODE GWEN_XMLNODE
Definition: xml.h:148
GWEN_PARAM * GWEN_Param_List_GetByName(const GWEN_PARAM_LIST *p_list, const char *p_cmp)
Definition: param.c:786
void GWEN_Param_WriteXml(const GWEN_PARAM *p_struct, GWEN_XMLNODE *p_db)
Definition: param.c:738
void GWEN_Param_SetRuntimeFlags(GWEN_PARAM *p_struct, uint32_t p_src)
Definition: param.c:453
GWEN_STRINGLIST2 * GWEN_StringList2_fromDb(GWEN_DB_NODE *db, const char *name, GWEN_STRINGLIST2_INSERTMODE m)
Definition: stringlist2.c:114
#define GWEN_TREE_FUNCTIONS(t, pr)
Definition: tree.h:393
void GWEN_XMLNode_AddChild(GWEN_XMLNODE *n, GWEN_XMLNODE *child)
Definition: xml.c:398
void GWEN_XMLNode_SetIntValue(GWEN_XMLNODE *n, const char *name, int value)
Definition: xml.c:853