My Project
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>
27
29
30
31
33{
34public:
35 CParamizedFunctor(const char *name);
36
38 {
39 void add_functor(CParamizedFunctor *t);
40
41 void set_value(const char *str_value);
42
43 void write_value(std::ostream& os) const;
44
45 static instance();
46 private:
47 virtual void post_add_translator(CTranslator& t) = 0;
48 virtual bool do_set_value(const CTranslator& t, const CComplexOptionParser::CParts& options) = 0;
49 virtual void do_write_value(std::ostream& os) const = 0;
50
51 std::map<std::string, std::shared_ptr<CTranslator>> m_translators;
52
53 }
54
55private:
56
57};
58
59
61{
62public:
63
64
65
66};
67
69{
70public:
71 CCmdParametrizedFunktorOption(CParamizedFunctor& vt, const char *init, char short_opt, const char *long_opt,
72 const char *long_help, const char *short_help, CCmdOptionFlags flags);
73
74private:
75 virtual bool do_set_value(const char *str_value);
76 virtual void do_write_value(std::ostream& os) const;
77
78 ValueTranslator& m_vt;
79};
80
81
83
84
85#endif
CCmdParametrizedFunktorOption(CParamizedFunctor &vt, const char *init, char short_opt, const char *long_opt, const char *long_help, const char *short_help, CCmdOptionFlags flags)
std::vector< std::pair< std::string, CParsedOptions > > CParts
Type for a map of parts of a complex option.
CParamizedFunctor(const char *name)
CCmdOptionFlags
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition defines.hh:101
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36