00001
00002
00014 #ifndef NTUPLESORTER_H
00015 #define NTUPLESORTER_H
00016
00017 #include "pattern/libhippo.h"
00018
00019 #include <vector>
00020
00021 namespace hippodraw {
00022
00023 class NTuple;
00024
00032 class MDL_HIPPOPLOT_API NTupleSorter
00033 {
00034
00035 private:
00036
00039 NTupleSorter & operator = ( const NTupleSorter & );
00040
00043 int m_column;
00044
00047 bool m_increasing;
00048
00051 NTuple * m_ntuple;
00052
00057 void rowwiseCopy ( std::vector < std::vector < double > * > & row_copy );
00058
00059 public:
00060
00066 NTupleSorter ( const NTupleSorter & );
00067
00072 NTupleSorter ( NTuple * ntuple );
00073
00077 virtual ~NTupleSorter () {}
00078
00081 NTuple * getNTuple () const;
00082
00089 void setSorting ( int column );
00090
00092 void sort ( );
00093
00095 void clear ();
00096
00106 void addRow ( const std::vector < double > & row );
00107
00111 virtual void eraseRow ( unsigned int index );
00112
00115 unsigned int columns ( ) const;
00116
00119 unsigned int rows ( ) const;
00120
00123 const std::vector < double > & getRow ( unsigned int index ) const;
00124
00129 bool operator () ( std::vector < double > * x,
00130 std::vector < double > * y ) const;
00131
00132 };
00133
00134 }
00135
00136 #endif // NTUPLESORTER_H