00001 #ifndef METRO_PLAN_H_INCLUDED
00002 #define METRO_PLAN_H_INCLUDED
00003
00004 #include "metro/graph.hpp"
00005 #include "metro/stationdata.h"
00006
00007 namespace metro
00008 {
00009
00015 class Plan
00016 {
00018 typedef Graph<id_station> graph_t;
00019
00021 typedef graph_t::solution_t solution_t;
00022
00024 typedef std::list<std::string> ligne_t;
00025
00027 typedef std::map<std::string, ligne_t> plan_t;
00028
00030 typedef std::multimap<std::string, std::string> correspondances_t;
00031
00033 typedef std::vector<std::string> etapes_t;
00034
00036 typedef std::map<std::pair<std::string, std::string>, std::string> file_names_t;
00037
00038 plan_t m_plan;
00039 correspondances_t m_correspondances;
00040 size_t m_delaiStation;
00041 size_t m_delaiCorrespondance;
00042 bool m_bOptimise;
00043 etapes_t m_etapes;
00044 std::list<int> m_etapesFinales;
00045 std::set<int> m_etapesId;
00046 file_names_t m_fileNames;
00047
00048 public:
00049 Plan(size_t delaiStation, size_t delaiCorrespondance, bool bOptimise = false);
00050
00051 ~Plan() {
00052 }
00053
00055 bool Load(const std::string& filename);
00056
00058 bool SetEtapes(const etapes_t& etapes);
00059
00061 void Trajet(const std::string& from, const std::string& to);
00062
00064 bool StationExists(const std::string& station) const;
00065
00066 protected:
00068 void Add(const std::string& ligne, const std::string& station);
00069
00071 void Create(graph_t& g, int& nEtape, const etapes_t& etapes);
00072
00074 void CreateCorrespondance(graph_t& g, const StationData& stationData, int temps, int nEtape);
00075
00077 bool IsStationEtape(const station::Data& stationData) const;
00078
00080 const std::string& GetFileStationName(const std::string& ligne, const std::string& station) const;
00081
00083 static std::string Clean(const std::string& station);
00084
00086 static std::string FormatTemps(size_t temps);
00087 };
00088
00089 }
00090
00091 #endif // METRO_PLAN_H_INCLUDED