/** \copydoc Option::proceed */ void proceed (const std::list<std::string>& args, IProperties& props) { props.add (0, getName(), args.front()); }
/********************************************************************* ** METHOD : ** PURPOSE : ** INPUT : ** OUTPUT : ** RETURN : ** REMARKS : *********************************************************************/ IProperties* ToolComposite::run (int argc, char* argv[]) { vector<IProperties*> inputs; /** We first parse the options for all tools. */ for (list<Tool*>::iterator it = _tools.begin(); it != _tools.end(); it++) { #if 0 /** We get the parameters from the current parser. */ IProperties* input = (*it)->getParser()->parse (argc, argv); /** We add the input into the vector that gather the tools inputs. */ inputs.push_back (input); #else try { /** We parse the user parameters. */ (*it)->getParser()->parse (argc, argv); IProperties* input = (*it)->getParser()->getProperties() ; /** We add the input into the vector that gather the tools inputs. */ inputs.push_back (input); } catch (OptionFailure& e) { IProperties* input = (*it)->getParser()->getProperties() ; /** We add the input into the vector that gather the tools inputs. */ inputs.push_back (input); // e.getParser().displayErrors (stdout); // e.getParser().displayHelp (stdout); // return NULL; } #endif } IProperties* output = 0; size_t idx = 0; for (list<Tool*>::iterator it = _tools.begin(); it != _tools.end(); it++, idx++) { /** We get the parameters from the current inputs entry. */ IProperties* input = inputs[idx]; /** We may have to add the output of the previous tool to the input of the current tool. * WARNING! The output of the previous tool should have a bigger priority than the * user parameters of the current tool. */ IProperties* actualInput = 0; if (output != 0) { actualInput = new Properties(); actualInput->add (1, output); // output of the previous tool actualInput->add (1, input); // input of the previous tool } else { actualInput = input; } /** We run the tool and get a reference on its output. */ output = (*it)->run (actualInput); /** We add the current tool info to the global properties. */ _info->add (1, (*it)->getInfo()); } /** We return the output properties. */ return _output; }