00001 00013 #ifndef STATIONHANDLER_H_INCLUDED 00014 #define STATIONHANDLER_H_INCLUDED 00015 00016 #include <map> 00017 #include <vector> 00018 #include <string> 00019 #include <stdexcept> 00020 #include <boost/shared_ptr.hpp> 00021 #include <boost/noncopyable.hpp> 00022 00023 class Station; 00024 typedef boost::shared_ptr<const Station> SharedConstStation; 00025 00027 00031 class StationHandler : boost::noncopyable 00032 { 00033 typedef std::map<std::wstring, SharedConstStation> StationMapType; 00034 typedef std::map<int, SharedConstStation> StationIntMapType; 00035 typedef std::vector<SharedConstStation> StationVectorType; 00036 public: 00037 typedef StationVectorType::iterator iterator; 00038 typedef StationVectorType::const_iterator const_iterator; 00039 private: 00040 static int NextID; 00041 00042 StationMapType stationMap_; 00043 StationIntMapType stationIntMap_; 00044 StationVectorType stationVect_; 00045 00046 void addStation(SharedConstStation newStation); 00047 00048 public: 00049 SharedConstStation createStation(const std::wstring stationName); 00050 00052 SharedConstStation getStation(const std::wstring &name) const; 00053 00055 SharedConstStation getStationAware(const std::wstring &name) const; 00056 00057 SharedConstStation getStation(const int id) const; 00058 00059 void clear(); 00060 00061 std::size_t size() const; 00062 00063 const_iterator begin() const; 00064 const_iterator end() const; 00065 }; 00066 00067 00068 inline std::size_t StationHandler::size() const 00069 { 00070 return stationVect_.size(); 00071 } 00072 00073 inline StationHandler::const_iterator StationHandler::begin() const 00074 { 00075 return stationVect_.begin(); 00076 } 00077 00078 inline StationHandler::const_iterator StationHandler::end() const 00079 { 00080 return stationVect_.end(); 00081 } 00082 00083 #endif // STATIONHANDLER_H_INCLUDED