$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
make/vec.hh
1 // Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
2 //
3 // This file is part of Olena.
4 //
5 // Olena is free software: you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation, version 2 of the License.
8 //
9 // Olena is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // As a special exception, you may use this file as part of a free
18 // software project without restriction. Specifically, if other files
19 // instantiate templates or use macros or inline functions from this
20 // file, or you compile this file and link it with other files to produce
21 // an executable, this file does not by itself cause the resulting
22 // executable to be covered by the GNU General Public License. This
23 // exception does not however invalidate any other reasons why the
24 // executable file might be covered by the GNU General Public License.
25 
26 #ifndef MLN_MAKE_VEC_HH
27 # define MLN_MAKE_VEC_HH
28 
34 # include <mln/algebra/vec.hh>
35 # include <mln/core/concept/function.hh>
36 
37 namespace mln
38 {
39 
40  namespace make
41  {
42 
43 
50  template <typename T>
51  algebra::vec<1, T> vec(const T& v_0);
52 
60  template <typename T>
61  algebra::vec<2, T> vec(const T& v_0, const T& v_1);
62 
71  template <typename T>
72  algebra::vec<3, T> vec(const T& v_0, const T& v_1, const T& v_2);
73 
83  template <typename T>
84  algebra::vec<4, T> vec(const T& v_0, const T& v_1, const T& v_2, const T& v_3);
85 
86 
87 # ifndef MLN_INCLUDE_ONLY
88 
89  template <typename T>
90  inline
91  algebra::vec<1, T> vec(const T& v_0)
92  {
93  algebra::vec<1, T> tmp;
94  tmp[0] = v_0;
95  return tmp;
96  }
97 
98  template <typename T>
99  inline
100  algebra::vec<2, T> vec(const T& v_0, const T& v_1)
101  {
102  algebra::vec<2, T> tmp;
103  tmp[0] = v_0;
104  tmp[1] = v_1;
105  return tmp;
106  }
107 
108  template <typename T>
109  inline
110  algebra::vec<3, T> vec(const T& v_0, const T& v_1, const T& v_2)
111  {
112  algebra::vec<3, T> tmp;
113  tmp[0] = v_0;
114  tmp[1] = v_1;
115  tmp[2] = v_2;
116  return tmp;
117  }
118 
119  template <typename T>
120  inline
121  algebra::vec<4, T> vec(const T& v_0, const T& v_1, const T& v_2, const T& v_3)
122  {
123  algebra::vec<4, T> tmp;
124  tmp[0] = v_0;
125  tmp[1] = v_1;
126  tmp[2] = v_2;
127  tmp[3] = v_3;
128  return tmp;
129  }
130 
131 # endif // ! MLN_INCLUDE_ONLY
132 
133  } // end of namespace make
134 
135 } // end of namespace mln
136 
137 #endif // ! MLN_MAKE_VEC_HH