GDCM: gdcmMacro.h Source File

GDCM 3.2.8

gdcmMacro.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 GDCMMACRO_H
15#define GDCMMACRO_H
16
17#include "gdcmTypes.h"
18#include "gdcmTag.h"
19#include "gdcmMacroEntry.h"
20
21#include <map>
22#include <vector>
23
24namespace gdcm
25{
26
27class DataSet;
28class Usage;
36 class GDCM_EXPORT Macro
37{
38public:
39 typedef std::map<Tag, MacroEntry> MapModuleEntry;
40 typedef std::vector<std::string> ArrayIncludeMacrosType;
41
42 //typedef MapModuleEntry::const_iterator ConstIterator;
43 //typedef MapModuleEntry::iterator Iterator;
44 //ConstIterator Begin() const { return ModuleInternal.begin(); }
45 //Iterator Begin() { return ModuleInternal.begin(); }
46 //ConstIterator End() const { return ModuleInternal.end(); }
47 //Iterator End() { return ModuleInternal.end(); }
48
49 Macro() = default;
50 friend std::ostream& operator<<(std::ostream& _os, const Macro&_val);
51
52 void Clear() { ModuleInternal.clear(); }
53
55 void AddMacroEntry(const Tag& tag, const MacroEntry & module)
56 {
57 ModuleInternal.insert(
58 MapModuleEntry::value_type(tag, module));
59 }
60
63 bool FindMacroEntry(const Tag &tag) const;
64 const MacroEntry& GetMacroEntry(const Tag &tag) const;
65
66 void SetName( const char *name) { Name = name; }
67 const char *GetName() const { return Name.c_str(); }
68
69 // Verify will print on std::cerr for error
70 // Upon success will return true, false otherwise
71 bool Verify(const DataSet& ds, Usage const & usage) const;
72
73private:
74 //Module &operator=(const Module &_val); // purposely not implemented
75 //Module(const Module &_val); // purposely not implemented
76
77 MapModuleEntry ModuleInternal;
78 std::string Name;
79};
80//-----------------------------------------------------------------------------
81 inline std::ostream& operator<<(std::ostream& _os, const Macro &_val)
82{
83 _os << _val.Name << '\n';
84 Macro::MapModuleEntry::const_iterator it = _val.ModuleInternal.begin();
85 for(;it != _val.ModuleInternal.end(); ++it)
86 {
87 const Tag &t = it->first;
88 const MacroEntry &de = it->second;
89 _os << t << " " << de << '\n';
90 }
91
92 return _os;
93}
94
95} // end namespace gdcm
96
97#endif //GDCMMACRO_H
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements).
Definition gdcmDataSet.h:56
gdcm::Macro::GetMacroEntry
const MacroEntry & GetMacroEntry(const Tag &tag) const
gdcm::Macro::operator<<
friend std::ostream & operator<<(std::ostream &_os, const Macro &_val)
Definition gdcmMacro.h:81
gdcm::Macro::ArrayIncludeMacrosType
std::vector< std::string > ArrayIncludeMacrosType
Definition gdcmMacro.h:40
gdcm::Macro::AddMacroEntry
void AddMacroEntry(const Tag &tag, const MacroEntry &module)
Will add a ModuleEntry directly at root-level. See Macro for nested-included level.
Definition gdcmMacro.h:55
gdcm::Macro::Clear
void Clear()
Definition gdcmMacro.h:52
gdcm::Macro::SetName
void SetName(const char *name)
Definition gdcmMacro.h:66
gdcm::Macro::Verify
bool Verify(const DataSet &ds, Usage const &usage) const
gdcm::Macro::GetName
const char * GetName() const
Definition gdcmMacro.h:67
gdcm::Macro::MapModuleEntry
std::map< Tag, MacroEntry > MapModuleEntry
Definition gdcmMacro.h:39
gdcm::Macro::Macro
Macro()=default
gdcm::Macro::FindMacroEntry
bool FindMacroEntry(const Tag &tag) const
gdcm::Tag
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
gdcm::Usage
Usage.
Definition gdcmUsage.h:49
gdcmMacroEntry.h
gdcmTag.h
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::MacroEntry
ModuleEntry MacroEntry
Definition gdcmModuleEntry.h:72
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88