00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #ifndef MLN_TOPO_FACE_DATA_HH
00027 # define MLN_TOPO_FACE_DATA_HH
00028 
00035 
00036 # include <vector>
00037 
00038 # include <mln/topo/algebraic_n_face.hh>
00039 
00040 
00041 namespace mln
00042 {
00043 
00044   namespace topo
00045   {
00046 
00047     
00048     template <unsigned D> class complex;
00049     namespace internal
00050     {
00051       template <unsigned N, unsigned D> struct lower_dim_faces_set_mixin;
00052       template <unsigned N, unsigned D> struct higher_dim_faces_set_mixin;
00053       
00054       template <unsigned N, unsigned D>
00055       struct lower_dim_adj_faces_if_dim_matches_;
00056       template <unsigned N, unsigned D>
00057       struct higher_dim_adj_faces_if_dim_matches_;
00058     }
00059 
00060     
00061     template <unsigned N, unsigned D> class n_face;
00062     namespace internal
00063     {
00064       template <unsigned N, unsigned D> class lower_dim_faces_data_mixin;
00065       template <unsigned N, unsigned D> class higher_dim_faces_data_mixin;
00066     }
00067 
00068 
00069     
00070 
00071 
00072 
00074     template <unsigned N, unsigned D> class face_data;
00075 
00076 
00077     
00078     template <unsigned D>
00079     class face_data<D, D> : public internal::lower_dim_faces_data_mixin<D, D>
00080     {
00081     };
00082 
00083     
00084     
00085     template <unsigned N, unsigned D>
00086     class face_data : public internal::lower_dim_faces_data_mixin<N, D>,
00087                       public internal::higher_dim_faces_data_mixin<N, D>
00088     {
00089     };
00090 
00091     
00092     template <unsigned D>
00093     class face_data<0u, D> : public internal::higher_dim_faces_data_mixin<0u, D>
00094     {
00095     };
00096 
00097     
00098     template <>
00099     class face_data<0u, 0u>
00100     {
00101     };
00102 
00103 
00104     namespace internal
00105     {
00106 
00109       template <unsigned N, unsigned D>
00110       class lower_dim_faces_data_mixin
00111       {
00112         typedef std::vector< algebraic_n_face<N - 1, D> > lower_dim_faces_type;
00113 
00114       public:
00115         void connect_lower_dim_face(const algebraic_n_face<N - 1, D>& f);
00116 
00117       private:
00118         friend class mln::topo::internal::lower_dim_faces_set_mixin<N, D>;
00119         friend class mln::topo::internal::lower_dim_adj_faces_if_dim_matches_<N, D>;
00120         friend lower_dim_faces_type
00121         mln::topo::n_face<N, D>::lower_dim_adj_faces() const;
00122 
00123         
00124         lower_dim_faces_type lower_dim_faces_;
00125       };
00126 
00127       template <unsigned N, unsigned D>
00128       class higher_dim_faces_data_mixin
00129       {
00130         typedef std::vector< algebraic_n_face<N + 1, D> > higher_dim_faces_type;
00131 
00132       public:
00133         void connect_higher_dim_face(const algebraic_n_face<N + 1, D>& f);
00134 
00135       private:
00136         friend class mln::topo::internal::higher_dim_faces_set_mixin<N, D>;
00137         friend class mln::topo::internal::higher_dim_adj_faces_if_dim_matches_<N, D>;
00138         friend higher_dim_faces_type
00139         mln::topo::n_face<N, D>::higher_dim_adj_faces() const;
00140 
00141         
00142         higher_dim_faces_type higher_dim_faces_;
00143       };
00145 
00146     } 
00147 
00148 
00149 
00150 # ifndef MLN_INCLUDE_ONLY
00151 
00152     namespace internal
00153     {
00154       template <unsigned N, unsigned D>
00155       inline
00156       void
00157       lower_dim_faces_data_mixin<N, D>::connect_lower_dim_face(const algebraic_n_face<N - 1, D>& f)
00158       {
00159         lower_dim_faces_.push_back(f);
00160       }
00161 
00162       template <unsigned N, unsigned D>
00163       inline
00164       void
00165       higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face(const algebraic_n_face<N + 1, D>& f)
00166       {
00167         higher_dim_faces_.push_back(f);
00168       }
00169 
00170     } 
00171 
00172 # endif // ! MLN_INCLUDE_ONLY
00173 
00174   } 
00175 
00176 } 
00177 
00178 #endif // ! MLN_TOPO_FACE_DATA_HH