GDCM 3.0.24
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
24namespace gdcm
25{
26
27class DataSet;
28class Usage;
29class Macros;
38{
39public:
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() = default;
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
79private:
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//-----------------------------------------------------------------------------
88inline 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
Class to represent a Data Set (which contains Data Elements)
Definition gdcmDataSet.h:56
Class for representing a Modules.
Definition gdcmMacros.h:30
Class for representing a ModuleEntry.
Definition gdcmModuleEntry.h:30
Class for representing a Module.
Definition gdcmModule.h:38
bool Verify(const DataSet &ds, Usage const &usage) const
Module()=default
void Clear()
Definition gdcmModule.h:53
void AddModuleEntry(const Tag &tag, const ModuleEntry &module)
Will add a ModuleEntry directly at root-level. See Macro for nested-included level.
Definition gdcmModule.h:56
void AddMacro(const char *include)
Definition gdcmModule.h:62
void SetName(const char *name)
Definition gdcmModule.h:72
bool FindModuleEntryInMacros(Macros const &macros, const Tag &tag) const
const ModuleEntry & GetModuleEntryInMacros(Macros const &macros, const Tag &tag) const
std::vector< std::string > ArrayIncludeMacrosType
Definition gdcmModule.h:41
const char * GetName() const
Definition gdcmModule.h:73
std::map< Tag, ModuleEntry > MapModuleEntry
Definition gdcmModule.h:40
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
Usage.
Definition gdcmUsage.h:49
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88