GDCM  2.2.0
gdcmBasicOffsetTable.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 
15 #ifndef GDCMBASICOFFSETTABLE_H
16 #define GDCMBASICOFFSETTABLE_H
17 
18 #include "gdcmFragment.h"
19 
20 namespace gdcm
21 {
27 {
28 //protected:
29 // void SetTag(const Tag &t);
30 public:
32  friend std::ostream &operator<<(std::ostream &os, const BasicOffsetTable &val);
33 
34 /*
35  VL GetLength() const {
36  assert( !ValueLengthField.IsUndefined() );
37  assert( !ValueField || ValueField->GetLength() == ValueLengthField );
38  return TagField.GetLength() + ValueLengthField.GetLength()
39  + ValueLengthField;
40  }
41 */
42 
43  template <typename TSwap>
44  std::istream &Read(std::istream &is) {
45  // Superclass
46  const Tag itemStart(0xfffe, 0xe000);
47  const Tag seqDelItem(0xfffe,0xe0dd);
48  if( !TagField.Read<TSwap>(is) )
49  {
50  assert(0 && "Should not happen");
51  return is;
52  }
53  //assert( TagField == itemStart );
54  if( TagField != itemStart )
55  {
56  // Bug_Siemens_PrivateIconNoItem.dcm
57  throw "SIEMENS Icon thingy";
58  }
59  if( !ValueLengthField.Read<TSwap>(is) )
60  {
61  assert(0 && "Should not happen");
62  return is;
63  }
64  // Self
66  bv->SetLength(ValueLengthField);
67  if( !bv->Read<TSwap>(is) )
68  {
69  assert(0 && "Should not happen");
70  return is;
71  }
72  ValueField = bv;
73  return is;
74  }
75 
76 /*
77  template <typename TSwap>
78  std::ostream &Write(std::ostream &os) const {
79  const Tag itemStart(0xfffe, 0xe000);
80  const Tag seqDelItem(0xfffe,0xe0dd);
81  if( !TagField.Write<TSwap>(os) )
82  {
83  assert(0 && "Should not happen");
84  return os;
85  }
86  assert( TagField == itemStart );
87  if( !ValueLengthField.Write<TSwap>(os) )
88  {
89  assert(0 && "Should not happen");
90  return os;
91  }
92  if( ValueLengthField )
93  {
94  // Self
95  const ByteValue *bv = GetByteValue();
96  assert( bv );
97  assert( bv->GetLength() == ValueLengthField );
98  if( !bv->Write<TSwap>(os) )
99  {
100  assert(0 && "Should not happen");
101  return os;
102  }
103  }
104  return os;
105  }
106 */
107 };
108 //-----------------------------------------------------------------------------
109 inline std::ostream &operator<<(std::ostream &os, const BasicOffsetTable &val)
110 {
111  os << " BasicOffsetTable Length=" << val.ValueLengthField << std::endl;
112  if( val.ValueField )
113  {
114  const ByteValue *bv = val.GetByteValue();
115  assert( bv );
116  os << *bv;
117  }
118 
119  return os;
120 }
121 
122 
123 } // end namespace gdcm
124 
125 #endif //GDCMBASICOFFSETTABLE_H

Generated on Wed Jun 13 2012 20:40:37 for GDCM by doxygen 1.8.1
SourceForge.net Logo