$extrastylesheet
Olena
User documentation 2.1
An Image Processing Platform
Milena
Getting started
API Reference Manual
All Classes
Examples
Demos
Publications
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
fun/v2v/ch_function_value.hh
1
// Copyright (C) 2008, 2009, 2012 EPITA Research and Development
2
// 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_FUN_V2V_CH_FUNCTION_VALUE_HH
28
# define MLN_FUN_V2V_CH_FUNCTION_VALUE_HH
29
33
34
# include <mln/core/concept/function.hh>
35
# include <mln/fun/internal/ch_function_value_impl.hh>
36
37
38
39
namespace
mln
40
{
41
42
// Forward declaration.
43
namespace
convert
{
template
<
typename
T,
typename
O>
T
to
(
const
O& from); }
44
45
namespace
fun
46
{
47
48
namespace
v2v
49
{
50
52
template
<
typename
F,
typename
V>
53
class
ch_function_value
:
public
Function_v2v
< ch_function_value<F,V> >,
54
public
internal::ch_function_value_impl
<F, V>
55
{
56
public
:
57
typedef
F
function
;
58
typedef
V
result
;
59
typedef
V
rvalue
;
60
typedef
V
lvalue
;
61
62
ch_function_value
();
63
ch_function_value
(
const
F& f);
64
65
template
<
typename
W>
66
V
operator()
(
const
W& w)
const
;
67
68
private
:
69
F f_;
70
};
71
72
73
# ifndef MLN_INCLUDE_ONLY
74
75
template
<
typename
F,
typename
V>
76
inline
77
ch_function_value<F,V>::ch_function_value
()
78
{
79
}
80
81
template
<
typename
F,
typename
V>
82
inline
83
ch_function_value<F,V>::ch_function_value
(
const
F& f)
84
{
85
f_ = f;
86
}
87
88
template
<
typename
F,
typename
V>
89
template
<
typename
W>
90
inline
91
V
92
ch_function_value<F,V>::operator()
(
const
W& w)
const
93
{
94
return
mln::convert::to<V>(f_(w));
95
}
96
97
# endif // ! MLN_INCLUDE_ONLY
98
99
}
// end of namespace mln::fun::v2v
100
101
}
// end of namespace mln::fun
102
103
}
// end of namespace mln
104
105
106
#endif // ! MLN_FUN_V2V_CH_FUNCTION_VALUE_HH
mln
fun
v2v
ch_function_value.hh
Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)