GDCM  2.2.6
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 
24 namespace gdcm
25 {
26 
27 class DataSet;
28 class Usage;
37 {
38 public:
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() {}
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 
73 private:
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
Class to represent a Data Set (which contains Data Elements) A Data Set represents an instance of a r...
Definition: gdcmDataSet.h:55
void SetName(const char *name)
Definition: gdcmMacro.h:66
const char * GetName() const
Definition: gdcmMacro.h:67
void AddMacroEntry(const Tag &tag, const MacroEntry &module)
Will add a ModuleEntry direcly at root-level. See Macro for nested-included level.
Definition: gdcmMacro.h:55
std::vector< std::string > ArrayIncludeMacrosType
Definition: gdcmMacro.h:40
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
Usage.
Definition: gdcmUsage.h:48
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition: gdcmDirectory.h:92
std::map< Tag, MacroEntry > MapModuleEntry
Definition: gdcmMacro.h:39
Macro()
Definition: gdcmMacro.h:49
Class for representing a Macro.
Definition: gdcmMacro.h:36
void Clear()
Definition: gdcmMacro.h:52
Class for representing a ModuleEntry.
Definition: gdcmModuleEntry.h:29
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element). Basically an uint32_t which...
Definition: gdcmTag.h:38

Generated on Sat Dec 21 2013 05:56:17 for GDCM by doxygen 1.8.5
SourceForge.net Logo