GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmIODs.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 GDCMIODS_H
15 #define GDCMIODS_H
16
17 #include "gdcmTypes.h"
18 #include "gdcmIOD.h"
19
20 #include <map>
21
22 namespace gdcm
23 {
29 class GDCM_EXPORT IODs
30 {
31 public:
32 typedef std::string IODName;
33 typedef std::map<IODName, IOD> IODMapType;
34
35 IODs() {}
36 friend std::ostream& operator<<(std::ostream& _os, const IODs &_val);
37
38 void Clear() { IODsInternal.clear(); }
39
40 void AddIOD(const char *name , const IOD & module )
41 {
42 IODsInternal.insert(
43 IODMapType::value_type(name, module));
44 }
45 const IOD &GetIOD(const char *name) const
46 {
47 //return IODsInternal[name];
48 IODMapType::const_iterator it = IODsInternal.find( name );
49 assert( it != IODsInternal.end() );
50 assert( it->first == name );
51 return it->second;
52 }
53
54 typedef IODMapType::const_iterator IODMapTypeConstIterator;
55 IODMapTypeConstIterator Begin() const { return IODsInternal.begin(); }
56 IODMapTypeConstIterator End() const { return IODsInternal.end(); }
57
58 private:
59 IODMapType IODsInternal;
60 };
61 //-----------------------------------------------------------------------------
62 inline std::ostream& operator<<(std::ostream& _os, const IODs &_val)
63 {
64 IODs::IODMapType::const_iterator it = _val.IODsInternal.begin();
65 for(;it != _val.IODsInternal.end(); ++it)
66 {
67 const std::string &name = it->first;
68 const IOD &m = it->second;
69 _os << name << " " << m << '\n';
70 }
71
72 return _os;
73 }
74
75
76 } // end namespace gdcm
77
78 #endif //GDCMIODS_H