00001 /* -*- mode: c++ -*- 00002 */ 00003 /* 00004 00005 GIFT, a flexible content based image retrieval system. 00006 Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva 00007 00008 Copyright (C) 2003, 2004 Bayreuth University 00009 2005 Bamberg University 00010 This program is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU General Public License as published by 00012 the Free Software Foundation; either version 2 of the License, or 00013 (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 00024 */ 00025 /*************************************** 00026 * 00027 * CIDRELEVANCELEVELPAIR 00028 * 00029 **************************************** 00030 * 00031 * modification history: 00032 * 00033 *@Author Wolfgang Müller 00034 * 00035 **************************************** 00036 * 00037 * compiler defines used: 00038 * 00039 * 00040 ****************************************/ 00041 #ifndef _CIDRELEVANCELEVELPAIR 00042 #define _CIDRELEVANCELEVELPAIR 00043 #include "libMRML/include/uses-declarations.h" 00044 #include <iostream> 00045 #include "libMRML/include/TID.h" 00046 #include <functional> 00047 #include <cmath> 00048 00050 class CIDRelevanceLevelPair{ 00052 int mID; 00054 double mRelevanceLevel; 00055 public: 00056 /*************************************** 00057 * 00058 * 00059 * 00060 ***************************************/ 00064 CIDRelevanceLevelPair(); 00065 00066 /*************************************** 00067 * 00068 * 00069 * 00070 ***************************************/ 00072 CIDRelevanceLevelPair(const TID inID, 00073 double inRelevanceLevel); 00074 00075 /*************************************** 00076 * 00077 * 00078 * 00079 ***************************************/ 00081 CIDRelevanceLevelPair(const CIDRelevanceLevelPair& inElement); 00084 /*************************************** 00085 * 00086 * 00087 * 00088 ***************************************/ 00091 TID getID()const; 00092 00093 /*************************************** 00094 * 00095 * 00096 * 00097 ***************************************/ 00099 double getRelevanceLevel()const; 00100 00101 /*************************************** 00102 * 00103 * 00104 * 00105 ***************************************/ 00107 void setRelevanceLevel(const double inRelevanceLevel); 00108 00109 /*************************************** 00110 * 00111 * 00112 * 00113 ***************************************/ 00115 void adjustRelevanceLevel(const double inRelevanceLevel); 00116 00117 /*************************************** 00118 * 00119 * 00120 * 00121 ***************************************/ 00123 void divideRelevanceLevelBy(const double inDivisor); 00125 }; 00126 00127 class CSortByID_IRLP: 00128 public binary_function<CIDRelevanceLevelPair,CIDRelevanceLevelPair,bool>{ 00129 public: 00131 inline bool operator()(const CIDRelevanceLevelPair& l, 00132 const CIDRelevanceLevelPair& t){ 00133 return 00134 fabs(double(l.getID())) 00135 < 00136 fabs(double(t.getID())); 00137 }; 00138 }; 00139 00140 00141 00142 /*************************************** 00143 * 00144 * 00145 * 00146 ***************************************/ 00147 bool operator<(const CIDRelevanceLevelPair& l, 00148 const CIDRelevanceLevelPair& t); 00149 00150 #endif