$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
face_data.hh
1 // Copyright (C) 2008, 2009, 2010, 2011 EPITA Research and Development
2 // Laboratory (LRDE)
3 //
4 // This file is part of Olena.
5 //
6 // Olena is free software: you can redistribute it and/or modify it under
7 // the terms of the GNU General Public License as published by the Free
8 // Software Foundation, version 2 of the License.
9 //
10 // Olena is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // As a special exception, you may use this file as part of a free
19 // software project without restriction. Specifically, if other files
20 // instantiate templates or use macros or inline functions from this
21 // file, or you compile this file and link it with other files to produce
22 // an executable, this file does not by itself cause the resulting
23 // executable to be covered by the GNU General Public License. This
24 // exception does not however invalidate any other reasons why the
25 // executable file might be covered by the GNU General Public License.
26 
27 #ifndef MLN_TOPO_FACE_DATA_HH
28 # define MLN_TOPO_FACE_DATA_HH
29 
36 
37 # include <vector>
38 
39 # include <mln/topo/algebraic_n_face.hh>
40 
41 
42 namespace mln
43 {
44 
45  namespace topo
46  {
47 
48  // Forward declarations (external).
49  template <unsigned D> class complex;
50  namespace internal
51  {
52  template <unsigned N, unsigned D> struct lower_dim_faces_set_mixin;
53  template <unsigned N, unsigned D> struct higher_dim_faces_set_mixin;
54 
55  template <unsigned N, unsigned D>
56  struct lower_dim_adj_faces_if_dim_matches_;
57  template <unsigned N, unsigned D>
58  struct higher_dim_adj_faces_if_dim_matches_;
59  }
60 
61  // Forward declarations (internal).
62  template <unsigned N, unsigned D> class n_face;
63  namespace internal
64  {
65  template <unsigned N, unsigned D> class lower_dim_faces_data_mixin;
66  template <unsigned N, unsigned D> class higher_dim_faces_data_mixin;
67  }
68 
69 
70  /*------------.
71  | Face data. |
72  `------------*/
73 
75  template <unsigned N, unsigned D> class face_data;
76 
77 
78  // Specialization for the faces of highest dimension (\p D).
79  template <unsigned D>
81  {
82  };
83 
84  // Specialization for the faces of intermediate dimension (greater
85  // than 0, lower than \p D).
86  template <unsigned N, unsigned D>
89  {
90  };
91 
92  // Specialization for the faces of lowest dimension (0).
93  template <unsigned D>
94  class face_data<0u, D> : public internal::higher_dim_faces_data_mixin<0u, D>
95  {
96  };
97 
98  // Specialization for the case of a 0-complex.
99  template <>
100  class face_data<0u, 0u>
101  {
102  };
103 
104 
105  namespace internal
106  {
107 
112 
113  template <unsigned N, unsigned D>
115  {
116  typedef std::vector< algebraic_n_face<N - 1, D> > lower_dim_faces_type;
117 
118  public:
120 
121  private:
123  friend struct mln::topo::internal::lower_dim_adj_faces_if_dim_matches_<N, D>;
124  friend lower_dim_faces_type
126 
127  // FIXME: Rename as lower_dim_adj_faces_ (as well as related members).
128  lower_dim_faces_type lower_dim_faces_;
129  };
130 
131  template <unsigned N, unsigned D>
133  {
134  typedef std::vector< algebraic_n_face<N + 1, D> > higher_dim_faces_type;
135 
136  public:
138 
139  private:
141  friend struct mln::topo::internal::higher_dim_adj_faces_if_dim_matches_<N, D>;
142  friend higher_dim_faces_type
144 
145  // FIXME: Rename as higher_dim_adj_faces_ (as well as related members).
146  higher_dim_faces_type higher_dim_faces_;
147  };
149 
150  } // end of namespace mln::topo::internal
151 
152 
153 
154 # ifndef MLN_INCLUDE_ONLY
155 
156  namespace internal
157  {
158  template <unsigned N, unsigned D>
159  inline
160  void
162  {
163  lower_dim_faces_.push_back(f);
164  }
165 
166  template <unsigned N, unsigned D>
167  inline
168  void
169  higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face(const algebraic_n_face<N + 1, D>& f)
170  {
171  higher_dim_faces_.push_back(f);
172  }
173 
174  } // end of namespace mln::topo::internal
175 
176 # endif // ! MLN_INCLUDE_ONLY
177 
178  } // end of namespace mln::topo
179 
180 } // end of namespace mln
181 
182 #endif // ! MLN_TOPO_FACE_DATA_HH