GDCM 2.2.1

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

- File List
- File Members

gdcmTable.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 GDCMTABLE_H
15 #define GDCMTABLE_H
16
17 #include "gdcmTableEntry.h"
18 #include "gdcmTag.h"
19
20 #include <map>
21
22 namespace gdcm
23 {
24
28 class Table
29 {
30 public:
31 typedef std::map<Tag, TableEntry> MapTableEntry;
32 Table() {}
33 ~Table() {}
34
35 friend std::ostream& operator<<(std::ostream& _os, const Table &_val);
36
37 void InsertEntry(Tag const &tag, TableEntry const &te)
38 {
39 #ifndef NDEBUG
40 MapTableEntry::size_type s = TableInternal.size();
41 #endif
42 TableInternal.insert(
43 MapTableEntry::value_type(tag, te));
44 assert( s < TableInternal.size() );
45 }
46
47 const TableEntry &GetTableEntry(const Tag &tag) const
48 {
49 MapTableEntry::const_iterator it =
50 TableInternal.find(tag);
51 if (it == TableInternal.end())
52 {
53 assert( 0 && "Impossible" );
54 return GetTableEntry(Tag(0,0));
55 }
56 return it->second;
57 }
58
59 private:
60 Table &operator=(const Table &_val); // purposely not implemented
61 Table(const Table&_val); // purposely not implemented
62
63 MapTableEntry TableInternal;
64 };
65
66 } // end namespace gdcm
67
68 #endif //GDCMTABLE_H