$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
accu/nil.hh
1 // Copyright (C) 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_ACCU_NIL_HH
27 # define MLN_ACCU_NIL_HH
28 
34 
35 # include <mln/core/concept/meta_accumulator.hh>
36 # include <mln/accu/internal/base.hh>
37 # include <mln/util/eat.hh>
38 # include <mln/util/ignore.hh>
39 
40 
41 namespace mln
42 {
43 
44  namespace accu
45  {
46 
48  template <typename T>
49  struct nil : public mln::accu::internal::base< util::ignore , nil<T> >
50  {
52 
53  nil();
54 
57  void init();
58  void take_as_init_(const argument&);
59  void take(const argument&);
60  void take(const nil<T>&);
62 
64  util::ignore to_result() const;
65 
68  bool is_valid() const;
69  };
70 
71 
72  namespace meta
73  {
74 
76 
77  struct nil : public Meta_Accumulator< nil >
78  {
79  template <typename V>
80  struct with
81  {
82  typedef accu::nil<V> ret;
83  };
84  };
85 
86  } // end of namespace mln::accu::meta
87 
88 
89 # ifndef MLN_INCLUDE_ONLY
90 
91  template <typename T>
92  inline
93  nil<T>::nil()
94  {
95  }
96 
97  template <typename T>
98  inline
99  void
100  nil<T>::init()
101  {
102  }
103 
104  template <typename T>
105  inline
106  void
107  nil<T>::take(const argument&)
108  {
109  }
110 
111  template <typename T>
112  inline
113  void
114  nil<T>::take_as_init_(const argument&)
115  {
116  }
117 
118  template <typename T>
119  inline
120  void
121  nil<T>::take(const nil<T>&)
122  {
123  }
124 
125  template <typename T>
126  inline
127  util::ignore
128  nil<T>::to_result() const
129  {
130  return util::ignore();
131  }
132 
133  template <typename T>
134  inline
135  bool
136  nil<T>::is_valid() const
137  {
138  return true;
139  }
140 
141 
142 # endif // ! MLN_INCLUDE_ONLY
143 
144  } // end of namespace mln::accu
145 
146 } // end of namespace mln
147 
148 
149 #endif // ! MLN_ACCU_NIL_HH