00001 00013 #ifndef LINEHANDLER_H_INCLUDED 00014 #define LINEHANDLER_H_INCLUDED 00015 00016 #include <map> 00017 #include <boost/shared_ptr.hpp> 00018 #include <boost/unordered_map.hpp> 00019 #include <boost/noncopyable.hpp> 00020 00021 class Line; 00022 00024 00029 class LineHandler : boost::noncopyable 00030 { 00031 static int NextID; 00032 00033 typedef boost::shared_ptr<const Line> SharedConstLine; 00034 typedef boost::unordered_map<std::wstring, SharedConstLine> LineMapType; 00035 typedef boost::unordered_map<int, SharedConstLine> LineIntMapType; 00036 LineMapType lineMap_; 00037 LineIntMapType lineIntMap_; 00038 00039 void addLine(boost::shared_ptr<Line> newLine); 00040 00041 public: 00042 typedef LineMapType::const_iterator const_iterator; 00043 00044 boost::shared_ptr<Line> createLine(const std::wstring lineName); 00045 00046 SharedConstLine getLine(const std::wstring &name) const; 00047 00048 SharedConstLine getLine(const int id) const; 00049 00050 void clear(); 00051 00052 std::size_t size() const; 00053 const_iterator begin() const; 00054 const_iterator end() const; 00055 }; 00056 00057 inline std::size_t LineHandler::size() const 00058 { 00059 return lineIntMap_.size(); 00060 } 00061 00062 inline LineHandler::const_iterator LineHandler::begin() const 00063 { 00064 return lineMap_.begin(); 00065 } 00066 00067 inline LineHandler::const_iterator LineHandler::end() const 00068 { 00069 return lineMap_.end(); 00070 } 00071 00072 00073 #endif // LINEHANDLER_H_INCLUDED