SUMO - Simulation of Urban MObility
|
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 () |
Builds and initialises the simulation. | |
NLBuilder (OptionsCont &oc, MSNet &net, NLEdgeControlBuilder &eb, NLJunctionControlBuilder &jb, NLDetectorBuilder &db, NLHandler &xmlHandler) | |
Constructor. | |
virtual | ~NLBuilder () |
Destructor. | |
Protected Member Functions | |
void | buildNet () |
Closes the net building process. | |
MSRouteLoaderControl * | buildRouteLoaderControl (const OptionsCont &oc) |
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 |
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 68 of file NLBuilder.h.
NLBuilder::NLBuilder | ( | OptionsCont & | oc, |
MSNet & | net, | ||
NLEdgeControlBuilder & | eb, | ||
NLJunctionControlBuilder & | jb, | ||
NLDetectorBuilder & | db, | ||
NLHandler & | xmlHandler | ||
) |
Constructor.
[in] | oc | The options to use |
[in,out] | net | The network to fill |
[in] | eb | The builder of edges to use |
[in] | jb | The builder of junctions to use |
[in] | db | The detector builder to use |
[in] | tb | The trigger builder to use |
[in] | xmlHandler | The xml handler to use |
Definition at line 107 of file NLBuilder.cpp.
NLBuilder::~NLBuilder | ( | ) | [virtual] |
Destructor.
Definition at line 118 of file NLBuilder.cpp.
NLBuilder::NLBuilder | ( | const NLBuilder & | s | ) | [private] |
invalidated copy operator
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.
ProcessError | If something fails on network building |
Definition at line 122 of file NLBuilder.cpp.
References buildNet(), MsgHandler::endProcessMsg(), SysUtils::getCurrentMillis(), MsgHandler::getErrorInstance(), 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 | ( | ) | [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.
ProcessError | If the loaded structures could not be built |
Definition at line 201 of file NLBuilder.cpp.
References NLEdgeControlBuilder::build(), NLJunctionControlBuilder::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 | ) | [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
[in] | oc | The options to read the list of route files to open from |
ProcessError | If an error occured |
Definition at line 265 of file NLBuilder.cpp.
References FileHelpers::exists(), OptionsCont::getString(), OptionsCont::getStringVector(), OptionsCont::isSet(), myNet, and string2time().
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.
[in] | mmlWhat | The option to get the file list from |
Definition at line 246 of file NLBuilder.cpp.
References MsgHandler::endProcessMsg(), SysUtils::getCurrentMillis(), MsgHandler::getMessageInstance(), OptionsCont::getOptions(), OptionsCont::getStringVector(), myXMLHandler, PROGRESS_BEGIN_MESSAGE, XMLSubSys::runParser(), toString(), and WRITE_MESSAGE.
Referenced by build().
NLDetectorBuilder& NLBuilder::myDetectorBuilder [protected] |
The detector control builder to use.
Definition at line 212 of file NLBuilder.h.
NLEdgeControlBuilder& NLBuilder::myEdgeBuilder [protected] |
The edge control builder to use.
Definition at line 206 of file NLBuilder.h.
Referenced by buildNet().
NLJunctionControlBuilder& NLBuilder::myJunctionBuilder [protected] |
The junction control builder to use.
Definition at line 209 of file NLBuilder.h.
Referenced by buildNet().
MSNet& NLBuilder::myNet [protected] |
The net to fill.
Definition at line 215 of file NLBuilder.h.
Referenced by NLBuilder::EdgeFloatTimeLineRetriever_EdgeTravelTime::addEdgeWeight(), build(), buildNet(), and buildRouteLoaderControl().
OptionsCont& NLBuilder::myOptions [protected] |
The options to get the names of the files to load and further information from.
Definition at line 203 of file NLBuilder.h.
Referenced by build(), and buildNet().
NLHandler& NLBuilder::myXMLHandler [protected] |
The handler used to parse the net.
Definition at line 218 of file NLBuilder.h.
Referenced by load().