00001 00013 #ifndef TYPES_H_INCLUDED 00014 #define TYPES_H_INCLUDED 00015 00016 #include <boost/unordered_set.hpp> 00017 #include <vector> 00018 00019 namespace BPF 00020 { 00021 typedef boost::unordered_set<int> IntSet; 00022 typedef IntSet::iterator IntSetIterator; 00023 typedef IntSet::const_iterator IntSetConstIterator; 00024 typedef std::vector<IntSet> IntSetVect; 00025 typedef IntSetVect::iterator IntSetVectIterator; 00026 typedef IntSetVect::const_iterator IntSetVectConstIterator; 00027 00029 struct Step 00030 { 00032 int lineID; 00034 int statID; 00036 unsigned int duration; 00037 Step( 00038 int l , 00039 int s , 00040 unsigned int dur ): 00041 lineID(l), 00042 statID(s), 00043 duration(dur) 00044 { 00045 } 00046 }; 00047 00049 00053 struct LineStationToStationKey 00054 { 00055 unsigned int lineID; 00056 unsigned int stationID1; 00057 unsigned int stationID2; 00058 00059 LineStationToStationKey(int liID, int sta1ID, int sta2ID): 00060 lineID(liID), 00061 stationID1(sta1ID), 00062 stationID2(sta2ID) 00063 { 00064 } 00065 00066 bool operator == (const LineStationToStationKey &other) const 00067 { 00068 return (stationID1 == other.stationID1) 00069 && (stationID2 == other.stationID2) 00070 && (lineID == other.lineID); 00071 } 00072 }; 00073 00075 00080 struct hash : public std::unary_function<LineStationToStationKey, std::size_t> 00081 { 00082 std::size_t operator()(LineStationToStationKey const &p) const 00083 { 00084 std::size_t seed = 0; 00085 boost::hash_combine(seed, p.lineID); 00086 boost::hash_combine(seed, p.stationID1); 00087 boost::hash_combine(seed, p.stationID2); 00088 return seed; 00089 } 00090 }; 00091 00093 typedef boost::unordered_map<LineStationToStationKey, int, hash> TimeBetweenStationOnLineMap; 00094 } 00095 00096 #endif // TYPES_H_INCLUDED