source: src/UIElements/CommandLineUI/CommandLineParser.cpp@ f96874

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since f96874 was 94d5ac6, checked in by Frederik Heber <heber@…>, 12 years ago

FIX: As we use GSL internally, we are as of now required to use GPL v2 license.

  • GNU Scientific Library is used at every place in the code, especially the sub-package LinearAlgebra is based on it which in turn is used really everywhere in the remainder of MoleCuilder. Hence, we have to use the GPL license for the whole of MoleCuilder. In effect, GPL's COPYING was present all along and stated the terms of the GPL v2 license.
  • Hence, I added the default GPL v2 disclaimer to every source file and removed the note about a (actually missing) LICENSE file.
  • also, I added a help-redistribute action which again gives the disclaimer of the GPL v2.
  • also, I changed in the disclaimer that is printed at every program start in builder_init.cpp.
  • TEST: Added check on GPL statement present in every module to test CodeChecks project-disclaimer.
  • Property mode set to 100644
File size: 20.8 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
5 *
6 *
7 * This file is part of MoleCuilder.
8 *
9 * MoleCuilder is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * MoleCuilder is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/*
24 * CommandLineParser.cpp
25 *
26 * Created on: May 8, 2010
27 * Author: heber
28 */
29
30// include config.h
31#ifdef HAVE_CONFIG_H
32#include <config.h>
33#endif
34
35#include "CodePatterns/MemDebug.hpp"
36
37#include <boost/filesystem.hpp>
38#include <boost/program_options.hpp>
39#include <fstream>
40#include <iostream>
41#include <set>
42#include <map>
43
44#include "Actions/Action.hpp"
45#include "Actions/ActionRegistry.hpp"
46#include "Actions/ActionTrait.hpp"
47#include "Actions/OptionRegistry.hpp"
48#include "Actions/OptionTrait.hpp"
49#include "Actions/Values.hpp"
50#include "CodePatterns/Log.hpp"
51#include "CodePatterns/Verbose.hpp"
52#include "CommandLineParser.hpp"
53#include "CommandLineParser_validate.hpp"
54
55#include "CodePatterns/Singleton_impl.hpp"
56
57using namespace MoleCuilder;
58
59class element;
60
61/** Constructor of class CommandLineParser.
62 *
63 */
64CommandLineParser::CommandLineParser() :
65 analysis("Analysis options"),
66 atom("Atom options"),
67 command("Command options"),
68 fill("fill options"),
69 fragmentation("Fragmentation options"),
70 graph("Graph options"),
71 molecule("Molecule options"),
72 options("Secondary options"),
73 parser("Parser options"),
74 selection("Selection options"),
75 tesselation("Tesselation options"),
76 world("World options")
77{
78 // put all options lists into a lookup
79 CmdParserLookup["analysis"] = &analysis;
80 CmdParserLookup["atom"] = &atom;
81 CmdParserLookup["command"] = &command;
82 CmdParserLookup["edit"] = &edit;
83 CmdParserLookup["fill"] = &fill;
84 CmdParserLookup["fragmentation"] = &fragmentation;
85 CmdParserLookup["graph"] = &graph;
86 CmdParserLookup["options"] = &options;
87 CmdParserLookup["molecule"] = &molecule;
88 CmdParserLookup["parser"] = &parser;
89 CmdParserLookup["selection"] = &selection;
90 CmdParserLookup["tesselation"] = &tesselation;
91 CmdParserLookup["world"] = &world;
92}
93
94/** Destructor of class CommandLineParser.
95 *
96 */
97CommandLineParser::~CommandLineParser()
98{}
99
100/** Initializes command arguments to accept.
101 * Goes through ActionRegistry and puts all actions therein into the map.
102 */
103void CommandLineParser::InitializeCommandArguments()
104{
105 // we need a list of already added options, otherwise we get ambigious exceptions
106 std::set<std::string> AlreadyAddedOptionNames;
107
108 ActionRegistry &AR = ActionRegistry::getInstance();
109 bool ActionAlreadyAdded_flag = false;
110 for (ActionRegistry::const_iterator actioniter = AR.getBeginIter(); actioniter != AR.getEndIter(); ++actioniter) {
111 ActionAlreadyAdded_flag = false;
112 Action* const currentAction = actioniter->second;
113 //std::cout << "Current Action to initialize is: " << actioniter->first << std::endl;
114
115 for (ActionTrait::options_const_iterator optioniter = currentAction->Traits.getBeginIter();
116 optioniter != currentAction->Traits.getEndIter();
117 ++optioniter) {
118 if (optioniter->first == actioniter->first)
119 ActionAlreadyAdded_flag = true;
120 ASSERT( OptionRegistry::getInstance().isOptionPresentByName(optioniter->first),
121 "CommandLineParser::Init() - Option "+optioniter->first+" not present in OptionRegistry." );
122 const OptionTrait* const currentOption = OptionRegistry::getInstance().getOptionByName(optioniter->first);
123
124 if (AlreadyAddedOptionNames.find(optioniter->first) == AlreadyAddedOptionNames.end()) {
125 // add the option
126// std::cout << "Registering Option "
127// << currentOption->getName()
128// << " with type '" << currentOption->getTypeName() << "' "
129// << " with description '" << currentOption->getDescription() << "' ";
130// if (currentOption->hasShortForm())
131// std::cout << ", with short form " << currentOption->getShortForm();
132// else
133// std::cout << ", with no short form ";
134// if (currentOption->hasDefaultValue())
135// std::cout << ", with default value " << currentOption->getDefaultValue();
136// else
137// std::cout << ", with no default value ";
138// std::cout << std::endl;
139
140 AddOptionToParser(currentOption, (CmdParserLookup["options"]));
141
142 AlreadyAddedOptionNames.insert(optioniter->first);
143 } else {
144// std::cout << "Option " << currentOption->getName() << " already registered." << std::endl;
145 }
146 }
147
148 if (!ActionAlreadyAdded_flag) {
149 // add the action
150// std::cout << "Registering Action "
151// << currentAction->Traits.getName()
152// << " in menu " << currentAction->Traits.getMenuName()
153// << " with type '" << currentAction->Traits.getTypeName() << "' "
154// << " with description '" << currentAction->Traits.getDescription() << "' ";
155// if (currentAction->Traits.hasShortForm())
156// std::cout << ", with short form " << currentAction->Traits.getShortForm();
157// else
158// std::cout << ", with no short form ";
159// if (currentAction->Traits.hasDefaultValue())
160// std::cout << ", with default value " << currentAction->Traits.getDefaultValue();
161// else
162// std::cout << ", with no default value ";
163// std::cout << std::endl;
164
165 ASSERT(CmdParserLookup.find(currentAction->Traits.getMenuName()) != CmdParserLookup.end(),
166 "CommandLineParser: boost::program_options::options_description for this Action not present.");
167 AddOptionToParser(dynamic_cast<const OptionTrait * const>(&(currentAction->Traits)),(CmdParserLookup[currentAction->Traits.getMenuName()]));
168 }
169 }
170 // note: positioning is not important on the command line
171}
172
173/** Adds an Action or Option to the CommandLineParser.
174 * Note that Action is derived from Option(Trait)
175 *
176 * This ugly switch function is necessary because of the compile-time problem:
177 * po::value<T> has to be instantiated at compile-time however we do know the type not until run-time.
178 * Not even a templated function like po::value<T> getProgramOptionValuefromType() does help, specialized
179 * to each available type, as the signatures of all the functions differ. Hence, they cannot not put into
180 * one type_info -> po::value<T> map ...
181 *
182 * \param *currentOption pointer to Action/Option to add
183 * \param *OptionList program_options list to add to
184 */
185void CommandLineParser::AddOptionToParser(const OptionTrait * const currentOption, po::options_description* OptionList)
186{
187 // check whether dynamic_cast in Init() suceeded
188 ASSERT(currentOption != NULL, "CommandLineParser::AddOptionToParser() - currentOption is NULL!");
189 // add other options
190// std::cout << "Adding Action " << currentOption->getName() << " with type "
191// << currentOption->getType()->name() << ", " << (currentOption->hasDefaultValue() ? "with" : "without")
192// << " default value, and KeyandShortform " << currentOption->getKeyAndShortForm()
193// << " to CommandLineParser." << std::endl;
194 switch(TypeToEnums.getEnumforType(currentOption->getType())) {
195 default:
196 case TypeEnumContainer::NoneType:
197 OptionList->add_options()
198 (currentOption->getKeyAndShortForm().c_str(), currentOption->getDescription().c_str())
199 ;
200 break;
201 case TypeEnumContainer::BooleanType:
202 OptionList->add_options()
203 (currentOption->getKeyAndShortForm().c_str(),
204 currentOption->hasDefaultValue() ?
205 po::value < bool >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) :
206 po::value < bool >(),
207 currentOption->getDescription().c_str())
208 ;
209 break;
210 case TypeEnumContainer::FileType:
211 OptionList->add_options()
212 (currentOption->getKeyAndShortForm().c_str(),
213// currentOption->hasDefaultValue() ?
214// po::value < boost::filesystem::path >()->default_value(boost::lexical_cast<boost::filesystem::path>(currentOption->getDefaultValue().c_str())) :
215 po::value < boost::filesystem::path >(),
216 currentOption->getDescription().c_str())
217 ;
218 break;
219 case TypeEnumContainer::ListOfFilesType:
220 OptionList->add_options()
221 (currentOption->getKeyAndShortForm().c_str(),
222// currentOption->hasDefaultValue() ?
223// po::value < std::vector<boost::filesystem::path> >()->default_value(boost::lexical_cast< std::vector<boost::filesystem::path> >(currentOption->getDefaultValue().c_str())) :
224 po::value < std::vector<boost::filesystem::path> >()->multitoken(),
225 currentOption->getDescription().c_str())
226 ;
227 break;
228 case TypeEnumContainer::IntegerType:
229 OptionList->add_options()
230 (currentOption->getKeyAndShortForm().c_str(),
231 currentOption->hasDefaultValue() ?
232 po::value < int >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) :
233 po::value < int >(),
234 currentOption->getDescription().c_str())
235 ;
236 break;
237 case TypeEnumContainer::ListOfIntegersType:
238 OptionList->add_options()
239 (currentOption->getKeyAndShortForm().c_str(),
240// currentOption->hasDefaultValue() ?
241// po::value < std::vector<int> >()->default_value(boost::lexical_cast< std::vector<int> >(currentOption->getDefaultValue().c_str())) :
242 po::value < std::vector<int> >()->multitoken(),
243 currentOption->getDescription().c_str())
244 ;
245 break;
246 case TypeEnumContainer::UnsignedIntegerType:
247 OptionList->add_options()
248 (currentOption->getKeyAndShortForm().c_str(),
249 currentOption->hasDefaultValue() ?
250 po::value < unsigned int >()->default_value(boost::lexical_cast<unsigned int>(currentOption->getDefaultValue().c_str())) :
251 po::value < unsigned int >(),
252 currentOption->getDescription().c_str())
253 ;
254 break;
255 case TypeEnumContainer::ListOfUnsignedIntegersType:
256 OptionList->add_options()
257 (currentOption->getKeyAndShortForm().c_str(),
258// currentOption->hasDefaultValue() ?
259// po::value < std::vector<unsigned int> >()->default_value(boost::lexical_cast< std::vector<unsigned int> >(currentOption->getDefaultValue().c_str())) :
260 po::value < std::vector<unsigned int> >()->multitoken(),
261 currentOption->getDescription().c_str())
262 ;
263 break;
264 case TypeEnumContainer::DoubleType:
265 OptionList->add_options()
266 (currentOption->getKeyAndShortForm().c_str(),
267 currentOption->hasDefaultValue() ?
268 po::value < double >()->default_value(boost::lexical_cast<double>(currentOption->getDefaultValue().c_str())) :
269 po::value < double >(),
270 currentOption->getDescription().c_str())
271 ;
272 break;
273 case TypeEnumContainer::ListOfDoublesType:
274 OptionList->add_options()
275 (currentOption->getKeyAndShortForm().c_str(),
276// currentOption->hasDefaultValue() ?
277// po::value < std::vector<double> >()->default_value(boost::lexical_cast< std::vector<double> >(currentOption->getDefaultValue().c_str())) :
278 po::value < std::vector<double> >()->multitoken(),
279 currentOption->getDescription().c_str())
280 ;
281 break;
282 case TypeEnumContainer::StringType:
283 OptionList->add_options()
284 (currentOption->getKeyAndShortForm().c_str(),
285 currentOption->hasDefaultValue() ?
286 po::value < std::string >()->default_value(currentOption->getDefaultValue()) :
287 po::value < std::string >(),
288 currentOption->getDescription().c_str())
289 ;
290 break;
291 case TypeEnumContainer::ListOfStringsType:
292 OptionList->add_options()
293 (currentOption->getKeyAndShortForm().c_str(),
294// currentOption->hasDefaultValue() ?
295// po::value < std::vector<std::string> >()->default_value(boost::lexical_cast< std::vector<std::string> >(currentOption->getDefaultValue().c_str())) :
296 po::value < std::vector<std::string> >()->multitoken(),
297 currentOption->getDescription().c_str())
298 ;
299 break;
300 case TypeEnumContainer::VectorType:
301 OptionList->add_options()
302 (currentOption->getKeyAndShortForm().c_str(),
303// currentOption->hasDefaultValue() ?
304// po::value < VectorValue >()->default_value(boost::lexical_cast<VectorValue>(currentOption->getDefaultValue().c_str())) :
305 po::value < VectorValue >(),
306 currentOption->getDescription().c_str())
307 ;
308 break;
309 case TypeEnumContainer::ListOfVectorsType:
310 OptionList->add_options()
311 (currentOption->getKeyAndShortForm().c_str(),
312// currentOption->hasDefaultValue() ?
313// po::value < std::vector<VectorValue> >()->default_value(boost::lexical_cast< std::vector<VectorValue> >(currentOption->getDefaultValue().c_str())) :
314 po::value < std::vector<VectorValue> >()->multitoken(),
315 currentOption->getDescription().c_str())
316 ;
317 break;
318 case TypeEnumContainer::MoleculeType:
319 OptionList->add_options()
320 (currentOption->getKeyAndShortForm().c_str(),
321// currentOption->hasDefaultValue() ?
322// po::value < const molecule * >()->default_value(boost::lexical_cast<const molecule *>(currentOption->getDefaultValue().c_str())) :
323 po::value < int >(),
324 currentOption->getDescription().c_str())
325 ;
326 break;
327 case TypeEnumContainer::ListOfMoleculesType:
328 OptionList->add_options()
329 (currentOption->getKeyAndShortForm().c_str(),
330// currentOption->hasDefaultValue() ?
331// po::value < std::vector<const molecule *> >()->default_value(boost::lexical_cast< std::vector<const molecule *> >(currentOption->getDefaultValue().c_str())) :
332 po::value < std::vector<int> >()->multitoken(),
333 currentOption->getDescription().c_str())
334 ;
335 break;
336 case TypeEnumContainer::AtomType:
337 OptionList->add_options()
338 (currentOption->getKeyAndShortForm().c_str(),
339 currentOption->hasDefaultValue() ?
340 po::value < int >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) :
341 po::value < int >(),
342 currentOption->getDescription().c_str())
343 ;
344 break;
345 case TypeEnumContainer::ListOfAtomsType:
346 OptionList->add_options()
347 (currentOption->getKeyAndShortForm().c_str(),
348// currentOption->hasDefaultValue() ?
349// po::value < std::vector<const atom *> >()->default_value(boost::lexical_cast< std::vector<const atom *> >(currentOption->getDefaultValue().c_str())) :
350 po::value < std::vector<int> >()->multitoken(),
351 currentOption->getDescription().c_str())
352 ;
353 break;
354 case TypeEnumContainer::ElementType:
355 OptionList->add_options()
356 (currentOption->getKeyAndShortForm().c_str(),
357// currentOption->hasDefaultValue() ?
358// po::value < const element * >()->default_value(boost::lexical_cast<const element *>(currentOption->getDefaultValue().c_str())) :
359 po::value < int >(),
360 currentOption->getDescription().c_str())
361 ;
362 break;
363 case TypeEnumContainer::ListOfElementsType:
364 OptionList->add_options()
365 (currentOption->getKeyAndShortForm().c_str(),
366// currentOption->hasDefaultValue() ?
367// po::value < std::vector<const element *> >()->default_value(boost::lexical_cast< std::vector<const element *> >(currentOption->getDefaultValue().c_str())) :
368 po::value < std::vector<int> >()->multitoken(),
369 currentOption->getDescription().c_str())
370 ;
371 break;
372 case TypeEnumContainer::RandomNumberDistribution_ParametersType:
373 OptionList->add_options()
374 (currentOption->getKeyAndShortForm().c_str(),
375 currentOption->hasDefaultValue() ?
376 po::value < std::string >()->default_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str())) :
377 po::value < std::string >(),
378 currentOption->getDescription().c_str())
379 ;
380 break;
381 case TypeEnumContainer::RealSpaceMatrixType:
382 OptionList->add_options()
383 (currentOption->getKeyAndShortForm().c_str(),
384// currentOption->hasDefaultValue() ?
385// po::value < RealSpaceMatrixValue >()->default_value(boost::lexical_cast<BoxValue>(currentOption->getDefaultValue().c_str())) :
386 po::value < RealSpaceMatrixValue >(),
387 currentOption->getDescription().c_str())
388 ;
389 break;
390 }
391}
392
393/** States whether there are command line arguments.
394 * \return true - there are none, false - there is at least one command line argument
395 */
396bool CommandLineParser::isEmpty()
397{
398 return vm.empty();
399}
400
401/** Sets the options.
402 * \param _argc arg count from main()
403 * \param **_argv argument array from main()
404 */
405void CommandLineParser::setOptions(int _argc, char **_argv)
406{
407 argc = _argc;
408 argv = _argv;
409 config_file_options.add(options);
410 // append all option_descriptions to both cmdline_options and visible
411 for (CmdParserLookupMap::iterator iter = CmdParserLookup.begin();
412 iter != CmdParserLookup.end();
413 ++iter) {
414 cmdline_options.add(*(iter->second));
415 visible.add(*(iter->second));
416 }
417}
418
419/** Parses the command line arguments.
420 * Calls program_options::store() and program_options::notify()
421 */
422void CommandLineParser::Parse()
423{
424 po::store(po::command_line_parser(argc,argv).options(cmdline_options).run(), vm);
425 std::ifstream input;
426 input.open("example.cfg");
427 if (!input.fail())
428 po::store(po::parse_config_file(input, config_file_options), vm);
429 input.close();
430 po::notify(vm);
431}
432
433/** Scan the argument list for -a or --arguments and store their order for later use.
434 */
435void CommandLineParser::scanforSequenceOfArguments()
436{
437 std::map <std::string, std::string> ShortFormToActionMap = getShortFormToActionMap();
438 LOG(0, "Scanning command line arguments and recognizing Actions.");
439 // go through all arguments
440 for (int i=1;i<argc;i++) {
441 LOG(2, "Checking on " << argv[i]);
442 // check whether they
443 if (argv[i][0] == '-') { // .. begin with -
444 LOG(2, "Possible argument: " << argv[i]);
445 if (argv[i][1] == '-') { // .. or --
446 LOG(1, "Putting " << argv[i] << " into the sequence.");
447 SequenceOfActions.push_back(&(argv[i][2]));
448 // .. and check that next letter is not numeric, if so insert
449 } else if (((argv[i][1] < '0') || (argv[i][1] > '9')) && ((argv[i][1] != '.'))) {
450 std::map <std::string, std::string>::iterator iter = ShortFormToActionMap.find(&(argv[i][1]));
451 if (iter != ShortFormToActionMap.end()) {
452 LOG(1, "Putting " << iter->second << " for " << iter->first << " into the sequence.");
453 SequenceOfActions.push_back(iter->second);
454 }
455 }
456 }
457 }
458}
459
460/** Makes the Parser parse the command line options with current known options.
461 * \param _argc arg count from main()
462 * \param **_argv argument array from main()
463 */
464void CommandLineParser::Run(int _argc, char **_argv)
465{
466 setOptions(_argc,_argv);
467 Parse();
468 scanforSequenceOfArguments();
469}
470
471/** Go through all Actions and create a map from short form to their token.
472 * \return map from Action's ShortForm to token.
473 */
474std::map <std::string, std::string> CommandLineParser::getShortFormToActionMap() const
475{
476 std::map <std::string, std::string> result;
477
478 ActionRegistry &AR = ActionRegistry::getInstance();
479 for (ActionRegistry::const_iterator iter = AR.getBeginIter(); iter != AR.getEndIter(); ++iter)
480 if ((iter->second)->Traits.hasShortForm()) {
481 ASSERT(result.find((iter->second)->Traits.getShortForm()) == result.end(),
482 "Short form "+toString((iter->second)->Traits.getShortForm())+
483 " for action "+toString(iter->first)+" already present from "+
484 std::string(result[(iter->second)->Traits.getShortForm()])+"!");
485 result[(iter->second)->Traits.getShortForm()] = (iter->second)->getName();
486 }
487
488 return result;
489}
490
491CONSTRUCT_SINGLETON(CommandLineParser)
Note: See TracBrowser for help on using the repository browser.