GDCM 3.0.24
gdcmModules.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 GDCMMODULES_H
15#define GDCMMODULES_H
16
17#include "gdcmTypes.h"
18#include "gdcmModule.h"
19
20#include <map>
21
22namespace gdcm
23{
30{
31public:
32 typedef std::map<std::string, Module> ModuleMapType;
33
34 Modules() = default;
35 friend std::ostream& operator<<(std::ostream& _os, const Modules &_val);
36
37 void Clear() { ModulesInternal.clear(); }
38
39 // A Module is inserted based on it's ref
40 void AddModule(const char *ref, const Module & module )
41 {
42 assert( ref && *ref );
43 assert( ModulesInternal.find( ref ) == ModulesInternal.end() );
44 ModulesInternal.insert(
45 ModuleMapType::value_type(ref, module));
46 }
47 const Module &GetModule(const char *name) const
48 {
49 assert( name && *name );
50 ModuleMapType::const_iterator it = ModulesInternal.find( name );
51 assert( it != ModulesInternal.end() );
52 assert( it->first == name );
53 return it->second;
54 }
55
56 bool IsEmpty() const { return ModulesInternal.empty(); }
57
58private:
59 ModuleMapType ModulesInternal;
60};
61//-----------------------------------------------------------------------------
62inline std::ostream& operator<<(std::ostream& _os, const Modules &_val)
63{
64 Modules::ModuleMapType::const_iterator it = _val.ModulesInternal.begin();
65 for(;it != _val.ModulesInternal.end(); ++it)
66 {
67 const std::string &name = it->first;
68 const Module &m = it->second;
69 _os << name << " " << m << '\n';
70 }
71
72 return _os;
73}
74
75
76
77} // end namespace gdcm
78
79#endif //GDCMMODULES_H
Class for representing a Module.
Definition gdcmModule.h:38
Class for representing a Modules.
Definition gdcmModules.h:30
const Module & GetModule(const char *name) const
Definition gdcmModules.h:47
void Clear()
Definition gdcmModules.h:37
std::map< std::string, Module > ModuleMapType
Definition gdcmModules.h:32
Modules()=default
void AddModule(const char *ref, const Module &module)
Definition gdcmModules.h:40
bool IsEmpty() const
Definition gdcmModules.h:56
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88