00001 // This is core/vnl/vnl_unary_function.h 00002 #ifndef vnl_unary_function_h_ 00003 #define vnl_unary_function_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \brief Abstract 1D map 00010 // 00011 // vnl_unary_function is an abstract map between two types (read spaces). 00012 // 00013 // \author Andrew W. Fitzgibbon, Oxford RRG 00014 // \date 28 Nov 98 00015 // 00016 // \verbatim 00017 // Modifications 00018 // 981128 AWF Initial version. 00019 // LSB Manchester 19/3/01 Documentation tidied 00020 // Feb.2002 - Peter Vanroose - brief doxygen comment placed on single line 00021 // \endverbatim 00022 // 00023 //----------------------------------------------------------------------------- 00024 00025 00026 00027 00028 //: Abstract 1D map between two types (read spaces) 00029 template <class Return, class Argument> 00030 class vnl_unary_function 00031 { 00032 public: 00033 // typedef vcl_numeric_limits<Return> limits; 00034 00035 //: Apply the function. 00036 // The name is "f" rather than operator(), as the function will generally be 00037 // called through a pointer. Note that the function is NOT const when you subclass. 00038 virtual Return f(Argument const& i) = 0; 00039 00040 //: Return bounding cube of range (outputs) 00041 virtual Return get_range_min() const; 00042 virtual Return get_range_max() const; 00043 00044 //: Copy should allocate a copy of this on the heap and return it. 00045 // If Subclasses do not implement this function, it will return null, but many 00046 // applications will never call it, so this may not be a problem for you. 00047 virtual vnl_unary_function<Return, Argument> * Copy() const { return 0; } 00048 00049 virtual ~vnl_unary_function() {} 00050 }; 00051 00052 #endif // vnl_unary_function_h_