GDCM  2.2.0
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

Generated on Wed Jun 13 2012 20:40:37 for GDCM by doxygen 1.8.1
SourceForge.net Logo