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 #ifndef GDCMTABLE_H 00015 #define GDCMTABLE_H 00016 00017 #include "gdcmTableEntry.h" 00018 #include "gdcmTag.h" 00019 00020 #include <map> 00021 00022 namespace gdcm 00023 { 00024 00028 class Table 00029 { 00030 public: 00031 typedef std::map<Tag, TableEntry> MapTableEntry; 00032 Table() {} 00033 ~Table() {} 00034 00035 friend std::ostream& operator<<(std::ostream& _os, const Table &_val); 00036 00037 void InsertEntry(Tag const &tag, TableEntry const &te) 00038 { 00039 #ifndef NDEBUG 00040 MapTableEntry::size_type s = TableInternal.size(); 00041 #endif 00042 TableInternal.insert( 00043 MapTableEntry::value_type(tag, te)); 00044 assert( s < TableInternal.size() ); 00045 } 00046 00047 const TableEntry &GetTableEntry(const Tag &tag) const 00048 { 00049 MapTableEntry::const_iterator it = 00050 TableInternal.find(tag); 00051 if (it == TableInternal.end()) 00052 { 00053 assert( 0 && "Impossible" ); 00054 return GetTableEntry(Tag(0,0)); 00055 } 00056 return it->second; 00057 } 00058 00059 private: 00060 Table &operator=(const Table &_val); // purposely not implemented 00061 Table(const Table&_val); // purposely not implemented 00062 00063 MapTableEntry TableInternal; 00064 }; 00065 00066 } // end namespace gdcm 00067 00068 #endif //GDCMTABLE_H