1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
19 #define GGO_DefineOption_Vector(OPTION, FUNC, TYPE, NB, BOOL) \
20 template<class ArgsInfoType> \
21 void FUNC##_GGO(ArgsInfoType & mArgsInfo) { \
22 if (mArgsInfo.OPTION##_given == NB) { \
24 for(unsigned int i=0; i<NB; i++) { \
25 aaa[i] = mArgsInfo.OPTION##_arg[i]; \
27 VerboseOption(#FUNC, mArgsInfo.OPTION##_given, mArgsInfo.OPTION##_arg); \
31 if (BOOL && mArgsInfo.OPTION##_given != 0) { \
32 std::cerr << "Sorry, you give only " << mArgsInfo.OPTION##_given << " while " \
33 << NB << " values a required for option '" << #OPTION << "'" << std::endl; \
39 #define GGO_DefineOption_Multiple(OPTION, FUNC, TYPE) \
40 template<class ArgsInfoType> \
41 void FUNC##_GGO(ArgsInfoType & mArgsInfo) { \
42 VerboseOption(#OPTION, mArgsInfo.OPTION##_given, mArgsInfo.OPTION##_arg); \
43 for(unsigned int i=0; i<mArgsInfo.OPTION##_given; i++) { \
44 FUNC(mArgsInfo.OPTION##_arg[i]); \
48 #define GGO_DefineOption(OPTION, FUNC, TYPE) \
49 template<class ArgsInfoType> \
50 void FUNC##_GGO(ArgsInfoType & mArgsInfo) { \
51 VerboseOption(#OPTION, mArgsInfo.OPTION##_arg); \
52 FUNC(static_cast<TYPE>(mArgsInfo.OPTION##_arg)); \
55 #define GGO_DefineOption_Flag(OPTION, FUNC) \
56 template<class ArgsInfoType> \
57 void FUNC##_GGO(ArgsInfoType & mArgsInfo) { \
58 VerboseOption(#OPTION, mArgsInfo.OPTION##_flag); \
59 FUNC(mArgsInfo.OPTION##_flag); \
62 #define GGO_DefineOption_WithTest(OPTION, FUNC, TYPE, TEST) \
63 template<class ArgsInfoType> \
64 void FUNC##_GGO(ArgsInfoType & mArgsInfo) { \
65 VerboseOption(#OPTION, mArgsInfo.OPTION##_given, mArgsInfo.OPTION##_arg); \
66 if (mArgsInfo.OPTION##_given) { \
67 VerboseOption(#OPTION, mArgsInfo.OPTION##_arg); \
68 FUNC(static_cast<TYPE>(mArgsInfo.OPTION##_arg)); \
74 #define GGO_DefineOption_LabelParam(OPTION, FUNC, TYPE) \
75 template<class ArgsInfoType> \
76 void FUNC##_GGO(ArgsInfoType & mArgsInfo) { \
77 TYPE * param = new TYPE; \
78 param->SetFirstKeep(mArgsInfo.firstKeep##OPTION##_arg); \
79 for(unsigned int i=0; i<mArgsInfo.remove##OPTION##_given; i++) \
80 param->AddLabelToRemove(mArgsInfo.remove##OPTION##_arg[i]); \
81 if (mArgsInfo.lastKeep##OPTION##_given) { \
82 param->SetLastKeep(mArgsInfo.lastKeep##OPTION##_arg); \
83 param->UseLastKeepOn(); \
85 else param->UseLastKeepOff(); \
86 VerboseOption("firstKeep"#OPTION, mArgsInfo.firstKeep##OPTION##_arg); \
87 VerboseOption("lastKeep"#OPTION, mArgsInfo.lastKeep##OPTION##_given, mArgsInfo.lastKeep##OPTION##_arg ); \
88 VerboseOptionV("remove"#OPTION, mArgsInfo.remove##OPTION##_given, mArgsInfo.remove##OPTION##_arg); \