GDCM  2.2.6
gdcmCSAHeaderDict.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 GDCMCSAHEADERDICT_H
15 #define GDCMCSAHEADERDICT_H
16 
17 #include "gdcmTypes.h"
18 #include "gdcmTag.h"
19 #include "gdcmCSAHeaderDictEntry.h"
20 
21 #include <iostream>
22 #include <iomanip>
23 #include <set>
24 #include <exception>
25 
26 namespace gdcm
27 {
28 
29 class GDCM_EXPORT CSAHeaderDictException : public std::exception {};
30 
35 {
36 public:
37  typedef std::set<CSAHeaderDictEntry> MapCSAHeaderDictEntry;
38  typedef MapCSAHeaderDictEntry::iterator Iterator;
39  typedef MapCSAHeaderDictEntry::const_iterator ConstIterator;
40  //static CSAHeaderDictEntry GroupLengthCSAHeaderDictEntry; // = CSAHeaderDictEntry("Group Length",VR::UL,VM::VM1);
41 
42  CSAHeaderDict():CSAHeaderDictInternal() {
43  assert( CSAHeaderDictInternal.empty() );
44  }
45 
46  friend std::ostream& operator<<(std::ostream& _os, const CSAHeaderDict &_val);
47 
48  ConstIterator Begin() const { return CSAHeaderDictInternal.begin(); }
49  ConstIterator End() const { return CSAHeaderDictInternal.end(); }
50 
51  bool IsEmpty() const { return CSAHeaderDictInternal.empty(); }
53  {
54 #ifndef NDEBUG
55  MapCSAHeaderDictEntry::size_type s = CSAHeaderDictInternal.size();
56 #endif
57  CSAHeaderDictInternal.insert( de );
58  assert( s < CSAHeaderDictInternal.size() );
59  }
60 
61  const CSAHeaderDictEntry &GetCSAHeaderDictEntry(const char *name) const
62  {
63  MapCSAHeaderDictEntry::const_iterator it = CSAHeaderDictInternal.find( name );
64  if( it != CSAHeaderDictInternal.end() )
65  {
66  return *it;
67  }
68  throw CSAHeaderDictException();
69  }
70 
71 protected:
72  friend class Dicts;
73  void LoadDefault();
74 
75 private:
76  CSAHeaderDict &operator=(const CSAHeaderDict &_val); // purposely not implemented
77  CSAHeaderDict(const CSAHeaderDict &_val); // purposely not implemented
78 
79  MapCSAHeaderDictEntry CSAHeaderDictInternal;
80 };
81 //-----------------------------------------------------------------------------
82 inline std::ostream& operator<<(std::ostream& os, const CSAHeaderDict &val)
83 {
84  CSAHeaderDict::MapCSAHeaderDictEntry::const_iterator it = val.CSAHeaderDictInternal.begin();
85  for(;it != val.CSAHeaderDictInternal.end(); ++it)
86  {
87  const CSAHeaderDictEntry &de = *it;
88  os << de << '\n';
89  }
90 
91 
92  return os;
93 }
94 
95 
96 } // end namespace gdcm
97 
98 #endif //GDCMCSAHEADERDICT_H
std::set< CSAHeaderDictEntry > MapCSAHeaderDictEntry
Definition: gdcmCSAHeaderDict.h:37
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
Definition: gdcmCSAHeaderDict.h:29
bool IsEmpty() const
Definition: gdcmCSAHeaderDict.h:51
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition: gdcmDirectory.h:92
const CSAHeaderDictEntry & GetCSAHeaderDictEntry(const char *name) const
Definition: gdcmCSAHeaderDict.h:61
ConstIterator Begin() const
Definition: gdcmCSAHeaderDict.h:48
MapCSAHeaderDictEntry::iterator Iterator
Definition: gdcmCSAHeaderDict.h:38
Class to manipulate the sum of knowledge (all the dict user load)
Definition: gdcmDicts.h:28
Class to represent an Entry in the Dict Does not really exist within the DICOM definition, just a way to minimize storage and have a mapping from gdcm::Tag to the needed information.
Definition: gdcmCSAHeaderDictEntry.h:38
ConstIterator End() const
Definition: gdcmCSAHeaderDict.h:49
Class to represent a map of CSAHeaderDictEntry.
Definition: gdcmCSAHeaderDict.h:34
CSAHeaderDict()
Definition: gdcmCSAHeaderDict.h:42
void AddCSAHeaderDictEntry(const CSAHeaderDictEntry &de)
Definition: gdcmCSAHeaderDict.h:52
MapCSAHeaderDictEntry::const_iterator ConstIterator
Definition: gdcmCSAHeaderDict.h:39

Generated on Sat Dec 21 2013 05:56:16 for GDCM by doxygen 1.8.5
SourceForge.net Logo