Eclipse SUMO - Simulation of Urban MObility
NLBuilder Class Reference

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

#include <NLBuilder.h>

Collaboration diagram for NLBuilder:

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 ()
 Builds and initialises the simulation. More...
 
 NLBuilder (OptionsCont &oc, MSNet &net, NLEdgeControlBuilder &eb, NLJunctionControlBuilder &jb, NLDetectorBuilder &db, NLHandler &xmlHandler)
 Constructor. More...
 
virtual ~NLBuilder ()
 Destructor. More...
 

Static Public Member Functions

static MSNetinit ()
 
static void initRandomness ()
 initializes all RNGs More...
 

Protected Member Functions

void buildNet ()
 Closes the net building process. More...
 
SUMORouteLoaderControlbuildRouteLoaderControl (const OptionsCont &oc)
 Builds the route loader control. More...
 
bool load (const std::string &mmlWhat, const bool isNet=false)
 Loads a described subpart form the given list of files. More...
 

Protected Attributes

NLDetectorBuildermyDetectorBuilder
 The detector control builder to use. More...
 
NLEdgeControlBuildermyEdgeBuilder
 The edge control builder to use. More...
 
NLJunctionControlBuildermyJunctionBuilder
 The junction control builder to use. More...
 
MSNetmyNet
 The net to fill. More...
 
OptionsContmyOptions
 The options to get the names of the files to load and further information from. More...
 
NLHandlermyXMLHandler
 The handler used to parse the net. More...
 

Private Member Functions

 NLBuilder (const NLBuilder &s)
 invalidated copy operator More...
 
NLBuilderoperator= (const NLBuilder &s)
 invalidated assignment operator More...
 

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 60 of file NLBuilder.h.

Constructor & Destructor Documentation

◆ NLBuilder() [1/2]

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

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 105 of file NLBuilder.cpp.

◆ ~NLBuilder()

NLBuilder::~NLBuilder ( )
virtual

Destructor.

Definition at line 116 of file NLBuilder.cpp.

◆ NLBuilder() [2/2]

NLBuilder::NLBuilder ( const NLBuilder s)
private

invalidated copy operator

Member Function Documentation

◆ build()

bool NLBuilder::build ( )
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 120 of file NLBuilder.cpp.

References buildNet(), OptionsCont::getBool(), MSNet::getEdgeControl(), MsgHandler::getErrorInstance(), TraCIServer::getInstance(), MSNet::getShapeContainer(), OptionsCont::getString(), OptionsCont::getStringVector(), MSStateHandler::getTime(), MSNet::getTLSControl(), NLHandler::haveSeenAdditionalSpeedRestrictions(), NLHandler::haveSeenInternalEdge(), OptionsCont::isDefault(), OptionsCont::isSet(), OptionsCont::isUsableFileList(), load(), ShapeHandler::loadFiles(), myNet, myOptions, myXMLHandler, NLHandler::networkVersion(), PROGRESS_BEGIN_TIME_MESSAGE, PROGRESS_TIME_MESSAGE, XMLSubSys::runParser(), OptionsCont::set(), MSEdgeControl::setAdditionalRestrictions(), TraCIServer::setTargetTime(), string2time(), MSTLLogicControl::switchOffAll(), time2string(), MsgHandler::wasInformed(), WRITE_MESSAGE, and WRITE_WARNING.

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

◆ buildNet()

void NLBuilder::buildNet ( )
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 280 of file NLBuilder.cpp.

References NLJunctionControlBuilder::build(), NLEdgeControlBuilder::build(), buildRouteLoaderControl(), MSFrame::buildStreams(), NLJunctionControlBuilder::buildTLLogics(), MSNet::closeBuilding(), OptionsCont::getIntVector(), OptionsCont::getString(), OptionsCont::getStringVector(), NLHandler::haveSeenInternalEdge(), NLHandler::haveSeenNeighs(), OptionsCont::isSet(), NLHandler::lefthand(), myEdgeBuilder, myJunctionBuilder, myNet, myOptions, myXMLHandler, NLHandler::networkVersion(), MSJunctionControl::postloadInitContainer(), TIME2STEPS, time2string(), and WRITE_ERROR.

Referenced by build().

◆ buildRouteLoaderControl()

SUMORouteLoaderControl * NLBuilder::buildRouteLoaderControl ( const OptionsCont oc)
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 occurred

Definition at line 351 of file NLBuilder.cpp.

References SUMORouteLoaderControl::add(), OptionsCont::getString(), OptionsCont::getStringVector(), FileHelpers::isReadable(), OptionsCont::isSet(), and string2time().

Referenced by buildNet().

◆ init()

◆ initRandomness()

void NLBuilder::initRandomness ( )
static

◆ load()

bool NLBuilder::load ( const std::string &  mmlWhat,
const bool  isNet = false 
)
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
[in]isNetwhether a network gets loaded
Returns
Whether loading of all files was successfull

Definition at line 333 of file NLBuilder.cpp.

References OptionsCont::getStringVector(), OptionsCont::isUsableFileList(), myOptions, myXMLHandler, PROGRESS_BEGIN_TIME_MESSAGE, PROGRESS_TIME_MESSAGE, XMLSubSys::runParser(), and WRITE_MESSAGE.

Referenced by build().

◆ operator=()

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

invalidated assignment operator

Field Documentation

◆ myDetectorBuilder

NLDetectorBuilder& NLBuilder::myDetectorBuilder
protected

The detector control builder to use.

Definition at line 213 of file NLBuilder.h.

◆ myEdgeBuilder

NLEdgeControlBuilder& NLBuilder::myEdgeBuilder
protected

The edge control builder to use.

Definition at line 207 of file NLBuilder.h.

Referenced by buildNet().

◆ myJunctionBuilder

NLJunctionControlBuilder& NLBuilder::myJunctionBuilder
protected

The junction control builder to use.

Definition at line 210 of file NLBuilder.h.

Referenced by buildNet().

◆ myNet

MSNet& NLBuilder::myNet
protected

The net to fill.

Definition at line 216 of file NLBuilder.h.

Referenced by NLBuilder::EdgeFloatTimeLineRetriever_EdgeTravelTime::addEdgeWeight(), build(), and buildNet().

◆ myOptions

OptionsCont& NLBuilder::myOptions
protected

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

Definition at line 204 of file NLBuilder.h.

Referenced by build(), buildNet(), and load().

◆ myXMLHandler

NLHandler& NLBuilder::myXMLHandler
protected

The handler used to parse the net.

Definition at line 219 of file NLBuilder.h.

Referenced by build(), buildNet(), and load().


The documentation for this class was generated from the following files: