Config.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of FZIs ic_workspace.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12 //
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
26 //----------------------------------------------------------------------
27 #ifndef ICL_CORE_CONFIG_CONFIG_H_INCLUDED
28 #define ICL_CORE_CONFIG_CONFIG_H_INCLUDED
29 
30 #include <boost/foreach.hpp>
31 
32 #include <icl_core/BaseTypes.h>
33 #include <icl_core/EnumHelper.h>
34 #include <icl_core/StringHelper.h>
37 
45 #include "icl_core_config/Util.h"
46 
47 #ifdef _IC_BUILDER_OPENSPLICEDDS_
48 # include "dds_dcps.h"
49 #endif
50 
51 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
52 
53 // -- START Deprecated compatibility headers --
60 // -- END Deprecated compatibility headers --
61 
62 # include "icl_core/Deprecate.h"
63 #endif
64 
65 namespace icl_core {
67 namespace config {
68 
70 
72 
73 ICL_CORE_CONFIG_IMPORT_EXPORT void debugOutCommandLine(int argc, char *argv[]);
74 
76 
78 template <typename T>
79 bool get(const icl_core::String& key, typename icl_core::ConvertToRef<T>::ToRef value);
80 
82 template <typename T>
83 bool get(const char *key, typename icl_core::ConvertToRef<T>::ToRef value)
84 {
85  return get<T>(icl_core::String(key), value);
86 }
87 
89 template <typename T>
90 bool get(const icl_core::String& key, typename icl_core::ConvertToRef<T>::ToRef value)
91 {
92  icl_core::String str_value;
93  if (ConfigManager::instance().get(key, str_value))
94  {
95  try
96  {
97  value = impl::hexical_cast<T>(str_value);
98  return true;
99  }
100  catch (...)
101  {
102  return false;
103  }
104  }
105  else
106  {
107  return false;
108  }
109 }
110 
112 template <>
113 inline
114 bool get<icl_core::String>(const icl_core::String& key, icl_core::String& value)
115 {
116  return ConfigManager::instance().get(key, value);
117 }
118 
120 template <>
121 inline
122 bool get<bool>(const icl_core::String& key, bool& value)
123 {
124  icl_core::String str_value;
125  if (ConfigManager::instance().get(key, str_value))
126  {
127  str_value = toLower(str_value);
128  if (str_value == "0" || str_value == "no" || str_value == "false")
129  {
130  value = false;
131  return true;
132  }
133  else if (str_value == "1" || str_value == "yes" || str_value == "true")
134  {
135  value = true;
136  return true;
137  }
138  else
139  {
140  return false;
141  }
142  }
143  else
144  {
145  return false;
146  }
147 }
148 
149 #ifdef _IC_BUILDER_OPENSPLICEDDS_
150 template<>
152 inline
153 bool get<DDS::String>(const icl_core::String& key, DDS::String& value)
154 {
155  icl_core::String str_value;
156  if (ConfigManager::instance().get(key, str_value))
157  {
158  value = DDS::string_dup(str_value.c_str());
159  return true;
160  }
161  else
162  {
163  return false;
164  }
165 }
166 #endif
167 
168 template <typename T>
169 bool get(const icl_core::String& key, typename icl_core::ConvertToRef<T>::ToRef value,
170  const char *descriptions[], const char *end_marker = NULL)
171 {
172  icl_core::String str_value;
173  if (ConfigManager::instance().get(key, str_value))
174  {
175  int32_t raw_value;
176  if (icl_core::string2Enum(str_value, raw_value, descriptions, end_marker))
177  {
178  value = T(raw_value);
179  return true;
180  }
181  else
182  {
183  return false;
184  }
185  }
186  else
187  {
188  return false;
189  }
190 }
191 
192 template <typename T>
193 bool get(const char *key, typename icl_core::ConvertToRef<T>::ToRef value,
194  const char *descriptions[], const char *end_marker = NULL)
195 {
196  return get<T>(icl_core::String(key), value, descriptions, end_marker);
197 }
198 
199 template <typename T>
201 {
202  T value = default_value;
203  get<T> (key, value);
204  return value;
205 }
206 
207 template <typename T>
208 T getDefault(const char *key, typename icl_core::ConvertToRef<T>::ToConstRef default_value)
209 {
210  return getDefault<T> (icl_core::String(key), default_value);
211 }
212 
213 template <> inline
214 icl_core::String getDefault<icl_core::String>(const icl_core::String& key,
215  const icl_core::String& default_value)
216 {
217  icl_core::String value = default_value;
218  get<icl_core::String>(key, value);
219  return value;
220 }
221 
222 #ifdef _IC_BUILDER_OPENSPLICEDDS_
223 template<>
224 inline
225 DDS::String getDefault<DDS::String>(const icl_core::String& key,
226  const DDS::String& default_value)
227 {
228  DDS::String value = default_value;
229  get<DDS::String>(key, value);
230  return value;
231 }
232 #endif
233 
240 inline
241 bool get(const ConfigValues config_values, icl_core::logging::LogStream& log_stream,
242  bool cleanup = true, bool report_error = true)
243 {
244  // Read the configuration parameters.
245  bool result = true;
246  const impl::ConfigValueIface *const*config = config_values;
247  while (*config != NULL)
248  {
249  if ((*config)->get())
250  {
251  SLOGGING_TRACE(log_stream, "Read configuration parameter \""
252  << (*config)->key() << "\" = \"" << (*config)->stringValue()
253  << "\"." << icl_core::logging::endl);
254  }
255  else
256  {
257  if (report_error)
258  {
259  SLOGGING_ERROR(log_stream, "Error reading configuration parameter \""
260  << (*config)->key() << "\"!" << icl_core::logging::endl);
261  }
262  else
263  {
264  SLOGGING_TRACE(log_stream, "Could not read configuration parameter \""
265  << (*config)->key() << "\"." << icl_core::logging::endl);
266  }
267  result = false;
268  }
269  ++config;
270  }
271 
272  // Cleanup!
273  if (cleanup)
274  {
275  config = config_values;
276  while (*config != NULL)
277  {
278  delete *config;
279  ++config;
280  }
281  }
282 
283  return result;
284 }
285 
292 inline
293 bool get(std::string config_prefix,
294  ConfigValueList config_values, icl_core::logging::LogStream& log_stream,
295  bool cleanup = true, bool report_error = true)
296 {
297  /* Remark: config_values has to be passed by value, not by reference.
298  * Otherwise boost::assign::list_of() can not work correctly.
299  */
300 
301  // Add a trailing slash, if necessary.
302  if (config_prefix != "" && config_prefix[config_prefix.length() - 1] != '/')
303  {
304  config_prefix = config_prefix + "/";
305  }
306 
307  // Read the configuration parameters.
308  bool result = false;
309  bool error = false;
310  BOOST_FOREACH(impl::ConfigValueIface const * config, config_values)
311  {
312  if (config->get(config_prefix, log_stream))
313  {
314  SLOGGING_TRACE(log_stream, "Read configuration parameter \""
315  << config_prefix << config->key() << "\" = \"" << config->stringValue()
316  << "\"." << icl_core::logging::endl);
317  }
318  else
319  {
320  if (report_error)
321  {
322  SLOGGING_ERROR(log_stream, "Error reading configuration parameter \""
323  << config_prefix << config->key() << "\"!" << icl_core::logging::endl);
324  }
325  else
326  {
327  SLOGGING_TRACE(log_stream, "Could not read configuration parameter \""
328  << config_prefix << config->key() << "\"." << icl_core::logging::endl);
329  }
330  error = true;
331  }
332  result = true;
333  }
334 
335  if (error)
336  {
337  result = false;
338  }
339 
340  // Cleanup!
341  if (cleanup)
342  {
343  BOOST_FOREACH(impl::ConfigValueIface * config, config_values)
344  {
345  delete config;
346  }
347  }
348 
349  return result;
350 }
351 
352 inline
353 bool get(ConfigValueList config_values, icl_core::logging::LogStream& log_stream,
354  bool cleanup = true, bool report_error = true)
355 {
356  return get("", config_values, log_stream, cleanup, report_error);
357 }
358 
359 template <typename T>
361 {
362  ConfigManager::instance().setValue<T>(key, value);
363 }
364 
365 template <typename T>
366 void setValue(const char *key, typename icl_core::ConvertToRef<T>::ToConstRef value)
367 {
369 }
370 
371 inline
372 void setValue(const icl_core::String& key, const icl_core::String& value)
373 {
374  setValue<icl_core::String>(key, value);
375 }
376 
377 inline
379 {
380  return Getopt::instance().paramOptPresent(name);
381 }
382 
383 template <typename T>
385 {
386  Getopt& getopt = Getopt::instance();
387  if (getopt.paramOptPresent(name))
388  {
389  try
390  {
391  value = impl::hexical_cast<T>(getopt.paramOpt(name));
392  return true;
393  }
394  catch (...)
395  {
396  return false;
397  }
398  }
399  else
400  {
401  return false;
402  }
403 }
404 template <typename T>
405 bool paramOpt(const char *name, typename icl_core::ConvertToRef<T>::ToRef value)
406 {
407  return paramOpt<T>(icl_core::String(name), value);
408 }
409 
410 template <typename T>
412  const char *descriptions[], const char *end_marker = NULL)
413 {
414  Getopt& getopt = Getopt::instance();
415  if (getopt.paramOptPresent(name))
416  {
417  icl_core::String str_value = getopt.paramOpt(name);
418  int32_t raw_value;
419  if (icl_core::string2Enum(str_value, raw_value, descriptions, end_marker))
420  {
421  value = T(raw_value);
422  return true;
423  }
424  else
425  {
426  return false;
427  }
428  }
429  else
430  {
431  return false;
432  }
433 }
434 
435 template <typename T>
436 bool paramOpt(const char *name, typename icl_core::ConvertToRef<T>::ToRef value,
437  const char *descriptions[], const char *end_marker = NULL)
438 {
439  return paramOpt<T>(icl_core::String(name), value, descriptions, end_marker);
440 }
441 
442 template <typename T>
444 {
445  Getopt& getopt = Getopt::instance();
446  if (getopt.paramOptPresent(name))
447  {
448  try
449  {
450  return impl::hexical_cast<T>(getopt.paramOpt(name));
451  }
452  catch (...)
453  {
454  return default_value;
455  }
456  }
457  else
458  {
459  return default_value;
460  }
461 }
462 
463 template <typename T>
464 T paramOptDefault(const char *name, typename icl_core::ConvertToRef<T>::ToConstRef default_value)
465 {
466  return paramOptDefault<T>(icl_core::String(name), default_value);
467 }
468 
469 template <typename T>
470 bool paramNonOpt(size_t index, typename icl_core::ConvertToRef<T>::ToRef value)
471 {
472  Getopt& getopt = Getopt::instance();
473  if (index < getopt.paramNonOptCount())
474  {
475  try
476  {
477  value = impl::hexical_cast<T>(getopt.paramNonOpt(index));
478  return true;
479  }
480  catch (...)
481  {
482  return false;
483  }
484  }
485  else
486  {
487  return false;
488  }
489 }
490 
491 template <typename T>
492 bool paramNonOpt(size_t index, typename icl_core::ConvertToRef<T>::ToRef value,
493  const char *descriptions[], const char *end_marker = NULL)
494 {
495  Getopt& getopt = Getopt::instance();
496  if (index < getopt.paramNonOptCount())
497  {
498  icl_core::String str_value = getopt.paramNonOpt(index);
499  int32_t raw_value;
500  if (icl_core::string2Enum(str_value, raw_value, descriptions, end_marker))
501  {
502  value = T(raw_value);
503  return true;
504  }
505  else
506  {
507  return false;
508  }
509  }
510  else
511  {
512  return false;
513  }
514 }
515 
516 inline icl_core::String paramNonOpt(size_t index)
517 {
518  return Getopt::instance().paramNonOpt(index);
519 }
520 
521 inline size_t extraCmdParamCount()
522 {
524 }
525 
526 inline icl_core::String extraCmdParam(size_t index)
527 {
528  return Getopt::instance().extraCmdParam(index);
529 }
530 
531 inline void activateExtraCmdParams(const icl_core::String& delimiter = "--")
532 {
534 }
535 
536 inline size_t paramNonOptCount()
537 {
539 }
540 
541 inline void addParameter(const ConfigParameter& parameter)
542 {
544 }
545 
546 inline void addParameter(const ConfigParameterList& parameters)
547 {
549 }
550 
551 inline void addParameter(const ConfigPositionalParameter& parameter)
552 {
554 }
555 
556 inline void addParameter(const ConfigPositionalParameterList& parameters)
557 {
559 }
560 
561 inline void addParameter(const GetoptParameter& parameter)
562 {
563  Getopt::instance().addParameter(parameter);
564 }
565 
566 inline void addParameter(const GetoptParameterList& parameters)
567 {
568  Getopt::instance().addParameter(parameters);
569 }
570 
571 inline void addParameter(const GetoptPositionalParameter& parameter)
572 {
573  Getopt::instance().addParameter(parameter);
574 }
575 
576 inline void addParameter(const GetoptPositionalParameterList& parameters)
577 {
578  Getopt::instance().addParameter(parameters);
579 }
580 
581 inline void setProgramVersion(icl_core::String const & version)
582 {
584 }
585 
586 inline void setProgramDescription(icl_core::String const & description)
587 {
589 }
590 
591 inline void printHelp()
592 {
594 }
595 
596 ICL_CORE_CONFIG_IMPORT_EXPORT bool initialize(int& argc, char *argv[], bool remove_read_arguments);
597 
599 bool initialize(int& argc, char *argv[],
602 
604 //#ifdef _IC_BUILDER_DEPRECATED_STYLE_
605 
607 void Dump()
609 inline void Dump()
610 { dump(); }
611 
613 void DebugOutCommandLine(int argc, char *argv[])
615 inline void DebugOutCommandLine(int argc, char *argv[])
616 { debugOutCommandLine(argc, argv); }
617 
622 { return find(query); }
623 
627 template <typename T>
628 bool Get(const icl_core::String& key,
630 
634 template <typename T>
635 bool Get(const char *key, typename icl_core::ConvertToRef<T>::ToRef value) ICL_CORE_GCC_DEPRECATE_STYLE;
636 template <typename T>
638 { return get<T>(key, value); }
639 
643 template <typename T>
644 bool Get(const icl_core::String& key,
645  typename icl_core::ConvertToRef<T>::ToRef value)
647 template <typename T> inline
649  typename icl_core::ConvertToRef<T>::ToRef value)
650 { return get<T>(key, value); }
651 
655 template <>
656 bool Get<icl_core::String>(const icl_core::String& key,
657  icl_core::String& value)
658 ICL_CORE_GCC_DEPRECATE_STYLE;
659 template <> inline
660 ICL_CORE_VC_DEPRECATE_STYLE bool Get<icl_core::String>(const icl_core::String& key,
661  icl_core::String& value)
662 { return get<icl_core::String>(key, value); }
663 
667 template <>
668 bool Get<bool>(const icl_core::String& key, bool& value)
669 ICL_CORE_GCC_DEPRECATE_STYLE;
670 template <> inline
672 { return get<bool>(key, value); }
673 
674 template <typename T>
675 bool Get(const icl_core::String& key,
676  typename icl_core::ConvertToRef<T>::ToRef value,
677  const char *descriptions[],
678  const char *end_marker = NULL)
680 template <typename T>
682  typename icl_core::ConvertToRef<T>::ToRef value,
683  const char *descriptions[],
684  const char *end_marker)
685 { return get<T>(key, value, descriptions, end_marker); }
686 
687 template <typename T>
688 bool Get(const char *key,
689  typename icl_core::ConvertToRef<T>::ToRef value,
690  const char *descriptions[],
691  const char *end_marker = NULL)
693 template <typename T>
694 ICL_CORE_VC_DEPRECATE_STYLE bool Get(const char *key,
695  typename icl_core::ConvertToRef<T>::ToRef value,
696  const char *descriptions[],
697  const char *end_marker)
698 { return get<T>(key, value, descriptions, end_marker); }
699 
700 template <typename T>
701 T GetDefault(const icl_core::String& key,
702  typename icl_core::ConvertToRef<T>::ToConstRef default_value)
704 template <typename T>
706  typename icl_core::ConvertToRef<T>::ToConstRef default_value)
707 { return getDefault<T>(key, default_value); }
708 
709 template <typename T>
710 T GetDefault(const char *key,
711  typename icl_core::ConvertToRef<T>::ToConstRef default_value)
713 template <typename T>
715  typename icl_core::ConvertToRef<T>::ToConstRef default_value)
716 { return getDefault<T>(key, default_value); }
717 
718 template <>
719 icl_core::String GetDefault<icl_core::String>(const icl_core::String& key,
720  const icl_core::String& default_value)
721 ICL_CORE_GCC_DEPRECATE_STYLE;
722 template <> inline
724 icl_core::String GetDefault<icl_core::String>(const icl_core::String& key,
725  const icl_core::String& default_value)
726 { return getDefault<icl_core::String>(key, default_value); }
727 
732 bool Get(const ConfigValues config_values,
733  icl_core::logging::LogStream& log_stream, bool cleanup = true)
735 inline bool Get(const ConfigValues config_values,
736  icl_core::logging::LogStream& log_stream, bool cleanup)
737 { return get(config_values, log_stream, cleanup); }
738 
739 template <typename T>
740 void SetValue(const icl_core::String& key,
743 template <typename T>
746 { setValue<T>(key, value); }
747 
748 template <typename T>
749 void SetValue(const char *key,
752 template <typename T>
755 { setValue<T>(key, value); }
756 
758 void SetValue(const icl_core::String& key, const icl_core::String& value)
760 inline void SetValue(const icl_core::String& key, const icl_core::String& value)
761 { setValue(key, value); }
762 
764 bool ParamOptPresent(const icl_core::String& name)
766 inline bool ParamOptPresent(const icl_core::String& name)
767 { return paramOptPresent(name); }
768 
769 template <typename T>
770 bool ParamOpt(const icl_core::String& name,
771  typename icl_core::ConvertToRef<T>::ToRef value)
773 template <typename T>
775  typename icl_core::ConvertToRef<T>::ToRef value)
776 { return paramOpt<T>(name, value); }
777 
778 template <typename T>
779 bool ParamOpt(const char *name, typename icl_core::ConvertToRef<T>::ToRef value)
781 template <typename T>
783 { return paramOpt<T>(name, value); }
784 
785 template <typename T>
786 bool ParamOpt(const icl_core::String& name, typename icl_core::ConvertToRef<T>::ToRef value,
787  const char *descriptions[], const char *end_marker = NULL)
789 template <typename T>
792  const char *descriptions[], const char *end_marker)
793 { return paramOpt<T>(name, value, descriptions, end_marker); }
794 
795 template <typename T>
796 bool ParamOpt(const char *name, typename icl_core::ConvertToRef<T>::ToRef value,
797  const char *descriptions[], const char *end_marker = NULL)
799 template <typename T>
801 bool ParamOpt(const char *name, typename icl_core::ConvertToRef<T>::ToRef value,
802  const char *descriptions[], const char *end_marker)
803 { return paramOpt<T>(name, value, descriptions, end_marker); }
804 
805 template <typename T>
806 T ParamOptDefault(const icl_core::String& name, typename icl_core::ConvertToRef<T>::ToConstRef default_value)
808 template <typename T>
811 { return paramOptDefault<T>(name, default_value); }
812 
813 template <typename T>
814 T ParamOptDefault(const char *name, typename icl_core::ConvertToRef<T>::ToConstRef default_value)
816 template <typename T>
818 T ParamOptDefault(const char *name, typename icl_core::ConvertToRef<T>::ToConstRef default_value)
819 { return paramOptDefault<T>(name, default_value); }
820 
821 template <typename T>
822 bool ParamNonOpt(size_t index, typename icl_core::ConvertToRef<T>::ToRef value)
824 template <typename T>
826 bool ParamNonOpt(size_t index, typename icl_core::ConvertToRef<T>::ToRef value)
827 { return paramNonOpt<T>(index, value); }
828 
829 template <typename T>
830 bool ParamNonOpt(size_t index, typename icl_core::ConvertToRef<T>::ToRef value,
831  const char *descriptions[], const char *end_marker = NULL)
833 template <typename T>
835 bool ParamNonOpt(size_t index, typename icl_core::ConvertToRef<T>::ToRef value,
836  const char *descriptions[], const char *end_marker)
837 { return paramNonOpt<T>(index, value, descriptions, end_marker); }
838 
840 icl_core::String ParamNonOpt(size_t index)
842 inline icl_core::String ParamNonOpt(size_t index)
843 { return paramNonOpt(index); }
844 
846 size_t ExtraCmdParamCount()
848 inline size_t ExtraCmdParamCount()
849 { return extraCmdParamCount(); }
850 
852 icl_core::String ExtraCmdParam(size_t index)
854 inline icl_core::String ExtraCmdParam(size_t index)
855 { return extraCmdParam(index); }
856 
858 void ActivateExtraCmdParams(const icl_core::String& delimiter = "--")
860 inline void ActivateExtraCmdParams(const icl_core::String& delimiter)
861 { activateExtraCmdParams(delimiter); }
862 
864 size_t ParamNonOptCount()
866 inline size_t ParamNonOptCount()
867 { return paramNonOptCount(); }
868 
870 void AddParameter(const ConfigParameter& parameter)
872 inline void AddParameter(const ConfigParameter& parameter)
873 { addParameter(parameter); }
874 
876 void AddParameter(const ConfigParameterList& parameters)
878 inline void AddParameter(const ConfigParameterList& parameters)
879 { addParameter(parameters); }
880 
882 void AddParameter(const GetoptParameter& parameter)
884 inline void AddParameter(const GetoptParameter& parameter)
885 { addParameter(parameter); }
886 
888 void AddParameter(const GetoptParameterList& parameters)
890 inline void AddParameter(const GetoptParameterList& parameters)
891 { addParameter(parameters); }
892 
894 void PrintHelp()
896 inline void PrintHelp()
897 { printHelp(); }
898 
900 bool Initialize(int& argc, char *argv[], bool remove_read_arguments)
902 inline bool Initialize(int& argc, char *argv[], bool remove_read_arguments)
903 { return initialize(argc, argv, remove_read_arguments); }
904 
906 bool Initialize(int& argc, char *argv[],
910 inline bool Initialize(int& argc, char *argv[],
912  Getopt::ParameterRegistrationCheck registration_check)
913 { return initialize(argc, argv, cleanup, registration_check); }
914 
915 //#endif
917 
918 }
919 }
920 
921 #endif
all options have to be registered
Definition: GetoptParser.h:59
Helper definitions for template programming.
signed int int32_t
Definition: msvc_stdint.h:90
Contains helper functions for dealing with String.
static ConfigManager & instance()
bool initialize(int &argc, char *argv[], bool remove_read_arguments)
Definition: Config.cpp:50
void setProgramDescription(icl_core::String const &description)
#define ICL_CORE_VC_DEPRECATE_STYLE
Definition: Deprecate.h:53
Contains ConfigParameter.
Handles commandline parameters.
Definition: GetoptParser.h:54
#define SLOGGING_ERROR(stream, arg)
ICL_CORE_VC_DEPRECATE_STYLE icl_core::String ExtraCmdParam(size_t index) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:854
String toLower(icl_core::String str)
Definition: StringHelper.h:86
Contains GetoptParameter.
void setProgramDescription(icl_core::String const &description)
Definition: Config.h:586
#define ICL_CORE_CONFIG_IMPORT_EXPORT
Contains macros to deprecate classes, types, functions and variables.
bool string2Enum(const String &str, int32_t &value, const char *const *descriptions, const char *end_marker)
Definition: EnumHelper.cpp:28
Contains Getopt.
ICL_CORE_VC_DEPRECATE_STYLE void AddParameter(const ConfigParameter &parameter) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:872
T hexical_cast(U input)
Definition: Util.h:43
icl_core::String paramOpt(const icl_core::String &name) const
ICL_CORE_VC_DEPRECATE_STYLE void DebugOutCommandLine(int argc, char *argv[]) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:615
bool paramOptPresent(const icl_core::String &name) const
T getDefault(const icl_core::String &key, typename icl_core::ConvertToRef< T >::ToConstRef default_value)
Definition: Config.h:200
void SetValue(const icl_core::String &key, typename icl_core::ConvertToRef< T >::ToConstRef value) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:744
void debugOutCommandLine(int argc, char *argv[])
Definition: Config.cpp:36
T paramOptDefault(const icl_core::String &name, typename icl_core::ConvertToRef< T >::ToConstRef default_value)
Definition: Config.h:443
Defines logging macros.
bool Get< bool >(const icl_core::String &key, bool &value) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:671
ICL_CORE_VC_DEPRECATE_STYLE size_t ExtraCmdParamCount() ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:848
size_t paramNonOptCount() const
ICL_CORE_VC_DEPRECATE_STYLE bool Initialize(int &argc, char *argv[], bool remove_read_arguments) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:902
size_t extraCmdParamCount()
Definition: Config.h:521
void addParameter(const ConfigParameter &parameter)
ICL_CORE_VC_DEPRECATE_STYLE void Dump() ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:609
size_t extraCmdParamCount() const
void setValue(const icl_core::String &key, typename icl_core::ConvertToRef< T >::ToConstRef value)
Definition: Config.h:360
void activateExtraCmdParams(const icl_core::String &delimiter="--")
Definition: Config.h:531
bool get< bool >(const icl_core::String &key, bool &value)
Template specialization for boolean values.
Definition: Config.h:122
bool paramOpt(const icl_core::String &name, typename icl_core::ConvertToRef< T >::ToRef value)
Definition: Config.h:384
Implements a thread-safe logging framework.
Definition: LogStream.h:54
std::list< impl::ConfigValueIface * > ConfigValueList
Definition: ConfigValues.h:45
void setProgramVersion(icl_core::String const &version)
Contains import/export definitions for the Win32 plattform.
ThreadStream & endl(ThreadStream &stream)
Definition: ThreadStream.h:249
bool ParamOpt(const icl_core::String &name, typename icl_core::ConvertToRef< T >::ToRef value) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:774
Contains tConfigValue.
const char * CONFIGFILE_CONFIG_KEY
Definition: Config.cpp:29
icl_core::String extraCmdParam(size_t index) const
ConfigIterator find(const ::icl_core::String &query)
Definition: Config.cpp:45
bool get(const String &key, typename ConvertToRef< T >::ToRef value) const
void addParameter(const ConfigParameter &parameter)
Definition: Config.h:541
command line options are left untouched
Definition: GetoptParser.h:66
T ParamOptDefault(const icl_core::String &name, typename icl_core::ConvertToRef< T >::ToConstRef default_value) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:810
icl_core::String extraCmdParam(size_t index)
Definition: Config.h:526
Utility functions for the configuration framework.
std::string String
Definition: BaseTypes.h:43
void activateExtraCmdParams(const icl_core::String &delimiter="--")
virtual icl_core::String key() const =0
T GetDefault(const icl_core::String &key, typename icl_core::ConvertToRef< T >::ToConstRef default_value) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:705
void printHelp()
Definition: Config.h:591
bool ParamNonOpt(size_t index, typename icl_core::ConvertToRef< T >::ToRef value) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:826
Contains ConfigManager.
Contains Interface base classes and base types.
ICL_CORE_VC_DEPRECATE_STYLE size_t ParamNonOptCount() ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:866
static Getopt & instance()
size_t paramNonOptCount()
Definition: Config.h:536
void addParameter(const GetoptParameter &parameter)
bool paramOptPresent(const icl_core::String &name)
Definition: Config.h:378
Contains helper functions to handle enums with textual descriptions.
Contains ConfigIterator.
bool setValue(const icl_core::String &key, typename icl_core::ConvertToRef< T >::ToConstRef value)
Add a key/value pair or change a value. In contrast to Insert, this method notifies observers...
void setProgramVersion(icl_core::String const &version)
Definition: Config.h:581
ICL_CORE_VC_DEPRECATE_STYLE ConfigIterator Find(const icl_core::String &query) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:621
bool Get(const icl_core::String &key, typename icl_core::ConvertToRef< T >::ToRef value) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:648
#define SLOGGING_TRACE(stream, arg)
ICL_CORE_VC_DEPRECATE_STYLE void ActivateExtraCmdParams(const icl_core::String &delimiter="--") ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:860
bool paramNonOpt(size_t index, typename icl_core::ConvertToRef< T >::ToRef value)
Definition: Config.h:470
virtual bool get(std::string const &prefix="", icl_core::logging::LogStream &log_stream=icl_core::logging::Nirwana::instance()) const =0
ICL_CORE_VC_DEPRECATE_STYLE bool ParamOptPresent(const icl_core::String &name) ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:766
ICL_CORE_VC_DEPRECATE_STYLE void PrintHelp() ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Config.h:896
#define ICL_CORE_GCC_DEPRECATE_STYLE
Definition: Deprecate.h:54
icl_core::String paramNonOpt(size_t index) const
impl::ConfigValueIface * ConfigValues[]
Definition: ConfigValues.h:44
virtual icl_core::String stringValue() const =0
icl_core::KeyValueDirectoryIterator< icl_core::String > ConfigIterator


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:58