GDCM
2.2.0
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 00005 Copyright (c) 2006-2011 Mathieu Malaterre 00006 All rights reserved. 00007 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 #ifndef GDCMIODS_H 00015 #define GDCMIODS_H 00016 00017 #include "gdcmTypes.h" 00018 #include "gdcmIOD.h" 00019 00020 #include <map> 00021 00022 namespace gdcm 00023 { 00029 class GDCM_EXPORT IODs 00030 { 00031 public: 00032 typedef std::string IODName; 00033 typedef std::map<IODName, IOD> IODMapType; 00034 00035 IODs() {} 00036 friend std::ostream& operator<<(std::ostream& _os, const IODs &_val); 00037 00038 void Clear() { IODsInternal.clear(); } 00039 00040 void AddIOD(const char *name , const IOD & module ) 00041 { 00042 IODsInternal.insert( 00043 IODMapType::value_type(name, module)); 00044 } 00045 const IOD &GetIOD(const char *name) const 00046 { 00047 //return IODsInternal[name]; 00048 IODMapType::const_iterator it = IODsInternal.find( name ); 00049 assert( it != IODsInternal.end() ); 00050 assert( it->first == name ); 00051 return it->second; 00052 } 00053 00054 typedef IODMapType::const_iterator IODMapTypeConstIterator; 00055 IODMapTypeConstIterator Begin() const { return IODsInternal.begin(); } 00056 IODMapTypeConstIterator End() const { return IODsInternal.end(); } 00057 00058 private: 00059 IODMapType IODsInternal; 00060 }; 00061 //----------------------------------------------------------------------------- 00062 inline std::ostream& operator<<(std::ostream& _os, const IODs &_val) 00063 { 00064 IODs::IODMapType::const_iterator it = _val.IODsInternal.begin(); 00065 for(;it != _val.IODsInternal.end(); ++it) 00066 { 00067 const std::string &name = it->first; 00068 const IOD &m = it->second; 00069 _os << name << " " << m << '\n'; 00070 } 00071 00072 return _os; 00073 } 00074 00075 00076 } // end namespace gdcm 00077 00078 #endif //GDCMIODS_H