vnl_unary_function.h
Go to the documentation of this file.
1 // This is core/vnl/vnl_unary_function.h
2 #ifndef vnl_unary_function_h_
3 #define vnl_unary_function_h_
4 //:
5 // \file
6 // \brief Abstract 1D map
7 //
8 // vnl_unary_function is an abstract map between two types (read spaces).
9 //
10 // \author Andrew W. Fitzgibbon, Oxford RRG
11 // \date 28 Nov 98
12 //
13 // \verbatim
14 // Modifications
15 // 981128 AWF Initial version.
16 // LSB Manchester 19/3/01 Documentation tidied
17 // Feb.2002 - Peter Vanroose - brief doxygen comment placed on single line
18 // \endverbatim
19 //
20 //-----------------------------------------------------------------------------
21 #ifdef _MSC_VER
22 # include <vcl_msvc_warnings.h>
23 #endif
24 #include "vnl/vnl_export.h"
25 
26 //: Abstract 1D map between two types (read spaces)
27 template <class Return, class Argument>
28 class VNL_EXPORT vnl_unary_function
29 {
30  public:
31 // typedef std::numeric_limits<Return> limits;
32 
33  //: Apply the function.
34  // The name is "f" rather than operator(), as the function will generally be
35  // called through a pointer. Note that the function is NOT const when you subclass.
36  virtual Return f(Argument const& i) = 0;
37 
38  //: Return bounding cube of range (outputs)
39  virtual Return get_range_min() const;
40  virtual Return get_range_max() const;
41 
42  //: Copy should allocate a copy of this on the heap and return it.
43  // If Subclasses do not implement this function, it will return null, but many
44  // applications will never call it, so this may not be a problem for you.
45  virtual vnl_unary_function<Return, Argument> * Copy() const { return nullptr; }
46 
47  virtual ~vnl_unary_function() = default;
48 };
49 
50 #endif // vnl_unary_function_h_
Abstract 1D map between two types (read spaces).
Definition: vnl_fwd.h:30