00001 #ifndef GRAL_GB_MAP_ELEMENT_ITER_NAMES_H
00002 #define GRAL_GB_MAP_ELEMENT_ITER_NAMES_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 namespace GrAL {
00020
00061 template<class EIt, class ER, class element_tag>
00062 struct map_element_iter_name {};
00063
00064
00065 template<class ER, class element_tag>
00066 struct map_element_iter_name_2
00067 : public map_element_iter_name<typename ER::ElementIterator, ER, element_tag>
00068 {};
00069
00070
00071
00072 template<class EIt, class ER>
00073 struct map_element_iter_name<EIt, ER, vertex_type_tag>
00074 {
00075 private:
00076 ER const& asER() const { return static_cast<ER const&>(*this);}
00077 public:
00078 typedef EIt VertexIterator;
00079 VertexIterator FirstVertex() const { return asER().FirstElement();}
00080 VertexIterator EndVertex () const { return asER().EndElement(); }
00081 unsigned NumOfVertices() const { return asER().size();}
00082 };
00083
00084
00085 template<class EIt, class ER>
00086 struct map_element_iter_name<EIt, ER, edge_type_tag>
00087 {
00088 private:
00089 ER const& asER() const { return static_cast<ER const&>(*this);}
00090 public:
00091 typedef EIt EdgeIterator;
00092 EdgeIterator FirstEdge() const { return asER().FirstElement(); }
00093 EdgeIterator EndEdge () const { return asER().EndElement(); }
00094 unsigned NumOfEdges() const { return asER().size(); }
00095 };
00096
00097
00098 template<class EIt, class ER>
00099 struct map_element_iter_name<EIt, ER, facet_type_tag>
00100 {
00101 private:
00102 ER const& asER() const { return static_cast<ER const&>(*this);}
00103 public:
00104 typedef EIt FacetIterator;
00105 FacetIterator FirstFacet() const { return asER().FirstElement();}
00106 FacetIterator EndFacet () const { return asER().EndElement();}
00107 unsigned NumOfFacets() const { return asER().size();}
00108 };
00109
00110
00111
00112
00114 template<class EIt, class ER>
00115 struct map_element_iter_name<EIt, ER, cell_type_tag>
00116 {
00117 private:
00118 ER const& asER() const { return static_cast<ER const&>(*this);}
00119 public:
00120 typedef EIt CellIterator;
00121 CellIterator FirstCell() const { return asER().FirstElement(); }
00122 CellIterator EndCell () const { return asER().EndElement(); }
00123 unsigned NumOfCells() const { return asER().size();}
00124 };
00125
00126
00127
00128 }
00129
00130 #endif
00131