MSRouteLoaderControl Class Reference

#include <MSRouteLoaderControl.h>


Detailed Description

MSRouteLoaderControl This controls is initialised with the list of route loaders and uses them to load routes step wise. The parameter myInAdvanceStepNo holds the number of time steps to read the routes in forward. If it is 0 (default), all routes will be read at once.

Definition at line 55 of file MSRouteLoaderControl.h.


Public Types

typedef std::vector
< MSRouteLoader * > 
LoaderVector
 definition of the loader vector

Public Member Functions

void loadNext (SUMOTime step, MSEmitControl *into)
 loads the next routes
 MSRouteLoaderControl (MSNet &net, int inAdvanceStepNo, LoaderVector loader)
 constructor
 ~MSRouteLoaderControl ()
 destructor

Private Attributes

bool myAllLoaded
size_t myInAdvanceStepNo
 the number of routes to read in forward
SUMOTime myLastLoadTime
 the last time step new routes were loaded
bool myLoadAll
LoaderVector myRouteLoaders
 the list of route loaders

Member Typedef Documentation

definition of the loader vector

Definition at line 58 of file MSRouteLoaderControl.h.


Constructor & Destructor Documentation

MSRouteLoaderControl::MSRouteLoaderControl ( MSNet net,
int  inAdvanceStepNo,
LoaderVector  loader 
)

constructor

Definition at line 42 of file MSRouteLoaderControl.cpp.

References myAllLoaded, myInAdvanceStepNo, myLastLoadTime, myLoadAll, and myRouteLoaders.

00045         : myLastLoadTime(-inAdvanceStepNo),
00046         myInAdvanceStepNo(inAdvanceStepNo),
00047         myRouteLoaders(loader),
00048         myAllLoaded(false) {
00049     myLoadAll = myInAdvanceStepNo<=0;
00050     myAllLoaded = false;
00051     myLastLoadTime = -1 * (int) myInAdvanceStepNo;
00052     // initialize all used loaders
00053     for (LoaderVector::iterator i=myRouteLoaders.begin();
00054             i!=myRouteLoaders.end(); ++i) {
00055         (*i)->init();
00056     }
00057 }

MSRouteLoaderControl::~MSRouteLoaderControl (  ) 

destructor

Definition at line 60 of file MSRouteLoaderControl.cpp.

References myRouteLoaders.

00060                                             {
00061     for (LoaderVector::iterator i=myRouteLoaders.begin();
00062             i!=myRouteLoaders.end(); ++i) {
00063         delete(*i);
00064     }
00065 }


Member Function Documentation

void MSRouteLoaderControl::loadNext ( SUMOTime  step,
MSEmitControl into 
)

loads the next routes

Definition at line 69 of file MSRouteLoaderControl.cpp.

References myAllLoaded, myInAdvanceStepNo, myLastLoadTime, myLoadAll, and myRouteLoaders.

Referenced by MSNet::simulationStep().

00069                                                                  {
00070     // check whether new vehicles shall be loaded
00071     //  return if not
00072     if ((myLoadAll&&myAllLoaded) || (myLastLoadTime>=0&&myLastLoadTime/*+myInAdvanceStepNo*/>=step)) {
00073         return;
00074     }
00075     // load all routes for the specified time period
00076     SUMOTime run = step;
00077     bool furtherAvailable = true;
00078     for (;
00079             furtherAvailable &&
00080             (myLoadAll||run<=step+(SUMOTime) myInAdvanceStepNo);
00081             run++) {
00082         furtherAvailable = false;
00083         for (LoaderVector::iterator i=myRouteLoaders.begin();
00084                 i!=myRouteLoaders.end(); ++i) {
00085             if ((*i)->moreAvailable()) {
00086                 (*i)->loadUntil(run, into);
00087             }
00088             furtherAvailable |= (*i)->moreAvailable();
00089         }
00090     }
00091     // no further loading when all was loaded
00092     if (myLoadAll||!furtherAvailable) {
00093         myAllLoaded = true;
00094     }
00095     // set the step information
00096     myLastLoadTime = run - 1;
00097 }


Field Documentation

Definition at line 83 of file MSRouteLoaderControl.h.

Referenced by loadNext(), and MSRouteLoaderControl().

the number of routes to read in forward

Definition at line 76 of file MSRouteLoaderControl.h.

Referenced by loadNext(), and MSRouteLoaderControl().

the last time step new routes were loaded

Definition at line 73 of file MSRouteLoaderControl.h.

Referenced by loadNext(), and MSRouteLoaderControl().

information whether all routes shall be loaded and whether they were loaded

Definition at line 83 of file MSRouteLoaderControl.h.

Referenced by loadNext(), and MSRouteLoaderControl().

the list of route loaders

Definition at line 79 of file MSRouteLoaderControl.h.

Referenced by loadNext(), MSRouteLoaderControl(), and ~MSRouteLoaderControl().


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

Generated on Wed May 5 00:06:49 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6