pktools  2.6.7
Processing Kernel for geospatial data
IndexValue.h
1 /**********************************************************************
2 IndexValue.h: class to work with structs containing an index and a value
3 Copyright (C) 2008-2012 Pieter Kempeneers
4 
5 This file is part of pktools
6 
7 pktools is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 pktools is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with pktools. If not, see <http://www.gnu.org/licenses/>.
19 ***********************************************************************/
20 #ifndef _INDEXVALUE_H_
21 #define _INDEXVALUE_H_
22 
23 struct IndexValue{
24  int position;
25  double value;
26 };
28 public:
29  int operator() (const IndexValue& pv1, const IndexValue& pv2) const{
30  return pv1.value>pv2.value;//for decreasing order
31  }
32 };
34 public:
35  int operator() (const IndexValue& pv1, const IndexValue& pv2) const{
36  return pv1.value>pv2.value;//for decreasing order
37  }
38 };
40 public:
41  int operator() (const IndexValue& pv1, const IndexValue& pv2) const{
42  return pv1.value<pv2.value;//for increasing order
43  }
44 };
45 #endif /* _INDEXVALUE_H_ */