GDCM  2.4.5
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_ns
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  gdcmDebugMacro( "Could be Bug_Siemens_PrivateIconNoItem.dcm" );
58  throw "SIEMENS Icon thingy";
59  }
60  if( !ValueLengthField.Read<TSwap>(is) )
61  {
62  assert(0 && "Should not happen");
63  return is;
64  }
65  // Self
67  bv->SetLength(ValueLengthField);
68  if( !bv->Read<TSwap>(is) )
69  {
70  assert(0 && "Should not happen");
71  return is;
72  }
73  ValueField = bv;
74  return is;
75  }
76 
77 /*
78  template <typename TSwap>
79  std::ostream &Write(std::ostream &os) const {
80  const Tag itemStart(0xfffe, 0xe000);
81  const Tag seqDelItem(0xfffe,0xe0dd);
82  if( !TagField.Write<TSwap>(os) )
83  {
84  assert(0 && "Should not happen");
85  return os;
86  }
87  assert( TagField == itemStart );
88  if( !ValueLengthField.Write<TSwap>(os) )
89  {
90  assert(0 && "Should not happen");
91  return os;
92  }
93  if( ValueLengthField )
94  {
95  // Self
96  const ByteValue *bv = GetByteValue();
97  assert( bv );
98  assert( bv->GetLength() == ValueLengthField );
99  if( !bv->Write<TSwap>(os) )
100  {
101  assert(0 && "Should not happen");
102  return os;
103  }
104  }
105  return os;
106  }
107 */
108 };
109 //-----------------------------------------------------------------------------
110 inline std::ostream &operator<<(std::ostream &os, const BasicOffsetTable &val)
111 {
112  os << " BasicOffsetTable Length=" << val.ValueLengthField << std::endl;
113  if( val.ValueField )
114  {
115  const ByteValue *bv = val.GetByteValue();
116  assert( bv );
117  os << *bv;
118  }
119 
120  return os;
121 }
122 
123 
124 } // end namespace gdcm_ns
125 
126 #endif //GDCMBASICOFFSETTABLE_H
BasicOffsetTable()
Definition: gdcmBasicOffsetTable.h:31
std::istream & Read(std::istream &is)
Definition: gdcmBasicOffsetTable.h:44
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
#define gdcmDebugMacro(msg)
Debug.
Definition: gdcmTrace.h:119
Class to represent a Fragment.
Definition: gdcmFragment.h:43
VL ValueLengthField
Definition: gdcmDataElement.h:248
const ByteValue * GetByteValue() const
Definition: gdcmDataElement.h:130
Class to represent binary value (array of bytes)
Definition: gdcmByteValue.h:35
Class for Smart Pointer.
Definition: gdcmObject.h:26
ValuePtr ValueField
Definition: gdcmDataElement.h:253
Class to represent a BasicOffsetTable.
Definition: gdcmBasicOffsetTable.h:26
std::ostream & operator<<(std::ostream &os, const BasicOffsetTable &val)
Definition: gdcmBasicOffsetTable.h:110
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element). Basically an uint32_t which...
Definition: gdcmTag.h:38

Generated on Fri Sep 25 2015 17:58:22 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo