GDCM 2.2.1

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

- File List
- File Members

gdcmModule.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 GDCMMODULE_H
15 #define GDCMMODULE_H
16
17 #include "gdcmTypes.h"
18 #include "gdcmTag.h"
19 #include "gdcmModuleEntry.h"
20
21 #include <map>
22 #include <vector>
23
24 namespace gdcm
25 {
26
27 class DataSet;
28 class Usage;
29 class Macros;
37 class GDCM_EXPORT Module
38 {
39 public:
40 typedef std::map<Tag, ModuleEntry> MapModuleEntry;
41 typedef std::vector<std::string> ArrayIncludeMacrosType;
42
43 //typedef MapModuleEntry::const_iterator ConstIterator;
44 //typedef MapModuleEntry::iterator Iterator;
45 //ConstIterator Begin() const { return ModuleInternal.begin(); }
46 //Iterator Begin() { return ModuleInternal.begin(); }
47 //ConstIterator End() const { return ModuleInternal.end(); }
48 //Iterator End() { return ModuleInternal.end(); }
49
50 Module() {}
51 friend std::ostream& operator<<(std::ostream& _os, const Module &_val);
52
53 void Clear() { ModuleInternal.clear(); }
54
56 void AddModuleEntry(const Tag& tag, const ModuleEntry & module)
57 {
58 ModuleInternal.insert(
59 MapModuleEntry::value_type(tag, module));
60 }
61
62 void AddMacro(const char *include)
63 {
64 ArrayIncludeMacros.push_back( include );
65 }
66
69 bool FindModuleEntryInMacros(Macros const &macros, const Tag &tag) const;
70 const ModuleEntry& GetModuleEntryInMacros(Macros const &macros, const Tag &tag) const;
71
72 void SetName( const char *name) { Name = name; }
73 const char *GetName() const { return Name.c_str(); }
74
75 // Verify will print on std::cerr for error
76 // Upon success will return true, false otherwise
77 bool Verify(const DataSet& ds, Usage const & usage) const;
78
79 private:
80 //Module &operator=(const Module &_val); // purposely not implemented
81 //Module(const Module &_val); // purposely not implemented
82
83 MapModuleEntry ModuleInternal;
84 std::string Name;
85 ArrayIncludeMacrosType ArrayIncludeMacros;
86 };
87 //-----------------------------------------------------------------------------
88 inline std::ostream& operator<<(std::ostream& _os, const Module &_val)
89 {
90 _os << _val.Name << '\n';
91 Module::MapModuleEntry::const_iterator it = _val.ModuleInternal.begin();
92 for(;it != _val.ModuleInternal.end(); ++it)
93 {
94 const Tag &t = it->first;
95 const ModuleEntry &de = it->second;
96 _os << t << " " << de << '\n';
97 }
98
99 return _os;
100 }
101
102 } // end namespace gdcm
103
104 #endif //GDCMMODULE_H