Milena (Olena)
User documentation 2.0a Id
|
00001 // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory 00002 // (LRDE) 00003 // 00004 // This file is part of Olena. 00005 // 00006 // Olena is free software: you can redistribute it and/or modify it under 00007 // the terms of the GNU General Public License as published by the Free 00008 // Software Foundation, version 2 of the License. 00009 // 00010 // Olena is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Olena. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 // As a special exception, you may use this file as part of a free 00019 // software project without restriction. Specifically, if other files 00020 // instantiate templates or use macros or inline functions from this 00021 // file, or you compile this file and link it with other files to produce 00022 // an executable, this file does not by itself cause the resulting 00023 // executable to be covered by the GNU General Public License. This 00024 // exception does not however invalidate any other reasons why the 00025 // executable file might be covered by the GNU General Public License. 00026 00027 00031 00032 00033 #include <mln/core/image/image2d.hh> 00034 #include <mln/core/alias/window2d.hh> 00035 #include <mln/core/alias/neighb2d.hh> 00036 #include <mln/histo/array.hh> 00037 #include <mln/util/array.hh> 00038 00039 #include <mln/core/var.hh> 00040 00041 00042 00043 // mln_VAR is known not to work with old gcc versions. This test does 00044 // nothing for these compilers. 00045 // 00046 #if (defined(__GNUC__) && __GNUC__ >= 4) 00047 00048 template <typename T> 00049 void test_template() 00050 { 00051 using namespace mln; 00052 00053 image2d<T> ima(1,1); 00054 neighb2d neighb; 00055 window2d win; 00056 { 00057 mln_PITER(p, ima.domain()); 00058 mln_NITER(n, neighb, p); 00059 mln_QITER(q, win, p); 00060 } 00061 { 00062 mln_FWD_PITER(p, ima.domain()); 00063 mln_FWD_NITER(n, neighb, p); 00064 mln_FWD_QITER(q, win, p); 00065 } 00066 { 00067 mln_BKD_PITER(p, ima.domain()); 00068 mln_BKD_NITER(n, neighb, p); 00069 mln_BKD_QITER(q, win, p); 00070 } 00071 00072 util::array<point2d> arr; 00073 { 00074 mln_EITER(e, arr); 00075 } 00076 { 00077 mln_FWD_EITER(e, arr); 00078 } 00079 { 00080 mln_BKD_EITER(e, arr); 00081 } 00082 00083 histo::array<bool> d; 00084 { 00085 mln_VITER(v, d.vset()); 00086 } 00087 { 00088 mln_FWD_VITER(v, d.vset()); 00089 } 00090 { 00091 mln_BKD_VITER(v, d.vset()); 00092 } 00093 00094 } 00095 00096 void test() 00097 { 00098 using namespace mln; 00099 00100 image2d<int> ima(1,1); 00101 neighb2d neighb; 00102 window2d win; 00103 { 00104 mln_PITER_(p, ima.domain()); 00105 mln_NITER_(n, neighb, p); 00106 mln_QITER_(q, win, p); 00107 } 00108 { 00109 mln_FWD_PITER_(p, ima.domain()); 00110 mln_FWD_NITER_(n, neighb, p); 00111 mln_FWD_QITER_(q, win, p); 00112 } 00113 { 00114 mln_BKD_PITER_(p, ima.domain()); 00115 mln_BKD_NITER_(n, neighb, p); 00116 mln_BKD_QITER_(q, win, p); 00117 } 00118 00119 util::array<point2d> arr; 00120 { 00121 mln_EITER_(e, arr); 00122 } 00123 { 00124 mln_FWD_EITER_(e, arr); 00125 } 00126 { 00127 mln_BKD_EITER_(e, arr); 00128 } 00129 00130 histo::array<bool> d; 00131 { 00132 mln_VITER_(v, d.vset()); 00133 } 00134 { 00135 mln_FWD_VITER_(v, d.vset()); 00136 } 00137 { 00138 mln_BKD_VITER_(v, d.vset()); 00139 } 00140 } 00141 00142 #endif 00143 00144 int main() 00145 { 00146 00147 #if (defined(__GNUC__) && __GNUC__ >= 4) 00148 test(); 00149 test_template<int>(); 00150 #endif 00151 00152 }