SUMO - Simulation of Urban MObility

NLBuilder Class Reference

The main interface for loading a microsim. More...

#include <NLBuilder.h>

Data Structures

class  EdgeFloatTimeLineRetriever_EdgeEffort
class  EdgeFloatTimeLineRetriever_EdgeTravelTime
 Obtains edge efforts from a weights handler and stores them within the edges. More...

Public Member Functions

virtual bool build () throw (ProcessError)
 Builds and initialises the simulation.
 NLBuilder (OptionsCont &oc, MSNet &net, NLEdgeControlBuilder &eb, NLJunctionControlBuilder &jb, NLDetectorBuilder &db, NLHandler &xmlHandler) throw ()
 Constructor.
virtual ~NLBuilder () throw ()
 Destructor.

Protected Member Functions

void buildNet () throw (ProcessError)
 Closes the net building process.
MSRouteLoaderControl * buildRouteLoaderControl (const OptionsCont &oc) throw (ProcessError)
 Builds the route loader control.
bool load (const std::string &mmlWhat)
 Loads a described subpart form the given list of files.

Protected Attributes

NLDetectorBuilder & myDetectorBuilder
 The detector control builder to use.
NLEdgeControlBuilder & myEdgeBuilder
 The edge control builder to use.
NLJunctionControlBuilder & myJunctionBuilder
 The junction control builder to use.
MSNet & myNet
 The net to fill.
OptionsCont & myOptions
 The options to get the names of the files to load and further information from.
NLHandler & myXMLHandler
 The handler used to parse the net.

Private Member Functions

 NLBuilder (const NLBuilder &s)
 invalidated copy operator
NLBuilder & operator= (const NLBuilder &s)
 invalidated assignment operator

Detailed Description

The main interface for loading a microsim.

It is a black-box where only the options and factories must be supplied on the constructor call. An (empty) instance of the network must be supplied, too, and is filled during loading.

Definition at line 66 of file NLBuilder.h.


Constructor & Destructor Documentation

NLBuilder::NLBuilder ( OptionsCont &  oc,
MSNet &  net,
NLEdgeControlBuilder &  eb,
NLJunctionControlBuilder &  jb,
NLDetectorBuilder &  db,
NLHandler &  xmlHandler 
) throw ()

Constructor.

Parameters:
[in]ocThe options to use
[in,out]netThe network to fill
[in]ebThe builder of edges to use
[in]jbThe builder of junctions to use
[in]dbThe detector builder to use
[in]tbThe trigger builder to use
[in]xmlHandlerThe xml handler to use

Definition at line 104 of file NLBuilder.cpp.

NLBuilder::~NLBuilder ( ) throw () [virtual]

Destructor.

Definition at line 115 of file NLBuilder.cpp.

NLBuilder::NLBuilder ( const NLBuilder &  s) [private]

invalidated copy operator


Member Function Documentation

bool NLBuilder::build ( ) throw (ProcessError) [virtual]

Builds and initialises the simulation.

At first, the network is loaded and the built using "buildNet". If this could be done, additional information is loaded (state dump, weight files, route files, and additional files). If everything could be done, true is returned, otherwise false.

See also:
buildNet
Exceptions:
ProcessErrorIf something fails on network building
Todo:
Again, both returning a bool and throwing an exception; quite inconsistent

Definition at line 119 of file NLBuilder.cpp.

References buildNet(), MsgHandler::endProcessMsg(), SysUtils::getCurrentMillis(), MsgHandler::getErrorInstance(), OptionsCont::getInt(), MsgHandler::getMessageInstance(), OptionsCont::getString(), OptionsCont::getStringVector(), OptionsCont::isDefault(), OptionsCont::isSet(), OptionsCont::isUsableFileList(), load(), myNet, myOptions, PROGRESS_BEGIN_MESSAGE, XMLSubSys::runParser(), OptionsCont::set(), string2time(), time2string(), toString(), MsgHandler::wasInformed(), WRITE_ERROR, WRITE_MESSAGE, and WRITE_WARNING.

Referenced by load(), and GUILoadThread::run().

void NLBuilder::buildNet ( ) throw (ProcessError) [protected]

Closes the net building process.

Builds the microsim-structures which belong to a MSNet using the factories filled while loading. Initialises the network using these structures by calling MSNet::closeBuilding. If an error occurs, all built structures are deleted and a ProcessError is thrown.

Exceptions:
ProcessErrorIf the loaded structures could not be built

Definition at line 198 of file NLBuilder.cpp.

References NLJunctionControlBuilder::build(), NLEdgeControlBuilder::build(), buildRouteLoaderControl(), MSFrame::buildStreams(), NLJunctionControlBuilder::buildTLLogics(), MSNet::closeBuilding(), OptionsCont::getIntVector(), OptionsCont::getString(), OptionsCont::isDefault(), myEdgeBuilder, myJunctionBuilder, myNet, myOptions, TIME2STEPS, and time2string().

Referenced by build().

MSRouteLoaderControl * NLBuilder::buildRouteLoaderControl ( const OptionsCont &  oc) throw (ProcessError) [protected]

Builds the route loader control.

Goes through the list of route files to open defined in the option "route-files" and builds loaders reading these files

Parameters:
[in]ocThe options to read the list of route files to open from
Returns:
The built route loader control
Exceptions:
ProcessErrorIf an error occured

Definition at line 266 of file NLBuilder.cpp.

References FileHelpers::exists().

Referenced by buildNet().

bool NLBuilder::load ( const std::string &  mmlWhat) [protected]

Loads a described subpart form the given list of files.

Assuming the given string to be an option name behind which a list of files is stored, this method invokes an XML reader on all the files set for this option.

Parameters:
[in]mmlWhatThe option to get the file list from
Returns:
Whether loading of all files was successfull

Definition at line 243 of file NLBuilder.cpp.

References MsgHandler::endProcessMsg(), SysUtils::getCurrentMillis(), MsgHandler::getMessageInstance(), OptionsCont::getOptions(), OptionsCont::getStringVector(), gSuppressMessages, myXMLHandler, PROGRESS_BEGIN_MESSAGE, XMLSubSys::runParser(), toString(), and WRITE_MESSAGE.

Referenced by build().

NLBuilder& NLBuilder::operator= ( const NLBuilder &  s) [private]

invalidated assignment operator


Field Documentation

The detector control builder to use.

Definition at line 210 of file NLBuilder.h.

The edge control builder to use.

Definition at line 204 of file NLBuilder.h.

Referenced by buildNet().

The junction control builder to use.

Definition at line 207 of file NLBuilder.h.

Referenced by buildNet().

MSNet& NLBuilder::myNet [protected]

The net to fill.

Definition at line 213 of file NLBuilder.h.

Referenced by build(), and buildNet().

The options to get the names of the files to load and further information from.

Definition at line 201 of file NLBuilder.h.

Referenced by build(), and buildNet().

The handler used to parse the net.

Definition at line 216 of file NLBuilder.h.

Referenced by load().


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines