MSEmitter::MSEmitterChild Class Reference

#include <MSEmitter.h>

Inheritance diagram for MSEmitter::MSEmitterChild:

GUIEmitter::GUIEmitterChild_UserTriggeredChild MSEmitter::MSEmitter_FileTriggeredChild

Detailed Description

Holder of information about vehicle routes and types.

Classes which realise different schemes to emit vehicles (file-based, based on user entries on the gui, etc.) should subclass this class

Definition at line 84 of file MSEmitter.h.


Public Member Functions

SUMOReal computeOffset (SUMOReal flow) const
 Returns the time offset till the next vehicle emission for a given flow.
const std::vector< const
MSRoute * > & 
getAllRoutes () const
 Returns a list of all available routes.
const MSRoutegetRndRoute () const
 Returns a random route.
MSVehicleTypegetRndVType () const
 Returns a random type.
RandomDistributor< const
MSRoute * > & 
getRouteDist ()
 Returns the routes probability.
bool hasRoutes () const
 Returns the information whether any route is stored.
bool hasVTypes () const
 Returns the information whether any vehicle type is stored.
 MSEmitterChild (MSEmitter &parent, MSVehicleControl &vc)
 Constructor.
virtual ~MSEmitterChild ()
 Destructor.

Protected Attributes

MSEmittermyParent
 The emitter this instance is child of.
RandomDistributor< const
MSRoute * > 
myRouteDist
 The used route probability distribution.
SUMOReal myTimeOffset
 The time offset till next emission.
MSVehicleControlmyVehicleControl
 The vehicle control to use for vehicle building.
RandomDistributor
< MSVehicleType * > 
myVTypeDist
 The used vehicle type probability distribution.

Private Member Functions

 MSEmitterChild (const MSEmitterChild &)
 Invalidated copy constructor.
MSEmitterChildoperator= (const MSEmitterChild &)
 Invalidated assignment operator.

Constructor & Destructor Documentation

MSEmitter::MSEmitterChild::MSEmitterChild ( MSEmitter parent,
MSVehicleControl vc 
) [inline]

Constructor.

Definition at line 87 of file MSEmitter.h.

00088                 : myParent(parent), myVehicleControl(vc), myTimeOffset(0) { }

virtual MSEmitter::MSEmitterChild::~MSEmitterChild (  )  [inline, virtual]

Destructor.

Definition at line 91 of file MSEmitter.h.

00091 { }

MSEmitter::MSEmitterChild::MSEmitterChild ( const MSEmitterChild  )  [private]

Invalidated copy constructor.


Member Function Documentation

SUMOReal MSEmitter::MSEmitterChild::computeOffset ( SUMOReal  flow  )  const [inline]

Returns the time offset till the next vehicle emission for a given flow.

Definition at line 119 of file MSEmitter.h.

References myTimeOffset, and SUMOReal.

Referenced by MSEmitter::MSEmitter_FileTriggeredChild::execute(), and GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().

00119                                                     {
00120             SUMOReal freq = (SUMOReal)(1. / (flow / 3600.));
00121             SUMOReal ret = freq;
00122             myTimeOffset += (freq - (SUMOTime) ret);
00123             if (myTimeOffset>1) {
00124                 myTimeOffset -= 1;
00125                 ret += 1;
00126             }
00127             if (ret==0) { // !!! check what to do in this case (more than one vehicle/s)
00128                 ret = 1;
00129             }
00130             return ret;
00131         }

const std::vector<const MSRoute*>& MSEmitter::MSEmitterChild::getAllRoutes (  )  const [inline]

Returns a list of all available routes.

Definition at line 99 of file MSEmitter.h.

References RandomDistributor< T >::getVals(), and myRouteDist.

00099                                                               {
00100             return myRouteDist.getVals();
00101         }

const MSRoute* MSEmitter::MSEmitterChild::getRndRoute (  )  const [inline]

Returns a random route.

Definition at line 94 of file MSEmitter.h.

References RandomDistributor< T >::get(), and myRouteDist.

Referenced by GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().

00094                                            {
00095             return myRouteDist.get();
00096         }

MSVehicleType* MSEmitter::MSEmitterChild::getRndVType (  )  const [inline]

Returns a random type.

Definition at line 104 of file MSEmitter.h.

References RandomDistributor< T >::get(), and myVTypeDist.

Referenced by GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().

00104                                            {
00105             return myVTypeDist.get();
00106         }

RandomDistributor<const MSRoute*>& MSEmitter::MSEmitterChild::getRouteDist (  )  [inline]

Returns the routes probability.

Definition at line 134 of file MSEmitter.h.

References myRouteDist.

Referenced by GUIEmitter::getEdgeProbs().

00134                                                           {
00135             return myRouteDist;
00136         }

bool MSEmitter::MSEmitterChild::hasRoutes (  )  const [inline]

Returns the information whether any route is stored.

Definition at line 109 of file MSEmitter.h.

References RandomDistributor< T >::getOverallProb(), and myRouteDist.

Referenced by GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().

00109                                {
00110             return myRouteDist.getOverallProb()!=0;
00111         }

bool MSEmitter::MSEmitterChild::hasVTypes (  )  const [inline]

Returns the information whether any vehicle type is stored.

Definition at line 114 of file MSEmitter.h.

References RandomDistributor< T >::getOverallProb(), and myVTypeDist.

Referenced by GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().

00114                                {
00115             return myVTypeDist.getOverallProb()!=0;
00116         }

MSEmitterChild& MSEmitter::MSEmitterChild::operator= ( const MSEmitterChild  )  [private]

Invalidated assignment operator.


Field Documentation

SUMOReal MSEmitter::MSEmitterChild::myTimeOffset [mutable, protected]

The time offset till next emission.

Definition at line 152 of file MSEmitter.h.

Referenced by computeOffset().

The vehicle control to use for vehicle building.

Definition at line 143 of file MSEmitter.h.

Referenced by MSEmitter::MSEmitter_FileTriggeredChild::myStartElement().


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

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