latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 00003 * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany 00004 * 00005 * This file is part of the LTI-Computer Vision Library (LTI-Lib) 00006 * 00007 * The LTI-Lib is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License (LGPL) 00009 * as published by the Free Software Foundation; either version 2.1 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * The LTI-Lib is distributed in the hope that it will be 00013 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00014 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with the LTI-Lib; see the file LICENSE. If 00019 * not, write to the Free Software Foundation, Inc., 59 Temple Place - 00020 * Suite 330, Boston, MA 02111-1307, USA. 00021 */ 00022 00023 00024 /*---------------------------------------------------------------- 00025 * project ....: LTI Digital Image/Signal Processing Library 00026 * file .......: ltiScalarFunctor.h 00027 * authors ....: Thomas Rusert, Pablo Alvarado 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 20.04.99 00030 * revisions ..: $Id: ltiScalarFunctor.h,v 1.3 2006/02/08 12:42:02 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_SCALARFUNCTOR_H_ 00034 #define _LTI_SCALARFUNCTOR_H_ 00035 00036 #include "ltiIteratingFunctor.h" 00037 00038 namespace lti { 00039 00040 /** 00041 * Base class for all scalar functors. \\ 00042 * These functors have similar functionality as unaryFunctors, but 00043 * instead giving the functor object to the 'apply'-Method of the 00044 * mathObject (e.g. matrix or vector), it receives the mathObject as 00045 * argument in its 'apply'-method. Scalar functors are usually 00046 * faster than unaryFunctors, because for the last ones a call to a 00047 * virtual function is done for each element in the mathObject. 00048 * This function call is in the scalar functors not requiered. 00049 */ 00050 template<class T> 00051 class scalarFunctor : public iteratingFunctor<T> { 00052 public: 00053 /** 00054 * scalar value parameter needed in scalar functors 00055 */ 00056 class parameters : public iteratingFunctor<T>::parameters { 00057 public: 00058 /// default constructor 00059 parameters(const T& val = T()); 00060 /// copy constructor 00061 parameters(const parameters& other); 00062 /// copy member 00063 parameters& copy(const parameters& other); 00064 /// returns pointer to a clone of this object 00065 virtual functor::parameters* clone() const; 00066 /// name of this type 00067 virtual const char* getTypeName() const; 00068 00069 /// scalar value 00070 T value; 00071 }; 00072 00073 /// default constructor 00074 scalarFunctor(const T& val = T()); 00075 /// constructor to set the parameters 00076 scalarFunctor(const parameters& p); 00077 /// return the casted parametes of this functor 00078 const parameters& getParameters() const; 00079 00080 }; 00081 00082 } 00083 00084 #include "ltiScalarFunctor_template.h" 00085 00086 #endif