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 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 00022 */ 00023 /*************************************** 00024 * 00025 * CIDRELEVANCELEVELPAIR 00026 * 00027 **************************************** 00028 * 00029 * modification history: 00030 * 00031 *@Author Wolfgang Müller 00032 * 00033 **************************************** 00034 * 00035 * compiler defines used: 00036 * 00037 * 00038 ****************************************/ 00039 #ifndef _CIDRELEVANCELEVELPAIR 00040 #define _CIDRELEVANCELEVELPAIR 00041 #include "libMRML/include/uses-declarations.h" 00042 #include <iostream> 00043 #include "libMRML/include/TID.h" 00044 #include <functional> 00045 #include <cmath> 00046 00048 class CIDRelevanceLevelPair{ 00050 int mID; 00052 double mRelevanceLevel; 00053 public: 00054 /*************************************** 00055 * 00056 * 00057 * 00058 ***************************************/ 00062 CIDRelevanceLevelPair(); 00063 00064 /*************************************** 00065 * 00066 * 00067 * 00068 ***************************************/ 00070 CIDRelevanceLevelPair(const TID inID, 00071 double inRelevanceLevel); 00072 00073 /*************************************** 00074 * 00075 * 00076 * 00077 ***************************************/ 00079 CIDRelevanceLevelPair(const CIDRelevanceLevelPair& inElement); 00082 /*************************************** 00083 * 00084 * 00085 * 00086 ***************************************/ 00089 TID getID()const; 00090 00091 /*************************************** 00092 * 00093 * 00094 * 00095 ***************************************/ 00097 double getRelevanceLevel()const; 00098 00099 /*************************************** 00100 * 00101 * 00102 * 00103 ***************************************/ 00105 void setRelevanceLevel(const double inRelevanceLevel); 00106 00107 /*************************************** 00108 * 00109 * 00110 * 00111 ***************************************/ 00113 void adjustRelevanceLevel(const double inRelevanceLevel); 00114 00115 /*************************************** 00116 * 00117 * 00118 * 00119 ***************************************/ 00121 void divideRelevanceLevelBy(const double inDivisor); 00123 }; 00124 00125 class CSortByID_IRLP: 00126 public binary_function<CIDRelevanceLevelPair,CIDRelevanceLevelPair,bool>{ 00127 public: 00129 inline bool operator()(const CIDRelevanceLevelPair& l, 00130 const CIDRelevanceLevelPair& t){ 00131 return 00132 fabs(double(l.getID())) 00133 < 00134 fabs(double(t.getID())); 00135 }; 00136 }; 00137 00138 00139 00140 /*************************************** 00141 * 00142 * 00143 * 00144 ***************************************/ 00145 bool operator<(const CIDRelevanceLevelPair& l, 00146 const CIDRelevanceLevelPair& t); 00147 00148 #endif