list_modules.cpp
Go to the documentation of this file.
1 // kate: replace-tabs off; indent-width 4; indent-mode normal
2 // vim: ts=4:sw=4:noexpandtab
3 /*
4 
5 Copyright (c) 2010--2012,
6 François Pomerleau and Stephane Magnenat, ASL, ETHZ, Switzerland
7 You can contact the authors at <f dot pomerleau at gmail dot com> and
8 <stephane at magnenat dot net>
9 
10 All rights reserved.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright
15  notice, this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright
17  notice, this list of conditions and the following disclaimer in the
18  documentation and/or other materials provided with the distribution.
19  * Neither the name of the <organization> nor the
20  names of its contributors may be used to endorse or promote products
21  derived from this software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 DISCLAIMED. IN NO EVENT SHALL ETH-ASL BE LIABLE FOR ANY
27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
38 
39 using namespace std;
40 using namespace PointMatcherSupport;
41 
44 
46 {
47  switch (mode)
48  {
50  cout << "* Bibliography *" << endl << endl;
51  break;
52 
54  cout << "=== Bibliography ===" << endl << endl;
55  break;
56 
57  default:
58  break;
59  }
60 }
61 
62 void dumpWiki(const ParametersDoc& paramsDoc)
63 {
64  cout << endl;
65  if (!paramsDoc.empty())
66  for (BOOST_AUTO(it, paramsDoc.begin()); it != paramsDoc.end(); ++it)
67  {
68  cout << "`" << it->name << "` (default: `" << it->defaultValue << "`";
69  if (!it->minValue.empty())
70  cout << ", min: `" << it->minValue << "`";
71  if (!it->maxValue.empty())
72  cout << ", max: `" << it->maxValue << "`";
73  cout << ")" << endl;
74  cout << endl;
75  cout << " . " << it->doc << endl;
76  cout << endl;
77  }
78  else
79  cout << " . no parameters" << endl;
80 }
81 
82 template<typename R>
83 void dumpRegistrar(const PM& pm, const R& registrar, const std::string& name, CurrentBibliography& bib)
84 {
86  cout << "=== " << name << " ===\n" << endl;
87  else
88  cout << "* " << name << " *\n" << endl;
89  for (BOOST_AUTO(it, registrar.begin()); it != registrar.end(); ++it)
90  {
92  cout << "==== " << it->first << " ====\n" << endl;
93  else
94  cout << it->first << endl;
95 
96  cout << getAndReplaceBibEntries(it->second->description(), bib) << endl;
98  dumpWiki(it->second->availableParameters());
99  else
100  cout << it->second->availableParameters();
101  cout << endl;
102  }
103  cout << endl;
104 }
105 
106 
107 #define DUMP_REGISTRAR_CONTENT(pm, name, bib) \
108  dumpRegistrar(pm, pm.REG(name), # name, bib);
109 
111 {
112  CurrentBibliography bib(mode);
113 
114  DUMP_REGISTRAR_CONTENT(PM::get(), Transformation, bib)
115  DUMP_REGISTRAR_CONTENT(PM::get(), DataPointsFilter, bib)
116  DUMP_REGISTRAR_CONTENT(PM::get(), Matcher, bib)
117  DUMP_REGISTRAR_CONTENT(PM::get(), OutlierFilter, bib)
118  DUMP_REGISTRAR_CONTENT(PM::get(), ErrorMinimizer, bib)
119  DUMP_REGISTRAR_CONTENT(PM::get(), TransformationChecker, bib)
120  DUMP_REGISTRAR_CONTENT(PM::get(), Inspector, bib)
122 
124  bib.dump(cout);
125 }
126 
127 
128 typedef vector<string> ModuleNameList;
129 
130 template<typename R>
131 void dumpRegistrarSummary(const PM& pm, const R& registrar, const std::string& name, ModuleNameList& nameList)
132 {
133  nameList.push_back(name);
134  for (BOOST_AUTO(it, registrar.begin()); it != registrar.end(); ++it)
135  {
136  // TODO: remove title
137  nameList.push_back(it->first);
138  }
139 }
140 
141 #define DUMP_REGISTRAR_SUMMARY(pm, name, nameList) \
142  dumpRegistrarSummary(pm, pm.REG(name), # name, nameList);
143 
145 {
146  typedef vector<ModuleNameList> ModulesNames;
147 
148  ModulesNames modulesNames;
149  modulesNames.resize(7);
150 
151  DUMP_REGISTRAR_SUMMARY(PM::get(), DataPointsFilter, modulesNames[0])
152  DUMP_REGISTRAR_SUMMARY(PM::get(), Matcher, modulesNames[1])
153  DUMP_REGISTRAR_SUMMARY(PM::get(), OutlierFilter, modulesNames[2])
154  DUMP_REGISTRAR_SUMMARY(PM::get(), ErrorMinimizer, modulesNames[3])
155  DUMP_REGISTRAR_SUMMARY(PM::get(), TransformationChecker, modulesNames[4])
156  DUMP_REGISTRAR_SUMMARY(PM::get(), Inspector, modulesNames[5])
157  DUMP_REGISTRAR_SUMMARY(PM::get(), Logger, modulesNames[6])
158 
159  // strip names and count
160  ModulesNames strippedModulesNames;
161  strippedModulesNames.resize(modulesNames.size());
162  unsigned maxCount(0);
163  for (size_t i(0); i < modulesNames.size(); ++i)
164  {
165  unsigned count(0);
166  for (BOOST_AUTO(jt, modulesNames[i].begin()); jt != modulesNames[i].end(); ++jt)
167  {
168  const string& name(*jt);
169  if (jt == modulesNames[i].begin())
170  {
171  strippedModulesNames[i].push_back(name);
172  count++;
173  }
174  else
175  {
176  string strippedName(name.substr(0, name.length() - (modulesNames[i][0].length())));
177  if ((strippedName != "Null") && (strippedName != "Identity"))
178  {
179  strippedModulesNames[i].push_back(strippedName);
180  count++;
181  }
182  }
183  }
184  maxCount = max(count, maxCount);
185  }
186 
187  // header
188  cout << "\\begin{tabularx}{\\textwidth}{";
189  for (size_t i(0); i<strippedModulesNames.size(); ++i)
190  cout << "l";
191  cout << "}\n\\toprule\n";
192  for (unsigned row(0); row < maxCount; ++row)
193  {
194  for (BOOST_AUTO(it, strippedModulesNames.begin()); it != strippedModulesNames.end(); ++it)
195  {
196  if (row < it->size())
197  {
198  const string& name((*it)[row]);
199  cout << name;
200  }
201  if (it+1 != strippedModulesNames.end())
202  cout << " & ";
203  }
204  if (row == 0)
205  cout << "\\\\\n\\midrule\n";
206  else
207  cout << "\\\\\n";
208  }
209  // footer
210  cout << "\\bottomrule\n\\end{tabularx}\n";
211 }
212 
213 int main(int argc, char *argv[])
214 {
215  // choose bibliography mode
217  if (argc == 2)
218  {
219  const string cmd(argv[1]);
220  if (cmd == "--latexsummary")
221  {
223  listModulesSummary(mode);
224  }
225  else if (cmd == "--roswiki")
226  {
228  listModulesFull(mode);
229  }
230  else if (cmd == "--bibtex")
231  {
233  listModulesFull(mode);
234  }
235  else
236  {
237  cerr << "Invalid command " << cmd << endl;
238  return 1;
239  }
240  }
241  else
242  listModulesFull(mode);
243 
244  return 0;
245 }
PointMatcherSupport::CurrentBibliography::Mode
Mode
Definition: Bibliography.h:53
PointMatcherSupport::getAndReplaceBibEntries
std::string getAndReplaceBibEntries(const std::string &, CurrentBibliography &curBib)
listModulesSummary
void listModulesSummary(const CurrentBibliography::Mode mode)
Definition: list_modules.cpp:144
kitti-run-seq.cmd
string cmd
Definition: kitti-run-seq.py:14
PointMatcher< float >
PointMatcherSupport::Logger
The logger interface, used to output warnings and informations.
Definition: PointMatcher.h:104
main
int main(int argc, char *argv[])
Definition: list_modules.cpp:213
ParametersDoc
PointMatcherSupport::Parametrizable::ParametersDoc ParametersDoc
Definition: list_modules.cpp:42
DUMP_REGISTRAR_CONTENT
#define DUMP_REGISTRAR_CONTENT(pm, name, bib)
Definition: list_modules.cpp:107
testing::internal::string
::std::string string
Definition: gtest.h:1979
printBibliographyHeader
void printBibliographyHeader(const CurrentBibliography::Mode mode)
Definition: list_modules.cpp:45
PM
PointMatcher< float > PM
Definition: list_modules.cpp:43
dumpWiki
void dumpWiki(const ParametersDoc &paramsDoc)
Definition: list_modules.cpp:62
DUMP_REGISTRAR_SUMMARY
#define DUMP_REGISTRAR_SUMMARY(pm, name, nameList)
Definition: list_modules.cpp:141
PointMatcherSupport::Parametrizable::ParametersDoc
std::vector< ParameterDoc > ParametersDoc
The documentation of all parameters.
Definition: Parametrizable.h:144
PointMatcherSupport::CurrentBibliography::ROSWIKI
@ ROSWIKI
Definition: Bibliography.h:56
dumpRegistrarSummary
void dumpRegistrarSummary(const PM &pm, const R &registrar, const std::string &name, ModuleNameList &nameList)
Definition: list_modules.cpp:131
PointMatcherSupport::CurrentBibliography::dump
void dump(std::ostream &os) const
Definition: Bibliography.cpp:217
PointMatcherSupport::CurrentBibliography::NORMAL
@ NORMAL
Definition: Bibliography.h:55
dumpRegistrar
void dumpRegistrar(const PM &pm, const R &registrar, const std::string &name, CurrentBibliography &bib)
Definition: list_modules.cpp:83
listModulesFull
void listModulesFull(const CurrentBibliography::Mode mode)
Definition: list_modules.cpp:110
ModuleNameList
vector< string > ModuleNameList
Definition: list_modules.cpp:128
std
PointMatcherSupport::CurrentBibliography::BIBTEX
@ BIBTEX
Definition: Bibliography.h:57
PointMatcher< float >::get
static const PointMatcher & get()
Return instances.
Definition: Registry.cpp:141
PointMatcherSupport
Functions and classes that are not dependant on scalar type are defined in this namespace.
Definition: Bibliography.cpp:45
PointMatcher.h
public interface
Bibliography.h
PointMatcherSupport::CurrentBibliography::mode
enum PointMatcherSupport::CurrentBibliography::Mode mode
PointMatcherSupport::CurrentBibliography
Definition: Bibliography.h:51


mp2p_icp
Author(s):
autogenerated on Wed Oct 23 2024 02:45:40