swh:1:snp:818279ffd0c3c25a68d33cc2b97d007e1bdc7ed6
Raw File
Tip revision: 8abaf41b7c113afafcca20c0b869826efb0c6e6b authored by ennetws on 15 January 2014, 06:15:06 UTC
Changes to filtering.
Tip revision: 8abaf41
CurveskelQForEach.h
#pragma once
#include "CurveskelModel.h"

namespace CurveskelTypes
{
    class CurveskelForEachEdgeHelper{
    private:
        typedef CurveskelModel::Edge Edge;
        CurveskelModel* m;
    public:
        CurveskelForEachEdgeHelper(CurveskelModel* _m):m(_m){}
        enum etype{BEGIN,END};
        class const_iterator{
        private:
            CurveskelModel* m;
            CurveskelModel::Edge_iterator eit;
        public:
            const_iterator(CurveskelModel* _m, etype e) : m(_m){
                if(e==BEGIN) eit=m->edges_begin();
                if(e==END) eit=m->edges_end();
            }
            const Edge operator*(){ return (const Edge) eit; }
            bool operator!=( const const_iterator& rhs) const{ return eit!=rhs.eit; }
            const_iterator& operator++(){ ++eit; return *this; }
        };

        const_iterator begin() const{return const_iterator(m,BEGIN);}
        const_iterator end() const{return const_iterator(m,END);}
    };

    class CurveskelForEachVertexHelper{
    private:
        typedef CurveskelModel::Vertex Vertex;
        CurveskelModel* m;
    public:
        CurveskelForEachVertexHelper(CurveskelModel* _m):m(_m){}
        enum etype{BEGIN,END};
        class const_iterator{
        private:
            CurveskelModel* m;
            CurveskelModel::Vertex_iterator vit;
        public:
            const_iterator(CurveskelModel* _m, etype e) : m(_m){
                if(e==BEGIN) vit=m->vertices_begin();
                if(e==END) vit=m->vertices_end();
            }
            const Vertex operator*(){ return (const Vertex) vit; }
            bool operator!=( const const_iterator& rhs) const{ return vit!=rhs.vit; }
            const_iterator& operator++(){ ++vit; return *this; }
        };

        const_iterator begin() const{return const_iterator(m,BEGIN);}
        const_iterator end() const{return const_iterator(m,END);}
    };
}
back to top