My Project
parameter.hh
Go to the documentation of this file.
1 /* -*- mia-c++ -*-
2  *
3  * This file is part of MIA - a toolbox for medical image analysis
4  * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
5  *
6  * MIA is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Pub
8 lic License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with MIA; if not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef mia_core_parameters_hh
23 #define mia_core_parameters_hh
24 
25 #include <string>
26 #include <map>
27 #include <ostream>
28 #include <istream>
29 #include <sstream>
30 #include <memory>
31 #include <mia/core/flags.hh>
32 #include <mia/core/dictmap.hh>
33 #include <mia/core/msgstream.hh>
34 #include <mia/core/handlerbase.hh>
37 
39 
49 {
50 public:
57  CParameter(const char type[], bool required, const char *descr);
58 
62  virtual ~CParameter();
63 
67  const char *type() const;
71  void descr(std::ostream& os) const;
72 
73 
78  std::string get_value_as_string() const;
79 
84  void value(std::ostream& os) const;
85 
89  bool required_set() const;
90 
94  bool set(const std::string& str_value);
95 
97  const char *get_descr() const;
98 
102  void reset();
103 
109  void add_dependend_handler(HandlerHelpMap& handler_map) const;
110 
112  std::string get_default_value() const;
113 
118  void get_help_xml(CXMLElement& root) const;
119 
120 
126  virtual void post_set();
127 
128 protected:
129 
134  virtual void do_descr(std::ostream& os) const = 0;
135 
137  const std::string errmsg(const std::string& err_value) const;
138 
139  CXMLElement& add_xmlhelp_childnode(CXMLElement& parent, const std::string& tag) const;
140  void add_xmlhelp_attribute(CXMLElement& node, const std::string& tag, const std::string& value)const;
141  void add_xmlhelp_text(CXMLElement& node, const std::string& value)const;
142 
143 private:
147  virtual void do_add_dependend_handler(HandlerHelpMap& handler_map) const;
148  virtual bool do_set(const std::string& str_value) = 0;
149  virtual void do_reset() = 0;
150  virtual std::string do_get_default_value() const = 0;
151  virtual std::string do_get_value_as_string() const = 0;
152  virtual void do_get_help_xml(CXMLElement& self) const;
153 
154  bool m_required;
155  bool m_is_required;
156  const std::string m_type;
157  const char *m_descr;
158 };
159 
160 
169 template <typename T>
171 {
172 
173 public:
179  CTParameter(T& value, bool required, const char *descr);
180 
181 protected:
185  virtual void do_descr(std::ostream& os) const;
186 private:
187  virtual bool do_set(const std::string& str_value);
188  virtual void do_reset();
189  virtual void adjust(T& value);
190  virtual std::string do_get_default_value() const;
191  virtual std::string do_get_value_as_string() const;
192  T& m_value;
193  const T m_default_value;
194 };
195 
216 enum class EParameterBounds : int {
217  bf_none = 0,
218  bf_min = 1,
219  bf_min_open = 3,
220  bf_min_closed = 5,
221  bf_min_flags = 7,
222  bf_max = 0x10,
223  bf_max_open = 0x30,
224  bf_max_closed = 0x50,
225  bf_max_flags = 0x70,
226  bf_closed_interval = 0x55,
227  bf_open_interval = 0x33
228 };
229 
231 
232 
233 EXPORT_CORE std::ostream& operator << (std::ostream& os, EParameterBounds flags);
234 
235 template <typename T>
237 {
238 
239 public:
240  template <typename S>
241  struct boundary {
242  typedef S value_type;
243  };
244 
245  template <typename S>
246  struct boundary<std::vector<S>> {
247  typedef S value_type;
248  };
249 
251 
252 
263  TBoundedParameter(T& value, EParameterBounds flags, const std::vector<boundary_type>& boundaries,
264  bool required, const char *descr);
265 protected:
269  void do_descr(std::ostream& os) const;
270 private:
271 
272  virtual void adjust(T& value);
273  virtual void do_get_help_xml(CXMLElement& self) const;
274  boundary_type m_min;
275  boundary_type m_max;
276  EParameterBounds m_flags;
277 };
278 
279 template <typename T>
280 CParameter *make_param(T& value, bool required, const char *descr)
281 {
282  return new CTParameter<T>(value, required, descr);
283 }
284 
285 
286 template <typename T, typename S>
287 CParameter *make_lo_param(T& value, S lower_bound, bool required, const char *descr)
288 {
289  return new TBoundedParameter<T>(value, EParameterBounds::bf_min_open,
290  {static_cast<T>(lower_bound)}, required, descr);
291 }
292 
293 template <typename T>
294 CParameter *make_positive_param(T& value, bool required, const char *descr)
295 {
296  return new TBoundedParameter<T>(value, EParameterBounds::bf_min_open, {T()}, required, descr);
297 }
298 
299 template <typename T, typename S>
300 CParameter *make_lc_param(T& value, S lower_bound, bool required, const char *descr)
301 {
302  return new TBoundedParameter<T>(value, EParameterBounds::bf_min_closed,
303  {static_cast<T>(lower_bound)}, required, descr);
304 }
305 
306 
307 template <typename T>
308 CParameter *make_nonnegative_param(T& value, bool required, const char *descr)
309 {
310  return new TBoundedParameter<T>(value, EParameterBounds::bf_min_closed, {T()}, required, descr);
311 }
312 
313 
314 template <typename T, typename S>
315 CParameter *make_uo_param(T& value, S upper_bound, bool required, const char *descr)
316 {
317  return new TBoundedParameter<T>(value, EParameterBounds::bf_min_open,
318  {static_cast<T>(upper_bound)}, required, descr);
319 }
320 
321 template <typename T, typename S>
322 CParameter *make_uc_param(T& value, S upper_bound, bool required, const char *descr)
323 {
324  return new TBoundedParameter<T>(value, EParameterBounds::bf_min_closed,
325  {static_cast<T>(upper_bound)}, required, descr);
326 }
327 
328 template <typename T, typename S1, typename S2>
329 CParameter *make_ci_param(T& value, S1 lower_bound, S2 upper_bound, bool required, const char *descr)
330 {
331  return new TBoundedParameter<T>(value, EParameterBounds::bf_closed_interval,
332  {static_cast<T>(lower_bound), static_cast<T>(upper_bound)}, required, descr);
333 }
334 
335 template <typename T, typename S1, typename S2>
336 CParameter *make_oi_param(T& value, S1 lower_bound, S2 upper_bound, bool required, const char *descr)
337 {
339  {static_cast<T>(lower_bound), static_cast<T>(upper_bound)}, required, descr);
340 }
341 
342 template <typename T, typename S1, typename S2>
343 CParameter *make_coi_param(T& value, S1 lower_bound, S2 upper_bound, bool required, const char *descr)
344 {
345  return new TBoundedParameter<T>(value, EParameterBounds::bf_min_closed | EParameterBounds::bf_max_open,
346  {static_cast<T>(lower_bound), static_cast<T>(upper_bound)}, required, descr);
347 }
348 
349 template <typename T, typename S1, typename S2>
350 CParameter *make_oci_param(T& value, S1 lower_bound, S2 upper_bound, bool required, const char *descr)
351 {
352  return new TBoundedParameter<T>(value, EParameterBounds::bf_max_closed | EParameterBounds::bf_min_open,
353  {static_cast<T>(lower_bound), static_cast<T>(upper_bound)}, required, descr);
354 }
355 
356 
357 
366 template <typename T>
368 {
369 
370 public:
377  CDictParameter(T& value, const TDictMap<T>& dict, const char *descr, bool required = false);
378 protected:
382  virtual void do_descr(std::ostream& os) const;
383 private:
384  virtual bool do_set(const std::string& str_value);
385  virtual void do_reset();
386  virtual std::string do_get_default_value() const;
387  virtual std::string do_get_value_as_string() const;
388  virtual void do_get_help_xml(CXMLElement& self) const;
389  T& m_value;
390  T m_default_value;
391  const TDictMap<T> m_dict;
392 
393 };
394 
395 
404 template <typename F>
406 {
407 
408 public:
420  TFactoryParameter(typename F::ProductPtr& value, const std::string& init, bool required, const char *descr);
421 
433  TFactoryParameter(typename F::UniqueProduct& value, const std::string& init, bool required, const char *descr);
434 private:
435  virtual void do_descr(std::ostream& os) const;
436  virtual void do_add_dependend_handler(HandlerHelpMap& handler_map)const;
437  virtual bool do_set(const std::string& str_value);
438  virtual void do_reset();
439  virtual std::string do_get_default_value() const;
440  virtual std::string do_get_value_as_string() const;
441  virtual void do_get_help_xml(CXMLElement& self) const;
442 
443  typename F::ProductPtr dummy_shared_value;
444  typename F::UniqueProduct dummy_unique_value;
445 
446  typename F::ProductPtr& m_shared_value;
447  typename F::UniqueProduct& m_unique_value;
448 
449  virtual void post_set();
450 
451  std::string m_string_value;
452  std::string m_default_value;
453  bool m_unique;
454 
455 
456 };
457 
458 
459 
470 template <typename T>
471 class CSetParameter : public CParameter
472 {
473 
474 public:
481  CSetParameter(T& value, const std::set<T>& valid_set, const char *descr, bool required = false);
482 protected:
486  virtual void do_descr(std::ostream& os) const;
487 private:
488  virtual bool do_set(const std::string& str_value);
489  virtual void do_reset();
490  virtual std::string do_get_default_value() const;
491  virtual std::string do_get_value_as_string() const;
492  void do_get_help_xml(CXMLElement& self) const;
493  T& m_value;
494  T m_default_value;
495  const std::set<T> m_valid_set;
496 
497 };
498 
508 template <typename T>
509 class TParameter : public CParameter
510 {
511 
512 public:
518  TParameter(T& value, bool required, const char *descr);
519 protected:
523  virtual void do_descr(std::ostream& os) const;
524 private:
525  virtual void do_reset();
526  virtual bool do_set(const std::string& str_value);
527  virtual std::string do_get_default_value() const;
528  virtual std::string do_get_value_as_string() const;
529 
530  T& m_value;
531  T m_default_value;
532 };
533 
534 
537 {
538 public:
539  CStringParameter(std::string& value, CCmdOptionFlags flags, const char *descr,
540  const CPluginHandlerBase *plugin_hint = nullptr);
541 
542 private:
543  virtual void do_reset();
544  virtual bool do_set(const std::string& str_value);
545  virtual std::string do_get_default_value() const;
546  virtual std::string do_get_value_as_string() const;
547 
548  virtual void do_descr(std::ostream& os) const;
549  virtual void do_get_help_xml(CXMLElement& self) const;
550  virtual void do_add_dependend_handler(HandlerHelpMap& handler_map)const;
551 
552 
553  std::string& m_value;
554  std::string m_default_value;
555  CCmdOptionFlags m_flags;
556  const CPluginHandlerBase *m_plugin_hint;
557 };
558 
559 
562 
563 
570 
577 
582 
589 
596 
601 
602 
618 template <typename T>
619 CParameter *make_param(std::shared_ptr<T>& value, const std::string& init, bool required, const char *descr)
620 {
621  typedef typename FactoryTrait<T>::type F;
622  return new TFactoryParameter<F>(value, init, required, descr);
623 }
624 
639 template <typename T>
640 CParameter *make_param(std::unique_ptr<T>& value, const std::string& init, bool required, const char *descr)
641 {
642  typedef typename FactoryTrait<T>::type F;
643  return new TFactoryParameter<F>(value, init, required, descr);
644 }
645 
646 
647 
648 
650 
654 template <typename T>
655 struct __dispatch_param_translate {
656  static std::string apply(T x)
657  {
658  std::ostringstream s;
659  s << x;
660  return s.str();
661  }
662 };
663 
664 template <>
665 struct __dispatch_param_translate<std::string> {
666  static std::string apply(const std::string& x)
667  {
668  return x;
669  }
670 };
671 
672 template <>
673 struct __dispatch_param_translate<const char *> {
674  static std::string apply(const char *x)
675  {
676  return std::string(x);
677  }
678 };
679 
681 
682 template <typename T>
683 CDictParameter<T>::CDictParameter(T& value, const TDictMap<T>& dict, const char *descr, bool required):
684  CParameter("dict", required, descr),
685  m_value(value),
686  m_default_value(value),
687  m_dict(dict)
688 {
689 }
690 
691 template <typename T>
692 void CDictParameter<T>::do_descr(std::ostream& os) const
693 {
694  for (auto i = m_dict.get_help_begin(); i != m_dict.get_help_end(); ++i) {
695  os << "\n " << i->second.first << ": " << i->second.second;
696  }
697 }
698 
699 template <typename T>
701 {
703  auto& dict = this->add_xmlhelp_childnode(self, "dict");
704 
705  for (auto i = m_dict.get_help_begin(); i != m_dict.get_help_end(); ++i) {
706  auto& v = this->add_xmlhelp_childnode(dict, "value");
707  this->add_xmlhelp_attribute(v, "name", i->second.first);
708  this->add_xmlhelp_text(v, i->second.second);
709  }
710 }
711 
712 template <typename T>
713 bool CDictParameter<T>::do_set(const std::string& str_value)
714 {
715  m_value = m_dict.get_value(str_value.c_str());
716  return true;
717 }
718 
719 template <typename T>
721 {
722  m_value = m_default_value;
723 }
724 
725 template <typename T>
726 std::string CDictParameter<T>::do_get_default_value() const
727 {
728  return m_dict.get_name(m_default_value);
729 }
730 
731 template <typename T>
733 {
734  return m_dict.get_name(m_value);
735 }
736 
737 template <typename F>
738 TFactoryParameter<F>::TFactoryParameter(typename F::ProductPtr& value,
739  const std::string& init, bool required, const char *descr):
740  CParameter("factory", required, descr),
741  m_shared_value(value),
742  m_unique_value(dummy_unique_value),
743  m_string_value(init),
744  m_default_value(init),
745  m_unique(false)
746 {
747 }
748 
749 template <typename F>
750 TFactoryParameter<F>::TFactoryParameter(typename F::UniqueProduct& value, const std::string& init, bool required, const char *descr):
751  CParameter("factory", required, descr),
752  m_shared_value(dummy_shared_value),
753  m_unique_value(value),
754  m_string_value(init),
755  m_default_value(init),
756  m_unique(true)
757 {
758 }
759 
760 
761 
762 template <typename T>
763 void TFactoryParameter<T>::do_descr(std::ostream& os) const
764 {
765  os << "For a list of available plug-ins see run 'mia-plugin-help "
766  << T::instance().get_descriptor() << "'";
767 }
768 
769 template <typename T>
771 {
772  auto& node = this->add_xmlhelp_childnode(self, "factory");
773  this->add_xmlhelp_attribute(node, "name", T::instance().get_descriptor());
774 }
775 
776 template <typename T>
777 bool TFactoryParameter<T>::do_set(const std::string& str_value)
778 {
779  m_string_value = str_value;
780  return true;
781 }
782 
783 template <typename T>
785 {
786  if (!m_string_value.empty()) {
787  if (m_unique)
788  m_unique_value = T::instance().produce_unique(m_string_value);
789  else
790  m_shared_value = T::instance().produce(m_string_value);
791  }
792 }
793 
794 template <typename T>
796 {
797  m_string_value = m_default_value;
798 }
799 
800 template <typename T>
802 {
803  // add recursively all dependent handlers
804  if (handler_map.find(T::instance().get_descriptor()) == handler_map.end()) {
805  handler_map[T::instance().get_descriptor()] = &T::instance();
806 
807  for (auto i = T::instance().begin(); i != T::instance().end(); ++i)
808  i->second->add_dependend_handlers(handler_map);
809  }
810 }
811 
812 template <typename T>
814 {
815  return m_default_value;
816 }
817 
818 template <typename T>
820 {
821  if (m_unique && m_unique_value)
822  return m_unique_value->get_init_string();
823 
824  if (!m_unique && m_shared_value)
825  return m_shared_value->get_init_string();
826 
827  return m_string_value;
828 }
829 
830 template <typename T>
831 CSetParameter<T>::CSetParameter(T& value, const std::set<T>& valid_set, const char *descr, bool required):
832  CParameter("set", required, descr),
833  m_value(value),
834  m_default_value(value),
835  m_valid_set(valid_set)
836 {
837  if (m_valid_set.empty())
838  throw std::invalid_argument("CSetParameter initialized with empty set");
839 }
840 
841 
842 template <typename T>
843 std::string CSetParameter<T>::do_get_default_value() const
844 {
845  return __dispatch_param_translate<T>::apply(m_default_value);
846 }
847 
848 template <typename T>
850 {
851  return __dispatch_param_translate<T>::apply(m_value);
852 }
853 
854 template <typename T>
855 void CSetParameter<T>::do_descr(std::ostream& os) const
856 {
857  auto i = m_valid_set.begin();
858  auto e = m_valid_set.end();
859  assert ( i != e );
860  os << " Supported values are (" << *i;
861  ++i;
862 
863  while (i != e)
864  os << '|' << *i++;
865 
866  os << ')';
867 }
868 
869 template <typename T>
871 {
872  auto& node = this->add_xmlhelp_childnode(self, "set");
873 
874  for (auto i = m_valid_set.begin(); i != m_valid_set.end(); ++i) {
875  auto& v = this->add_xmlhelp_childnode(node, "value");
876  this->add_xmlhelp_attribute(v, "name", __dispatch_param_translate<T>::apply(*i));
877  }
878 }
879 
880 template <typename T>
882 {
883  m_value = m_default_value;
884 }
885 
886 template <typename T>
887 bool CSetParameter<T>::do_set(const std::string& str_value)
888 {
889  std::stringstream s(str_value);
890  T val;
891  s >> val;
892 
893  if (s.fail() || m_valid_set.find(val) == m_valid_set.end()) {
894  throw std::invalid_argument(errmsg(str_value));
895  }
896 
897  m_value = val;
898  return true;
899 }
900 
901 
902 
903 template <typename T>
904 TParameter<T>::TParameter(T& value, bool required, const char *descr):
905  CParameter("streamable", required, descr),
906  m_value(value),
907  m_default_value(value)
908 {
909 }
910 
911 
912 
913 template <typename T>
914 void TParameter<T>::do_descr(std::ostream& os) const
915 {
916  os << m_value;
917 }
918 
919 template <typename T>
920 bool TParameter<T>::do_set(const std::string& str_value)
921 {
922  std::stringstream s(str_value);
923  s >> m_value;
924 
925  if (s.fail())
926  throw std::invalid_argument(errmsg(str_value));
927 
928  return true;
929 }
930 
931 template <typename T>
933 {
934  m_value = m_default_value;
935 }
936 
937 template <typename T>
938 std::string TParameter<T>::do_get_default_value() const
939 {
940  std::ostringstream s;
941  s << m_default_value;
942  auto str = s.str();
943 
944  if (str.find(',') != std::string::npos) {
945  std::ostringstream s2;
946  s2 << '[' << str << ']';
947  str = s2.str();
948  }
949 
950  return str;
951 }
952 
953 template <typename T>
954 std::string TParameter<T>::do_get_value_as_string() const
955 {
956  return __dispatch_param_translate<T>::apply(m_value);
957 }
958 
960 extern template class EXPORT_CORE TBoundedParameter<uint16_t>;
961 extern template class EXPORT_CORE TBoundedParameter<uint32_t>;
962 extern template class EXPORT_CORE TBoundedParameter<uint64_t>;
963 extern template class EXPORT_CORE TBoundedParameter<int16_t>;
964 extern template class EXPORT_CORE TBoundedParameter<int32_t>;
965 extern template class EXPORT_CORE TBoundedParameter<int64_t>;
966 extern template class EXPORT_CORE TBoundedParameter<float>;
967 extern template class EXPORT_CORE TBoundedParameter<double>;
968 
977 
979 
980 extern template class EXPORT_CORE CTParameter<std::string>;
981 extern template class EXPORT_CORE CTParameter<bool>;
982 
985 
986 #endif
TFactoryParameter::TFactoryParameter
TFactoryParameter(typename F::ProductPtr &value, const std::string &init, bool required, const char *descr)
Definition: parameter.hh:738
CVSSBoundedParameter
TBoundedParameter< std::vector< int16_t > > CVSSBoundedParameter
an signed short parameter (with possible boundaries)
Definition: parameter.hh:591
make_uo_param
CParameter * make_uo_param(T &value, S upper_bound, bool required, const char *descr)
Definition: parameter.hh:315
CULBoundedParameter
TBoundedParameter< uint64_t > CULBoundedParameter
an unsigned long parameter (with possible boundaries)
Definition: parameter.hh:569
CTParameter::CTParameter
CTParameter(T &value, bool required, const char *descr)
make_uc_param
CParameter * make_uc_param(T &value, S upper_bound, bool required, const char *descr)
Definition: parameter.hh:322
CParameter::add_xmlhelp_childnode
CXMLElement & add_xmlhelp_childnode(CXMLElement &parent, const std::string &tag) const
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
CParameter::get_descr
const char * get_descr() const
make_lo_param
CParameter * make_lo_param(T &value, S lower_bound, bool required, const char *descr)
Definition: parameter.hh:287
CParameter
The base class for parameters used in complex options.
Definition: parameter.hh:49
CParameter::get_help_xml
void get_help_xml(CXMLElement &root) const
make_oci_param
CParameter * make_oci_param(T &value, S1 lower_bound, S2 upper_bound, bool required, const char *descr)
Definition: parameter.hh:350
TBoundedParameter::boundary
Definition: parameter.hh:241
handlerbase.hh
CParameter::add_xmlhelp_attribute
void add_xmlhelp_attribute(CXMLElement &node, const std::string &tag, const std::string &value) const
make_coi_param
CParameter * make_coi_param(T &value, S1 lower_bound, S2 upper_bound, bool required, const char *descr)
Definition: parameter.hh:343
CVDBoundedParameter
TBoundedParameter< std::vector< double > > CVDBoundedParameter
an float parameter, double accuracy (with possible boundaries)
Definition: parameter.hh:600
CParameter::add_dependend_handler
void add_dependend_handler(HandlerHelpMap &handler_map) const
TBoundedParameter::TBoundedParameter
TBoundedParameter(T &value, EParameterBounds flags, const std::vector< boundary_type > &boundaries, bool required, const char *descr)
dictmap.hh
CDictParameter::CDictParameter
CDictParameter(T &value, const TDictMap< T > &dict, const char *descr, bool required=false)
Definition: parameter.hh:683
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
HandlerHelpMap
std::map< std::string, const CPluginHandlerBase * > HandlerHelpMap
A map that is used to collect the plug-in handlers used in a program.
Definition: handlerbase.hh:35
TParameter::TParameter
TParameter(T &value, bool required, const char *descr)
Definition: parameter.hh:904
make_param
CParameter * make_param(T &value, bool required, const char *descr)
Definition: parameter.hh:280
CDictParameter
Dictionary parameter.
Definition: parameter.hh:368
CXMLElement
This class implements a facade for the xml Element.
Definition: xmlinterface.hh:50
cmdoptionflags.hh
CParameter::~CParameter
virtual ~CParameter()
CSetParameter::do_descr
virtual void do_descr(std::ostream &os) const
Definition: parameter.hh:855
CStringParameter
an string parameter
Definition: parameter.hh:537
CSSBoundedParameter
TBoundedParameter< int16_t > CSSBoundedParameter
an signed short parameter (with possible boundaries)
Definition: parameter.hh:572
CVSLBoundedParameter
TBoundedParameter< std::vector< int64_t > > CVSLBoundedParameter
an signed long parameter (with possible boundaries)
Definition: parameter.hh:595
CVULBoundedParameter
TBoundedParameter< std::vector< uint64_t > > CVULBoundedParameter
an unsigned long parameter (with possible boundaries)
Definition: parameter.hh:588
CUSBoundedParameter
TBoundedParameter< uint16_t > CUSBoundedParameter
an unsigned short parameter (with possible boundaries)
Definition: parameter.hh:565
msgstream.hh
factory_trait.hh
EParameterBounds::bf_none
@ bf_none
CVSIBoundedParameter
TBoundedParameter< std::vector< int32_t > > CVSIBoundedParameter
an signed int parameter (with possible boundaries)
Definition: parameter.hh:593
make_nonnegative_param
CParameter * make_nonnegative_param(T &value, bool required, const char *descr)
Definition: parameter.hh:308
TRACE_FUNCTION
#define TRACE_FUNCTION
Definition: msgstream.hh:209
make_positive_param
CParameter * make_positive_param(T &value, bool required, const char *descr)
Definition: parameter.hh:294
TFactoryParameter
A parameter that get's initialized by a factory to a shared or unique pointer.
Definition: parameter.hh:406
CVFBoundedParameter
TBoundedParameter< std::vector< float > > CVFBoundedParameter
an float parameter, single accuracy (with possible boundaries)
Definition: parameter.hh:598
CParameter::get_default_value
std::string get_default_value() const
EParameterBounds
EParameterBounds
Scalar parameter with an expected value range.
Definition: parameter.hh:216
CParameter::reset
void reset()
TBoundedParameter::boundary_type
boundary< T >::value_type boundary_type
Definition: parameter.hh:250
TDictMap
A mapper from emums to string values. - usefull for names flags.
Definition: dictmap.hh:46
TParameter::do_descr
virtual void do_descr(std::ostream &os) const
Definition: parameter.hh:914
CSetParameter::CSetParameter
CSetParameter(T &value, const std::set< T > &valid_set, const char *descr, bool required=false)
Definition: parameter.hh:831
CSetParameter
A parameter that can only assume values out of a limited set.
Definition: parameter.hh:472
CParameter::get_value_as_string
std::string get_value_as_string() const
CPluginHandlerBase
The base class for all plugin handlers.
Definition: handlerbase.hh:57
make_oi_param
CParameter * make_oi_param(T &value, S1 lower_bound, S2 upper_bound, bool required, const char *descr)
Definition: parameter.hh:336
CVUIBoundedParameter
TBoundedParameter< std::vector< uint32_t > > CVUIBoundedParameter
an unsigned int parameter (with possible boundaries)
Definition: parameter.hh:586
CParameter::value
void value(std::ostream &os) const
CParameter::descr
void descr(std::ostream &os) const
CParameter::post_set
virtual void post_set()
make_ci_param
CParameter * make_ci_param(T &value, S1 lower_bound, S2 upper_bound, bool required, const char *descr)
Definition: parameter.hh:329
CParameter::add_xmlhelp_text
void add_xmlhelp_text(CXMLElement &node, const std::string &value) const
operator<<
EXPORT_CORE std::ostream & operator<<(std::ostream &os, EParameterBounds flags)
flags.hh
TBoundedParameter::boundary::value_type
S value_type
Definition: parameter.hh:242
TParameter
A parameter that can assume any value of the given value type.
Definition: parameter.hh:510
EXPORT_CORE
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101
CParameter::required_set
bool required_set() const
IMPLEMENT_FLAG_OPERATIONS
IMPLEMENT_FLAG_OPERATIONS(EParameterBounds)
TBoundedParameter::boundary< std::vector< S > >::value_type
S value_type
Definition: parameter.hh:247
CTParameter::do_descr
virtual void do_descr(std::ostream &os) const
CCmdOptionFlags
CCmdOptionFlags
Definition: cmdoptionflags.hh:28
TBoundedParameter
Definition: parameter.hh:237
std
Definition: gsl_iterator.hh:324
CBoolParameter
CTParameter< bool > CBoolParameter
boolean parameter
Definition: parameter.hh:561
CTParameter
Generic type of a complex paramter.
Definition: parameter.hh:171
CDictParameter::do_descr
virtual void do_descr(std::ostream &os) const
Definition: parameter.hh:692
CDBoundedParameter
TBoundedParameter< double > CDBoundedParameter
an float parameter, double accuracy (with possible boundaries)
Definition: parameter.hh:581
CSLBoundedParameter
TBoundedParameter< int64_t > CSLBoundedParameter
an signed long parameter (with possible boundaries)
Definition: parameter.hh:576
CParameter::errmsg
const std::string errmsg(const std::string &err_value) const
create an error message by using the given value that raises the error
CParameter::set
bool set(const std::string &str_value)
make_lc_param
CParameter * make_lc_param(T &value, S lower_bound, bool required, const char *descr)
Definition: parameter.hh:300
CFBoundedParameter
TBoundedParameter< float > CFBoundedParameter
an float parameter, single accuracy (with possible boundaries)
Definition: parameter.hh:579
CParameter::type
const char * type() const
CParameter::do_descr
virtual void do_descr(std::ostream &os) const =0
CUIBoundedParameter
TBoundedParameter< uint32_t > CUIBoundedParameter
an unsigned int parameter (with possible boundaries)
Definition: parameter.hh:567
CStringParameter::CStringParameter
CStringParameter(std::string &value, CCmdOptionFlags flags, const char *descr, const CPluginHandlerBase *plugin_hint=nullptr)
CParameter::CParameter
CParameter(const char type[], bool required, const char *descr)
CSIBoundedParameter
TBoundedParameter< int32_t > CSIBoundedParameter
an signed int parameter (with possible boundaries)
Definition: parameter.hh:574
TBoundedParameter::do_descr
void do_descr(std::ostream &os) const
CVUSBoundedParameter
TBoundedParameter< std::vector< uint16_t > > CVUSBoundedParameter
an unsigned short parameter (with possible boundaries)
Definition: parameter.hh:584