$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ch_piter.hh
1 // Copyright (C) 2008, 2009, 2011, 2012, 2013 EPITA Research and
2 // Development 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_CORE_IMAGE_CH_PITER_HH
28 # define MLN_CORE_IMAGE_CH_PITER_HH
29 
36 # include <mln/core/internal/image_identity.hh>
37 
38 
39 
40 namespace mln
41 {
42 
43  // Forward declaration.
44  template <typename I, typename Fwd> class ch_piter_image;
45 
46 
47  namespace internal
48  {
49 
54  template <typename I, typename Fwd>
55  struct data< ch_piter_image<I,Fwd> >
56  {
57  data(I& ima);
58  I ima_;
59  };
60 
61  } // end of namespace mln::internal
62 
63 
64  namespace trait
65  {
66 
67  template <typename I, typename Fwd>
68  struct image_< ch_piter_image<I,Fwd> > : image_< I > // Same as I except...
69  {
70  // ...theis change.
71  typedef trait::image::category::identity_morpher category;
72  };
73 
74  } // end of namespace mln::trait
75 
76 
77 
78  // FIXME: Doc!
79 
80  template <typename I, typename Fwd>
82  mln_domain(I),
83  ch_piter_image<I,Fwd> >
84  {
85  public:
86 
89 
90  typedef Fwd fwd_piter;
91  typedef Fwd bkd_piter; // FIXME
92  typedef fwd_piter piter;
93 
95  ch_piter_image(I& ima);
96 
98  // Deferred initialization.
99  void init_(I& ima);
101  };
102 
103 
104 
105  template <typename Fwd, typename I>
107  ch_piter(Image<I>& ima);
108 
109 
110 
111 # ifndef MLN_INCLUDE_ONLY
112 
113 
114  // internal::data< ch_piter_image<I,S> >
115 
116  namespace internal
117  {
118 
119  template <typename I, typename Fwd>
120  inline
122  : ima_(ima)
123  {
124  }
125 
126  } // end of namespace mln::internal
127 
128 
129  // ch_piter_image<I,Fwd>
130 
131  template <typename I, typename Fwd>
132  inline
133  ch_piter_image<I,Fwd>::ch_piter_image()
134  {
135  }
136 
137  template <typename I, typename Fwd>
138  inline
139  ch_piter_image<I,Fwd>::ch_piter_image(I& ima)
140  {
141  mln_precondition(ima.is_valid());
142  init_(ima);
143  }
144 
145  template <typename I, typename Fwd>
146  inline
147  void
148  ch_piter_image<I,Fwd>::init_(I& ima)
149  {
150  mln_precondition(ima.is_valid());
151  this->data_ = new internal::data< ch_piter_image<I,Fwd> >(ima);
152  }
153 
154 
155  // ch_piter
156 
157  template <typename Fwd, typename I>
158  inline
159  ch_piter_image<I,Fwd>
160  ch_piter(Image<I>& ima)
161  {
162  ch_piter_image<I,Fwd> tmp(exact(ima));
163  return tmp;
164  }
165 
166 # endif // ! MLN_INCLUDE_ONLY
167 
168 } // end of namespace mln
169 
170 
171 #endif // ! MLN_CORE_IMAGE_CH_PITER_HH