int main(int argc, char * argv[]) { //set up some default application parameters //what's the name of the configuration file that the application //should look in if it needs to read parameters? const char * sMissionFile = "controller.moos"; //under what name shoud the application register with the MOOSDB? const char * sMOOSName = "desiredTrajectory"; switch(argc) { case 3: //command line says don't register with default name sMOOSName = argv[2]; case 2: //command line says don't use default "mission.moos" config file sMissionFile = argv[1]; } //make an application ExampleApp TheApp; //run forever pasing registration name and mission file parameters TheApp.Run(sMOOSName,sMissionFile); //probably will never get here.. return 0; }
int main(int argc, char * argv[]) { //here we do some command line parsing... MOOS::CommandLineParser P(argc,argv); //mission file could be first free parameter std::string mission_file = P.GetFreeParameter(0, "Mission.moos"); //app name can be the second free parameter std::string app_name = P.GetFreeParameter(1, "ex1010"); ExampleApp App; return App.Run(app_name,mission_file,argc,argv); }
int main(int argc, char* args[]) { ExampleApp app; return app.hello(); }