GDCM  2.4.5
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;
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() {}
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
Class to represent a Data Set (which contains Data Elements) A Data Set represents an instance of a r...
Definition: gdcmDataSet.h:55
const char * GetName() const
Definition: gdcmModule.h:73
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
Usage.
Definition: gdcmUsage.h:48
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition: gdcmDirectory.h:88
void Clear()
Definition: gdcmModule.h:53
Class for representing a Module.
Definition: gdcmModule.h:37
Module()
Definition: gdcmModule.h:50
std::map< Tag, ModuleEntry > MapModuleEntry
Definition: gdcmModule.h:40
void AddMacro(const char *include)
Definition: gdcmModule.h:62
Class for representing a ModuleEntry.
Definition: gdcmModuleEntry.h:29
void AddModuleEntry(const Tag &tag, const ModuleEntry &module)
Will add a ModuleEntry direcly at root-level. See Macro for nested-included level.
Definition: gdcmModule.h:56
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element). Basically an uint32_t which...
Definition: gdcmTag.h:38
void SetName(const char *name)
Definition: gdcmModule.h:72
Definition: gdcmASN1.h:20
std::vector< std::string > ArrayIncludeMacrosType
Definition: gdcmModule.h:41
Class for representing a Modules.
Definition: gdcmMacros.h:29

Generated on Fri Sep 25 2015 17:58:23 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo