Eclipse SUMO - Simulation of Urban MObility
NLBuilder Class Reference

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

#include <NLBuilder.h>

Collaboration diagram for NLBuilder:
[legend]

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 (const bool isLibsumo=false)
 
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 58 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 104 of file NLBuilder.cpp.

◆ ~NLBuilder()

NLBuilder::~NLBuilder ( )
virtual

Destructor.

Definition at line 115 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 119 of file NLBuilder.cpp.

References MSEdge::addSuccessor(), NamedObjectCont< T >::begin(), NLEdgeControlBuilder::buildEdge(), buildNet(), CONNECTOR, MSEdge::dictionary(), NamedObjectCont< T >::end(), MSTLLogicControl::getAllLogics(), OptionsCont::getBool(), MSNet::getEdgeControl(), MsgHandler::getErrorInstance(), MSJunction::getIncoming(), TraCIServer::getInstance(), MSNet::getJunctionControl(), MSJunction::getOutgoing(), MSNet::getShapeContainer(), OptionsCont::getString(), OptionsCont::getStringVector(), MSStateHandler::getTime(), MSNet::getTLSControl(), MSGlobals::gUseMesoSim, NLHandler::haveSeenAdditionalSpeedRestrictions(), NLHandler::haveSeenDefaultLength(), NLHandler::haveSeenInternalEdge(), NLHandler::haveSeenMesoEdgeType(), MSEdge::initialize(), OptionsCont::isDefault(), OptionsCont::isSet(), OptionsCont::isUsableFileList(), load(), ShapeHandler::loadFiles(), myEdgeBuilder, myNet, myOptions, myXMLHandler, NLHandler::networkVersion(), PROGRESS_BEGIN_TIME_MESSAGE, PROGRESS_TIME_MESSAGE, XMLSubSys::runParser(), OptionsCont::set(), MSEdgeControl::setAdditionalRestrictions(), MSEdgeControl::setMesoTypes(), MSEdge::setOtherTazConnector(), TraCIServer::stateLoaded(), string2time(), MSTLLogicControl::switchOffAll(), time2string(), WRITE_MESSAGE, WRITE_WARNING, and WRITE_WARNINGF.

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

Here is the caller graph for this function:

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

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

Referenced by build().

Here is the caller graph for this function:

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

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

Referenced by buildNet().

Here is the caller graph for this function:

◆ init()

◆ initRandomness()

void NLBuilder::initRandomness ( )
static

initializes all RNGs

Definition at line 312 of file NLBuilder.cpp.

References MSDevice::getEquipmentRNG(), OptionsCont::getOptions(), MSRouteHandler::getParsingRNG(), MSDevice_ToC::getResponseTimeRNG(), OUProcess::getRNG(), RandHelper::initRandGlobal(), and MSLane::initRNGs().

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

Here is the caller graph for this function:

◆ 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 375 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().

Here is the caller graph for this function:

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

◆ myEdgeBuilder

NLEdgeControlBuilder& NLBuilder::myEdgeBuilder
protected

The edge control builder to use.

Definition at line 205 of file NLBuilder.h.

Referenced by build(), and buildNet().

◆ myJunctionBuilder

NLJunctionControlBuilder& NLBuilder::myJunctionBuilder
protected

The junction control builder to use.

Definition at line 208 of file NLBuilder.h.

Referenced by buildNet().

◆ myNet

MSNet& NLBuilder::myNet
protected

The net to fill.

Definition at line 214 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 202 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 217 of file NLBuilder.h.

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


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