GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmSorter.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMSORTER_H
15 #define GDCMSORTER_H
16
17 #include "gdcmDirectory.h"
18 #include "gdcmTag.h"
19
20 #include <vector>
21 #include <string>
22 #include <map>
23
24 namespace gdcm
25 {
26 class DataSet;
27
38 class GDCM_EXPORT Sorter
39 {
40 friend std::ostream& operator<<(std::ostream &_os, const Sorter &s);
41 public:
42 Sorter();
43 virtual ~Sorter();
44
46 virtual bool Sort(std::vector<std::string> const & filenames);
47
50 const std::vector<std::string> &GetFilenames() const { return Filenames; }
51
53 void Print(std::ostream &os) const;
54
56 bool AddSelect( Tag const &tag, const char *value );
57
59 typedef bool (*SortFunction)(DataSet const &, DataSet const &);
60 void SetSortFunction( SortFunction f );
61
62 virtual bool StableSort(std::vector<std::string> const & filenames);
63
64 protected:
65 std::vector<std::string> Filenames;
66 typedef std::map<Tag,std::string> SelectionMap;
67 std::map<Tag,std::string> Selection;
68 SortFunction SortFunc;
69 };
70 //-----------------------------------------------------------------------------
71 inline std::ostream& operator<<(std::ostream &os, const Sorter &s)
72 {
73 s.Print( os );
74 return os;
75 }
76
77
78 } // end namespace gdcm
79
80 #endif //GDCMSORTER_H