netconvert_main.cpp File Reference


Detailed Description

Author:
Daniel Krajzewicz
Date:
Tue, 20 Nov 2001
Version:
Id
netconvert_main.cpp 8386 2010-03-05 22:29:33Z behrisch

Definition in file netconvert_main.cpp.

#include <config.h>
#include <iostream>
#include <string>
#include <netbuild/NBNetBuilder.h>
#include <netimport/NIOptionsIO.h>
#include <netimport/NILoader.h>
#include <netbuild/NBTypeCont.h>
#include <netbuild/NBEdgeCont.h>
#include <netbuild/NBNodeCont.h>
#include <netbuild/NBDistrictCont.h>
#include <netbuild/NBTrafficLightLogicCont.h>
#include <netbuild/NBDistribution.h>
#include <utils/options/OptionsIO.h>
#include <utils/options/OptionsCont.h>
#include <utils/common/UtilExceptions.h>
#include <utils/common/RandHelper.h>
#include <utils/common/SystemFrame.h>
#include <utils/common/MsgHandler.h>
#include <utils/xml/XMLSubSys.h>
#include <utils/iodevices/OutputDevice.h>

Go to the source code of this file.

Functions

int main (int argc, char **argv)


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 64 of file netconvert_main.cpp.

References NBNetBuilder::applyOptions(), NBNetBuilder::buildLoaded(), NIOptionsIO::checkOptions(), NBDistribution::clear(), MsgHandler::clear(), SystemFrame::close(), OutputDevice::closeAll(), NIOptionsIO::fillOptions(), OptionsCont::getBool(), MsgHandler::getErrorInstance(), OptionsIO::getOptions(), OptionsCont::getOptions(), MsgHandler::inform(), XMLSubSys::init(), MsgHandler::initOutputOptions(), RandHelper::initRandGlobal(), NILoader::load(), OptionsCont::processMetaOptions(), OptionsCont::setApplicationDescription(), and OptionsCont::setApplicationName().

00064                             {
00065     OptionsCont &oc = OptionsCont::getOptions();
00066     // give some application descriptions
00067     oc.setApplicationDescription("Road network importer / builder for the road traffic simulation SUMO.");
00068     oc.setApplicationName("netconvert", "SUMO netconvert Version " + (std::string)VERSION_STRING);
00069     int ret = 0;
00070     try {
00071         XMLSubSys::init(false);
00072         NIOptionsIO::fillOptions();
00073         OptionsIO::getOptions(true, argc, argv);
00074         if (oc.processMetaOptions(argc < 2)) {
00075             SystemFrame::close();
00076             return 0;
00077         }
00078         MsgHandler::initOutputOptions();
00079         if (!NIOptionsIO::checkOptions()) throw ProcessError();
00080         RandHelper::initRandGlobal();
00081         NBNetBuilder nb;
00082         nb.applyOptions(oc);
00083         // load data
00084         NILoader nl(nb);
00085         nl.load(oc);
00086         if (oc.getBool("dismiss-loading-errors")) {
00087             MsgHandler::getErrorInstance()->clear();
00088         }
00089         // check whether any errors occured
00090         if (MsgHandler::getErrorInstance()->wasInformed()) {
00091             throw ProcessError();
00092         }
00093         nb.buildLoaded();
00094     } catch (ProcessError &e) {
00095         if (std::string(e.what())!=std::string("Process Error") && std::string(e.what())!=std::string("")) {
00096             MsgHandler::getErrorInstance()->inform(e.what());
00097         }
00098         MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
00099         ret = 1;
00100 #ifndef _DEBUG
00101     } catch (...) {
00102         MsgHandler::getErrorInstance()->inform("Quitting (on unknown error).", false);
00103         ret = 1;
00104 #endif
00105     }
00106     NBDistribution::clear();
00107     OutputDevice::closeAll();
00108     SystemFrame::close();
00109     // report about ending
00110     if (ret==0) {
00111         std::cout << "Success." << std::endl;
00112     }
00113     return ret;
00114 }


Generated on Wed May 5 00:06:38 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6