Ejemplo n.º 1
0
        ArgsParser::ArgsErrorCode parseConfigs(int argc, char **argv)
        {
            ArgsParser& ap = ArgsParser::getInstance();
            PluginConnector& pluginConnector = Environment<>::get().PluginConnector();

            po::options_description simDesc(simulationClass->pluginGetName());
            simulationClass->pluginRegisterHelp(simDesc);
            ap.addOptions(simDesc);

            po::options_description initDesc(initClass->pluginGetName());
            initClass->pluginRegisterHelp(initDesc);
            ap.addOptions(initDesc);

            po::options_description pluginDesc(pluginClass->pluginGetName());
            pluginClass->pluginRegisterHelp(pluginDesc);
            ap.addOptions(pluginDesc);

            // setup all boost::program_options and add to ArgsParser
            BoostOptionsList options = pluginConnector.registerHelp();

            for (BoostOptionsList::const_iterator iter = options.begin();
                 iter != options.end(); ++iter)
            {
                ap.addOptions(*iter);
            }

            // parse environment variables, config files and command line
            return ap.parse(argc, argv);
        }
Ejemplo n.º 2
0
        bool parseConfigs(int argc, char **argv)
        {
            ArgsParser& ap = ArgsParser::getInstance();
            ModuleConnector& module_connector = ModuleConnector::getInstance();

            po::options_description simDesc(simulationClass->moduleGetName());
            simulationClass->moduleRegisterHelp(simDesc);
            ap.addOptions(simDesc);

            po::options_description initDesc(initClass->moduleGetName());
            initClass->moduleRegisterHelp(initDesc);
            ap.addOptions(initDesc);

            po::options_description analyserDesc(analyserClass->moduleGetName());
            analyserClass->moduleRegisterHelp(analyserDesc);
            ap.addOptions(analyserDesc);

            // setup all boost::program_options and add to ArgsParser
            BoostOptionsList options = module_connector.registerHelp();

            for (BoostOptionsList::const_iterator iter = options.begin();
                 iter != options.end(); ++iter)
            {
                ap.addOptions(*iter);
            }

            // parse environment variables, config files and command line
            return ap.parse(argc, argv);
        }