Elaboradar  0.1
 Tutto Classi Namespace File Funzioni Variabili Tipi enumerati (enum) Gruppi
cum_bac_clparser.cpp
1 /*
2  * =====================================================================================
3  *
4  * Filename: cum_bac_clparser.cpp
5  *
6  * Description:
7  *
8  * Version: 1.0
9  * Created: 26/02/2014 09:12:25
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: YOUR NAME (),
14  * Organization:
15  *
16  * =====================================================================================
17  */
18 #include "cum_bac_clparser.h"
19 #include <iostream>
20 void parseOptions(int argc, char** argv , CUM_BAC_CLOPT *opt)
21 {
22  // CUM_BAC_CLOPT opt;
23  try {
24 
25 
26  TCLAP::CmdLine cmd("CUM_BAC ", ' ', "0.1" );
27  //
28  // Define required arguments
29  //
30 //Filename
31  TCLAP::UnlabeledValueArg<std::string> filename( "FileName", "Name of data file", true, "NULL", "std::string");
32  cmd.add(filename);
33 
34 //file type
35  TCLAP::UnlabeledValueArg<int> filetype("Filetype", "Type of data file", true,9999, "int");
36  cmd.add(filetype);
37 
38 //sito
39  TCLAP::UnlabeledValueArg<std::string> sito("Sito", "Name of radar site", true,"NULL", "std::string");
40  cmd.add(sito);
41 
42  //
43  // Define optional arguments
44  //
45 // TCLAP::SwitchArg Short("S", "ShortPulse", "Use parameters for short pulse", false);
46 // std::vector<TCLAP::Arg*> xorpulse;
47 // xorpulse.push_back(&Short);
48 // xorpulse.push_back(&Medium);
49 // cmd.xorAdd( xorpulse );
50 
51  TCLAP::SwitchArg Stampe("s", "StampeExtra", "Stampe Extra per devel", false);
52  cmd.add(Stampe);
53  TCLAP::SwitchArg VPR("V", "VPR", "Performe VPR correction", false);
54  cmd.add(VPR);
55  TCLAP::SwitchArg Quality("Q", "Quality", "Calculate quality", false);
56  cmd.add(Quality);
57  TCLAP::SwitchArg OdimFormat("O", "Odim", "Data used in ODIM format", false);
58  cmd.add(OdimFormat);
59  TCLAP::SwitchArg Medium("M", "MediumPulse", "Use parameters for medium pulse", false);
60  cmd.add(Medium);
61  TCLAP::SwitchArg StaticMap("m", "UseStaticMap", "Use Static Map", false);
62  cmd.add(StaticMap);
63  TCLAP::SwitchArg Declut("D", "Declut", "Performe only static declutter correction", false);
64  cmd.add(Declut);
65  TCLAP::SwitchArg Class("C", "Class", "Evaluate stratiform-convective classification", false);
66  cmd.add(Class);
67  TCLAP::SwitchArg Clean("c", "Clean", "Performe Interference and second-trip cleaning", false);
68  cmd.add(Clean);
69  TCLAP::SwitchArg BeamBlocking("B", "BeamBlocking", "Performe BeamBlocking correction", false);
70  cmd.add(BeamBlocking);
71  TCLAP::SwitchArg BlocNoCor("b", "BlocNoCor", "Questo non so cosa sia", false);
72  cmd.add(BlocNoCor);
73  TCLAP::SwitchArg Anaprop("A", "Anaprop", "Performe Anaprop identification algorithm", false);
74  cmd.add(Anaprop);
75 
76  TCLAP::SwitchArg IntermediateProd("I", "SaveIntermediateProduct", "Save additional product at intermediate processing level's", false);
77  cmd.add(IntermediateProd);
78  TCLAP::SwitchArg SaveBothRanges("S", "SaveBothRanges", "Save products at both processing ranges (128km ad 256 km)", false);
79  cmd.add(SaveBothRanges);
80  TCLAP::SwitchArg SaveFullResProd("F", "SaveFullResProd", "Save product at fullsize resolution", false);
81  cmd.add(SaveFullResProd);
82 
83 
84 
85 
86  //
87  // Parse the command line.
88  //
89  cmd.parse(argc,argv);
90 
91 //
92 // check variables
93 //
94 
95  opt->filename=filename.getValue();
96  opt->filetype=filetype.getValue();
97  opt->sito=sito.getValue();
98 // if (Short.isSet()) opt->do_medium=false;
99  opt->do_medium=Medium.getValue();
100  opt->do_anaprop=Anaprop.getValue();
101  opt->do_quality=Quality.getValue();
102  opt->do_beamblocking=BeamBlocking.getValue();
103  opt->do_declut=Declut.getValue();
104  opt->do_bloccor=BlocNoCor.getValue();
105  opt->do_vpr=VPR.getValue();
106  opt->do_clean=Clean.getValue();
107  opt->do_class=Class.getValue();
108  opt->do_devel=Stampe.getValue();
109  opt->do_readStaticMap=StaticMap.getValue();
110  opt->data_in_odim=OdimFormat.getValue();
111  opt->do_intermediateProd=IntermediateProd.getValue();
112  opt->do_SaveBothRanges=SaveBothRanges.getValue();
113  opt->do_SaveFullRes=SaveFullResProd.getValue();
114 
115  } catch ( TCLAP::ArgException& e )
116  { std::cout << "ERROR: " << e.error() << " " << e.argId() << std::endl; }
117 
118  return;
119 }
120 
121 
122 void PrintOptions(struct CUM_BAC_CLOPT *opt){
123 
124  std::cout <<"Filename :"<<opt->filename.c_str()<<std::endl;
125  std::cout <<"Filetype :"<<opt->filetype<<std::endl;
126  std::cout <<"Sito :"<<opt->sito.c_str()<<std::endl;
127  std::cout <<"do_medium :"<<opt->do_medium<<std::endl;
128  std::cout <<"do_quality :"<<opt->do_quality<<std::endl;
129  std::cout <<"do_beamblocking :"<<opt->do_beamblocking<<std::endl;
130  std::cout <<"do_declutter :"<<opt->do_declut<<std::endl;
131  std::cout <<"do_bloccor"<<opt->do_bloccor<<std::endl;
132  std::cout <<"do_vpr"<<opt->do_vpr<<std::endl;
133  std::cout <<"do_clean"<<opt->do_clean<<std::endl;
134  std::cout <<"do_class :"<<opt->do_class<<std::endl;
135  std::cout <<"do_devel :"<<opt->do_devel<<std::endl;
136  std::cout <<"do_readStaticMap"<<opt->do_readStaticMap<<std::endl;
137  std::cout <<"do_intermediateProd"<<opt->do_intermediateProd<<std::endl;
138  std::cout <<"do_SaveBothRanges"<< opt->do_SaveBothRanges <<std::endl;
139  std::cout <<"do_SaveFullRes"<< opt->do_SaveFullRes <<std::endl;
140 
141  return ;
142 }
143 
144