00001 #ifndef DDNumberingScheme_h 00002 #define DDNumberingScheme_h 00003 00004 #include <vector> 00005 00006 class DDExpandedView; 00007 //typename DDExpandedView::nav_type; 00008 class DDFilteredView; 00009 //class DDFilteredView::nav_type; 00011 00015 class DDNumberingScheme //: throw DDException 00016 { 00017 public: 00018 typedef std::vector<int> nav_type; 00019 virtual ~DDNumberingScheme(); 00020 00022 virtual int id(const DDExpandedView &) const = 0; 00023 00025 virtual int id(const DDFilteredView &) const = 0; 00026 00028 virtual int id(const nav_type &) const = 0 ; 00029 00030 00032 00035 virtual bool node(int id, DDExpandedView & view) const = 0; 00036 00038 00041 virtual bool node(int id, DDFilteredView & view) const = 0; 00042 00043 }; 00044 00045 00046 00047 00048 #include <map> 00050 00054 class DDDefaultNumberingScheme : public DDNumberingScheme //: throw DDException 00055 { 00056 public: 00057 typedef DDNumberingScheme::nav_type nav_type; 00058 DDDefaultNumberingScheme(const DDExpandedView & e); 00059 DDDefaultNumberingScheme(const DDFilteredView & f); 00060 virtual ~DDDefaultNumberingScheme(); 00061 00063 virtual int id(const DDExpandedView &) const; 00064 00066 virtual int id(const DDNumberingScheme::nav_type &) const; 00067 00069 virtual int id(const DDFilteredView &) const; 00070 00072 00075 virtual bool node(int id, DDExpandedView & view) const; 00076 00078 00081 virtual bool node(int id, DDFilteredView & view) const; 00082 00083 protected: 00084 DDNumberingScheme::nav_type idToNavType(int id) const; 00085 00086 protected: 00087 std::map<nav_type,int> path2id_; 00088 std::vector<std::map<nav_type,int>::iterator> id2path_; 00089 }; 00090 00091 00092 00093 00094 #endif