MSPerson.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MSPerson_h
00020 #define MSPerson_h
00021
00022
00023
00024
00025
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031
00032 #include <string>
00033 #include <vector>
00034 #include <set>
00035
00036
00037
00038
00039
00040 class MSNet;
00041 class MSEdge;
00042 class OutputDevice;
00043
00044 typedef std::vector<const MSEdge*> MSEdgeVector;
00045
00046
00047
00048
00049
00055 class MSPerson {
00056 public:
00061 class MSPersonStage {
00062 public:
00064 MSPersonStage(const MSEdge &destination);
00065
00067 virtual ~MSPersonStage();
00068
00070 const MSEdge &getDestination() const;
00071
00073 virtual void proceed(MSNet *net, MSPerson *person, SUMOTime now, const MSEdge &previousEdge) = 0;
00074
00076 void setDeparted(SUMOTime now);
00077
00079 void setArrived(SUMOTime now);
00080
00082 virtual bool isWaitingFor(const std::string &line) const;
00083
00089 virtual void tripInfoOutput(OutputDevice &os) const throw(IOError) = 0;
00090
00091
00092 protected:
00094 const MSEdge &myDestination;
00095
00097 SUMOTime myDeparted;
00098
00100 SUMOTime myArrived;
00101
00102 private:
00104 MSPersonStage(const MSPersonStage&);
00105
00107 MSPersonStage& operator=(const MSPersonStage&);
00108
00109 };
00110
00116 class MSPersonStage_Walking : public MSPersonStage {
00117 public:
00119 MSPersonStage_Walking(MSEdgeVector route, SUMOTime walkingTime, SUMOReal speed);
00120
00122 ~MSPersonStage_Walking();
00123
00125 virtual void proceed(MSNet *net, MSPerson *person, SUMOTime now, const MSEdge &previousEdge);
00126
00132 virtual void tripInfoOutput(OutputDevice &os) const throw(IOError);
00133
00134 private:
00136 SUMOTime myWalkingTime;
00137
00138 private:
00140 MSPersonStage_Walking(const MSPersonStage_Walking&);
00141
00143 MSPersonStage_Walking& operator=(const MSPersonStage_Walking&);
00144
00145 };
00146
00151 class MSPersonStage_Driving : public MSPersonStage {
00152 public:
00154 MSPersonStage_Driving(const MSEdge &destination,
00155 const std::vector<std::string> &lines);
00156
00158 ~MSPersonStage_Driving();
00159
00161 virtual void proceed(MSNet *net, MSPerson *person, SUMOTime now, const MSEdge &previousEdge);
00162
00164 bool isWaitingFor(const std::string &line) const;
00165
00171 virtual void tripInfoOutput(OutputDevice &os) const throw(IOError);
00172
00173 private:
00175 const std::set<std::string> myLines;
00176
00177 private:
00179 MSPersonStage_Driving(const MSPersonStage_Driving&);
00180
00182 MSPersonStage_Driving& operator=(const MSPersonStage_Driving&);
00183
00184 };
00185
00190 class MSPersonStage_Waiting : public MSPersonStage {
00191 public:
00193 MSPersonStage_Waiting(const MSEdge &destination, SUMOTime duration, SUMOTime until);
00194
00196 ~MSPersonStage_Waiting();
00197
00199 virtual void proceed(MSNet *net, MSPerson *person, SUMOTime now, const MSEdge &previousEdge);
00200
00206 virtual void tripInfoOutput(OutputDevice &os) const throw(IOError);
00207
00208 private:
00210 SUMOTime myWaitingDuration;
00211
00213 SUMOTime myWaitingUntil;
00214
00215 private:
00217 MSPersonStage_Waiting(const MSPersonStage_Waiting&);
00218
00220 MSPersonStage_Waiting& operator=(const MSPersonStage_Waiting&);
00221
00222 };
00223
00224 public:
00226 typedef std::vector<MSPersonStage*> MSPersonPlan;
00227
00228 private:
00230 const SUMOVehicleParameter *myParameter;
00231
00233 MSPersonPlan *myPlan;
00234
00236 MSPersonPlan::iterator myStep;
00237
00238 public:
00240 MSPerson(const SUMOVehicleParameter* pars, MSPersonPlan *plan);
00241
00243 ~MSPerson();
00244
00246 const std::string& getID() const throw();
00247
00249 void proceed(MSNet *net, SUMOTime time);
00250
00252 SUMOTime getDesiredDepart() const throw();
00253
00255 void setDeparted(SUMOTime now);
00256
00258 const MSEdge &getDestination() const;
00259
00265 void tripInfoOutput(OutputDevice &os) const throw(IOError);
00266
00268 bool isWaitingFor(const std::string &line) const;
00269
00270 private:
00272 MSPerson(const MSPerson&);
00273
00275 MSPerson& operator=(const MSPerson&);
00276
00277 };
00278
00279
00280 #endif
00281
00282