GDCM: gdcmIODs.h Source File

GDCM 3.2.10

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
22namespace gdcm
23{
29 class GDCM_EXPORT IODs
30{
31public:
32 typedef std::string IODName;
33 typedef std::map<IODName, IOD> IODMapType;
34
35 IODs() = default;
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 gdcm_assert( it != IODsInternal.end() );
50 gdcm_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
58private:
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
gdcm::IOD
Class for representing a IOD.
Definition gdcmIOD.h:35
gdcm::IODs::End
IODMapTypeConstIterator End() const
Definition gdcmIODs.h:56
gdcm::IODs::IODMapType
std::map< IODName, IOD > IODMapType
Definition gdcmIODs.h:33
gdcm::IODs::operator<<
friend std::ostream & operator<<(std::ostream &_os, const IODs &_val)
Definition gdcmIODs.h:62
gdcm::IODs::Begin
IODMapTypeConstIterator Begin() const
Definition gdcmIODs.h:55
gdcm::IODs::GetIOD
const IOD & GetIOD(const char *name) const
Definition gdcmIODs.h:45
gdcm::IODs::IODs
IODs()=default
gdcm::IODs::AddIOD
void AddIOD(const char *name, const IOD &module)
Definition gdcmIODs.h:40
gdcm::IODs::IODName
std::string IODName
Definition gdcmIODs.h:32
gdcm::IODs::Clear
void Clear()
Definition gdcmIODs.h:38
gdcm::IODs::IODMapTypeConstIterator
IODMapType::const_iterator IODMapTypeConstIterator
Definition gdcmIODs.h:54
gdcm_assert
#define gdcm_assert(cond)
Definition gdcmException.h:104
gdcmIOD.h
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88