GDCM
2.2.3
|
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 00015 #ifndef GDCMGROUPDICT_H 00016 #define GDCMGROUPDICT_H 00017 00018 #include "gdcmTypes.h" 00019 00020 #include <assert.h> 00021 #include <vector> 00022 #include <string> 00023 #include <iostream> 00024 #include <iomanip> 00025 00026 namespace gdcm 00027 { 00033 class GDCM_EXPORT GroupDict 00034 { 00035 public: 00036 typedef std::vector<std::string> GroupStringVector; 00037 GroupDict() { FillDefaultGroupName(); } 00038 ~GroupDict() {} 00039 00040 friend std::ostream& operator<<(std::ostream& _os, const GroupDict &_val); 00041 00042 size_t Size() const 00043 { 00044 assert( Names.size() == Abbreviations.size() ); 00045 return Names.size(); } 00046 00047 std::string const &GetAbbreviation(uint16_t num) const; 00048 00049 std::string const &GetName(uint16_t num) const; 00050 00051 protected: 00052 void Add(std::string const &abbreviation, std::string const &name); 00053 void Insert(uint16_t num, std::string const &abbreviation, std::string const &name); 00054 00055 private: 00056 // Generated implementation, see gdcmDefaultGroupNames 00057 void FillDefaultGroupName(); 00058 00059 GroupDict &operator=(const GroupDict &_val); // purposely not implemented 00060 GroupDict(const GroupDict &_val); // purposely not implemented 00061 00062 GroupStringVector Abbreviations; 00063 GroupStringVector Names; 00064 }; 00065 //----------------------------------------------------------------------------- 00066 inline std::ostream& operator<<(std::ostream& _os, const GroupDict &_val) 00067 { 00068 size_t size = _val.Size(); 00069 for(size_t i=0; i<size; ++i) 00070 { 00071 _os << std::hex << std::setw(4) << std::setfill( '0' ) << i << "," 00072 << _val.GetAbbreviation((uint16_t)i) << "," << _val.GetName((uint16_t)i) << "\n"; 00073 } 00074 return _os; 00075 } 00076 00077 } // end namespace gdcm 00078 00079 #endif //GDCMGROUPDICT_H