cmdtranslateroption.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 Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 #ifndef mia_core_cmdtranslatoroption_hh
23 #define mia_core_cmdtranslatoroption_hh
24 
25 #include <mia/core/cmdoption.hh>
26 #include <mia/core/optionparser.hh>
27 
29 
30 
31 
33 public:
34  CParamizedFunctor(const char *name);
35 
36  class Selector {
37  void add_functor(CParamizedFunctor *t);
38 
39  void set_value(const char *str_value);
40 
41  void write_value(std::ostream& os) const;
42 
43  static instance();
44  private:
45  virtual void post_add_translator(CTranslator& t) = 0;
46  virtual bool do_set_value(const CTranslator& t, const CComplexOptionParser::CParts& options) = 0;
47  virtual void do_write_value(std::ostream& os) const = 0;
48 
49  std::map<std::string, std::shared_ptr<CTranslator> > m_translators;
50 
51  }
52 
53 private:
54 
55 };
56 
57 
59 public:
60 
61 
62 
63 };
64 
66  public:
67  CCmdParametrizedFunktorOption(CParamizedFunctor& vt, const char *init, char short_opt, const char *long_opt,
68  const char *long_help, const char *short_help, CCmdOptionFlags flags);
69 
70  private:
71  virtual bool do_set_value(const char *str_value);
72  virtual void do_write_value(std::ostream& os) const;
73 
74  ValueTranslator& m_vt;
75 };
76 
77 
79 
80 
81 #endif
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
CCmdOptionFlags
CParamizedFunctor(const char *name)
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101
std::vector< std::pair< std::string, CParsedOptions > > CParts
Type for a map of parts of a complex option.
Definition: optionparser.hh:63
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36