GDCM 3.2.1

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() = 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
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
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements)
Definition gdcmDataSet.h:56
gdcm::Macros
Class for representing a Modules.
Definition gdcmMacros.h:30
gdcm::ModuleEntry
Class for representing a ModuleEntry.
Definition gdcmModuleEntry.h:30
gdcm::Module::Verify
bool Verify(const DataSet &ds, Usage const &usage) const
gdcm::Module::Module
Module()=default
gdcm::Module::Clear
void Clear()
Definition gdcmModule.h:53
gdcm::Module::AddModuleEntry
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
gdcm::Module::AddMacro
void AddMacro(const char *include)
Definition gdcmModule.h:62
gdcm::Module::operator<<
friend std::ostream & operator<<(std::ostream &_os, const Module &_val)
Definition gdcmModule.h:88
gdcm::Module::SetName
void SetName(const char *name)
Definition gdcmModule.h:72
gdcm::Module::FindModuleEntryInMacros
bool FindModuleEntryInMacros(Macros const &macros, const Tag &tag) const
gdcm::Module::GetModuleEntryInMacros
const ModuleEntry & GetModuleEntryInMacros(Macros const &macros, const Tag &tag) const
gdcm::Module::ArrayIncludeMacrosType
std::vector< std::string > ArrayIncludeMacrosType
Definition gdcmModule.h:41
gdcm::Module::GetName
const char * GetName() const
Definition gdcmModule.h:73
gdcm::Module::MapModuleEntry
std::map< Tag, ModuleEntry > MapModuleEntry
Definition gdcmModule.h:40
gdcm::Tag
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
gdcm::Usage
Usage.
Definition gdcmUsage.h:49
gdcmModuleEntry.h
gdcmTag.h
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88