$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
core/other/var.cc
1 // Copyright (C) 2008, 2009, 2013 EPITA Research and Development Laboratory
2 // (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 
31 
32 
33 #include <mln/core/image/image2d.hh>
34 #include <mln/core/alias/window2d.hh>
35 #include <mln/core/alias/neighb2d.hh>
36 #include <mln/histo/array.hh>
37 #include <mln/util/array.hh>
38 
39 #include <mln/core/var.hh>
40 
41 
42 
43 // mln_VAR is known not to work with old gcc versions. This test does
44 // nothing for these compilers.
45 //
46 #if (defined(__GNUC__) && __GNUC__ >= 4)
47 
48 template <typename T>
49 void test_template()
50 {
51  using namespace mln;
52 
53  image2d<T> ima(1,1);
55  window2d win;
56  {
57  mln_PITER(p, ima.domain());
58  mln_NITER(n, neighb, p);
59  (void) n;
60  mln_QITER(q, win, p);
61  (void) q;
62  }
63  {
64  mln_FWD_PITER(p, ima.domain());
65  mln_FWD_NITER(n, neighb, p);
66  (void) n;
67  mln_FWD_QITER(q, win, p);
68  (void) q;
69  }
70  {
71  mln_BKD_PITER(p, ima.domain());
72  mln_BKD_NITER(n, neighb, p);
73  (void) n;
74  mln_BKD_QITER(q, win, p);
75  (void) q;
76  }
77 
79  {
80  mln_EITER(e, arr);
81  }
82  {
83  mln_FWD_EITER(e, arr);
84  }
85  {
86  mln_BKD_EITER(e, arr);
87  }
88 
90  {
91  mln_VITER(v, d.vset());
92  }
93  {
94  mln_FWD_VITER(v, d.vset());
95  }
96  {
97  mln_BKD_VITER(v, d.vset());
98  }
99 
100 }
101 
102 void test()
103 {
104  using namespace mln;
105 
106  image2d<int> ima(1,1);
108  window2d win;
109  {
110  mln_PITER_(p, ima.domain());
111  mln_NITER_(n, neighb, p);
112  mln_QITER_(q, win, p);
113  }
114  {
115  mln_FWD_PITER_(p, ima.domain());
116  mln_FWD_NITER_(n, neighb, p);
117  mln_FWD_QITER_(q, win, p);
118  }
119  {
120  mln_BKD_PITER_(p, ima.domain());
121  mln_BKD_NITER_(n, neighb, p);
122  mln_BKD_QITER_(q, win, p);
123  }
124 
126  {
127  mln_EITER_(e, arr);
128  }
129  {
130  mln_FWD_EITER_(e, arr);
131  }
132  {
133  mln_BKD_EITER_(e, arr);
134  }
135 
137  {
138  mln_VITER_(v, d.vset());
139  }
140  {
141  mln_FWD_VITER_(v, d.vset());
142  }
143  {
144  mln_BKD_VITER_(v, d.vset());
145  }
146 }
147 
148 #endif
149 
150 int main()
151 {
152 
153 #if (defined(__GNUC__) && __GNUC__ >= 4)
154  test();
155  test_template<int>();
156 #endif
157 
158 }