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 SUMORouteLoaderControlbuildRouteLoaderControl (const OptionsCont &oc)
 Builds the route loader control. More...
 
static MSNetinit (const bool isLibsumo=false)
 
static void initRandomness ()
 initializes all RNGs More...
 

Protected Member Functions

void buildDefaultMeanData (const std::string &optionName, const std::string &id, bool useLanes)
 build meanData definition based on option More...
 
void buildNet ()
 Closes the net building process. 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 109 of file NLBuilder.cpp.

◆ ~NLBuilder()

NLBuilder::~NLBuilder ( )
virtual

Destructor.

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

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

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

Here is the caller graph for this function:

◆ buildDefaultMeanData()

void NLBuilder::buildDefaultMeanData ( const std::string &  optionName,
const std::string &  id,
bool  useLanes 
)
protected

build meanData definition based on option

Definition at line 463 of file NLBuilder.cpp.

References NLDetectorBuilder::createEdgeLaneMeanData(), OptionsCont::getOptions(), MSGlobals::gUseMesoSim, myDetectorBuilder, SUMO_const_haltingSpeed, TL, WRITE_ERROR, and WRITE_WARNING.

Referenced by build().

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

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

Referenced by build().

Here is the caller graph for this function:

◆ buildRouteLoaderControl()

SUMORouteLoaderControl * NLBuilder::buildRouteLoaderControl ( const OptionsCont oc)
static

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

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

Referenced by buildNet(), MSNet::loadState(), and MSNet::quickReload().

Here is the caller graph for this function:

◆ init()

◆ initRandomness()

void NLBuilder::initRandomness ( )
static

initializes all RNGs

Definition at line 363 of file NLBuilder.cpp.

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

Referenced by init(), MSNet::quickReload(), 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 424 of file NLBuilder.cpp.

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

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

Referenced by buildDefaultMeanData().

◆ myEdgeBuilder

NLEdgeControlBuilder& NLBuilder::myEdgeBuilder
protected

The edge control builder to use.

Definition at line 203 of file NLBuilder.h.

Referenced by build(), and buildNet().

◆ myJunctionBuilder

NLJunctionControlBuilder& NLBuilder::myJunctionBuilder
protected

The junction control builder to use.

Definition at line 206 of file NLBuilder.h.

Referenced by build(), and buildNet().

◆ myNet

MSNet& NLBuilder::myNet
protected

The net to fill.

Definition at line 212 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 200 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 215 of file NLBuilder.h.

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


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