GDCM  2.0.18
gdcmSorter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program: GDCM (Grassroots DICOM). A DICOM library
00004 
00005   Copyright (c) 2006-2011 Mathieu Malaterre
00006   All rights reserved.
00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 #ifndef GDCMSORTER_H
00015 #define GDCMSORTER_H
00016 
00017 #include "gdcmDirectory.h"
00018 #include "gdcmTag.h"
00019 
00020 #include <vector>
00021 #include <string>
00022 #include <map>
00023 
00024 namespace gdcm
00025 {
00026 class DataSet;
00027 
00038 class GDCM_EXPORT Sorter
00039 {
00040   friend std::ostream& operator<<(std::ostream &_os, const Sorter &s);
00041 public:
00042   Sorter();
00043   virtual ~Sorter();
00044 
00046   virtual bool Sort(std::vector<std::string> const & filenames);
00047 
00050   const std::vector<std::string> &GetFilenames() const { return Filenames; }
00051 
00053   void Print(std::ostream &os) const;
00054 
00056   bool AddSelect( Tag const &tag, const char *value );
00057 
00059   typedef bool (*SortFunction)(DataSet const &, DataSet const &);
00060   void SetSortFunction( SortFunction f );
00061 
00062   virtual bool StableSort(std::vector<std::string> const & filenames);
00063 
00064 protected:
00065   std::vector<std::string> Filenames;
00066   typedef std::map<Tag,std::string> SelectionMap;
00067   std::map<Tag,std::string> Selection;
00068   SortFunction SortFunc;
00069 };
00070 //-----------------------------------------------------------------------------
00071 inline std::ostream& operator<<(std::ostream &os, const Sorter &s)
00072 {
00073   s.Print( os );
00074   return os;
00075 }
00076 
00077 
00078 } // end namespace gdcm
00079 
00080 #endif //GDCMSORTER_H

Generated on Tue Dec 6 2011 07:25:32 for GDCM by doxygen 1.7.5.1
SourceForge.net Logo