ROVehicle Class Reference

#include <ROVehicle.h>


Detailed Description

A vehicle as used by router.

Definition at line 57 of file ROVehicle.h.


Public Member Functions

virtual ROVehiclecopy (const std::string &id, unsigned int depTime, RORouteDef *newRoute) throw ()
 Returns a copy of the vehicle using a new id, departure time and route.
SUMOTime getDepartureTime () const throw ()
 Returns the time the vehicle starts at.
const std::string & getID () const throw ()
 Returns the id of the vehicle.
RORouteDef *const getRouteDefinition () const throw ()
 Returns the definition of the route the vehicle takes.
const SUMOVTypeParameter *const getType () const throw ()
 Returns the type of the vehicle.
 ROVehicle (const SUMOVehicleParameter &pars, RORouteDef *route, SUMOVTypeParameter *type) throw ()
 Constructor.
void saveAllAsXML (SUMOAbstractRouter< ROEdge, ROVehicle > &router, OutputDevice &os, OutputDevice *const altos, bool withExitTimes) const throw (IOError)
 Saves the complete vehicle description.
virtual ~ROVehicle () throw ()
 Destructor.

Protected Attributes

SUMOVehicleParameter myParameter
 The vehicle's parameter.
RORouteDefmyRoute
 The route the vehicle takes.
SUMOVTypeParametermyType
 The type of the vehicle.

Private Member Functions

ROVehicleoperator= (const ROVehicle &src)
 Invalidated assignment operator.
 ROVehicle (const ROVehicle &src)
 Invalidated copy constructor.

Constructor & Destructor Documentation

ROVehicle::ROVehicle ( const SUMOVehicleParameter pars,
RORouteDef route,
SUMOVTypeParameter type 
) throw ()

Constructor.

Parameters:
[in] pars Parameter of this vehicle
[in] route The definition of the route the vehicle shall use
[in] type The type of the vehicle
Todo:
Why is the vehicle builder given?

Definition at line 52 of file ROVehicle.cpp.

Referenced by copy().

00054         : myParameter(pars), myType(type), myRoute(route) {}

ROVehicle::~ROVehicle (  )  throw () [virtual]

Destructor.

Definition at line 57 of file ROVehicle.cpp.

00057 {}

ROVehicle::ROVehicle ( const ROVehicle src  )  [private]

Invalidated copy constructor.


Member Function Documentation

ROVehicle * ROVehicle::copy ( const std::string &  id,
unsigned int  depTime,
RORouteDef newRoute 
) throw () [virtual]

Returns a copy of the vehicle using a new id, departure time and route.

Parameters:
[in] id the new id to use
[in] depTime The new vehicle's departure time
[in] newRoute The new vehicle's route
Returns:
The new vehicle
Todo:
Is this used? What for if everything is replaced?

Definition at line 94 of file ROVehicle.cpp.

References SUMOVehicleParameter::depart, SUMOVehicleParameter::id, myParameter, myType, and ROVehicle().

Referenced by RORDGenerator_ODAmounts::FlowDef::addSingleRoute().

00095                                               {
00096     SUMOVehicleParameter pars(myParameter);
00097     pars.id = id;
00098     pars.depart = depTime;
00099     return new ROVehicle(pars, newRoute, myType);
00100 }

SUMOTime ROVehicle::getDepartureTime (  )  const throw () [inline]

Returns the time the vehicle starts at.

Returns:
The vehicle's depart time

Definition at line 110 of file ROVehicle.h.

References SUMOVehicleParameter::depart, and myParameter.

Referenced by RONet::computeRoute(), RONet::saveAndRemoveRoutesUntil(), RORouteDef_Complete::writeXMLDefinition(), RORouteDef_Alternatives::writeXMLDefinition(), and RORoute::writeXMLDefinition().

00110                                               {
00111         return myParameter.depart;
00112     }

const std::string& ROVehicle::getID (  )  const throw () [inline]

RORouteDef* const ROVehicle::getRouteDefinition (  )  const throw () [inline]

Returns the definition of the route the vehicle takes.

Returns:
The vehicle's route definition
Todo:
Why not return a reference?

Definition at line 81 of file ROVehicle.h.

References myRoute.

Referenced by RONet::computeRoute().

00081                                                           {
00082         return myRoute;
00083     }

const SUMOVTypeParameter* const ROVehicle::getType (  )  const throw () [inline]

Returns the type of the vehicle.

Returns:
The vehicle's type
Todo:
Why not return a reference?

Definition at line 92 of file ROVehicle.h.

References myType.

00092                                                              {
00093         return myType;
00094     }

ROVehicle& ROVehicle::operator= ( const ROVehicle src  )  [private]

Invalidated assignment operator.

void ROVehicle::saveAllAsXML ( SUMOAbstractRouter< ROEdge, ROVehicle > &  router,
OutputDevice os,
OutputDevice *const   altos,
bool  withExitTimes 
) const throw (IOError)

Saves the complete vehicle description.

Saves the vehicle type if it was not saved before. Saves the vehicle route if it was not saved before. Saves the vehicle itself.

Parameters:
[in] os The routes - output device to store the vehicle's description into
[in] altos The route alternatives - output device to store the vehicle's description into
[in] route !!!describe
Exceptions:
IOError If something fails (not yet implemented)
Todo:
What is the given route definition?

Definition at line 61 of file ROVehicle.cpp.

References OutputDevice::closeTag(), OptionsCont::getOptions(), ReferencedItem::isSaved(), myParameter, myRoute, myType, SUMOVTypeParameter::saved, SUMOVTypeParameter::write(), SUMOVehicleParameter::writeAs(), and RORouteDef::writeXMLDefinition().

Referenced by RONet::saveAndRemoveRoutesUntil().

00062                                                                                              {
00063     // check whether the vehicle's type was saved before
00064     if (myType!=0&&!myType->saved) {
00065         // ... save if not
00066         myType->write(os);
00067         if (altos!=0) {
00068             myType->write(*altos);
00069         }
00070         myType->saved = true;
00071     }
00072 
00073     // write the vehicle (new style, with included routes)
00074     myParameter.writeAs("vehicle", os, OptionsCont::getOptions());
00075     if (altos!=0) {
00076         myParameter.writeAs("vehicle", *altos, OptionsCont::getOptions());
00077     }
00078 
00079     // check whether the route shall be saved
00080     if (!myRoute->isSaved()) {
00081         myRoute->writeXMLDefinition(router, os, this, false, withExitTimes);
00082         if (altos!=0) {
00083             myRoute->writeXMLDefinition(router, *altos, this, true, withExitTimes);
00084         }
00085     }
00086     os.closeTag();
00087     if (altos!=0) {
00088         altos->closeTag();
00089     }
00090 }


Field Documentation

The vehicle's parameter.

Definition at line 145 of file ROVehicle.h.

Referenced by copy(), getDepartureTime(), getID(), and saveAllAsXML().

The route the vehicle takes.

Definition at line 151 of file ROVehicle.h.

Referenced by getRouteDefinition(), and saveAllAsXML().

The type of the vehicle.

Definition at line 148 of file ROVehicle.h.

Referenced by copy(), getType(), and saveAllAsXML().


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

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