]> Creatis software - gdcm.git/blob - src/gdcmElValue.h
*ENH gdcmHeader constructor has one more parameter (default value : false)
[gdcm.git] / src / gdcmElValue.h
1 // $Header: /cvs/public/gdcm/src/Attic/gdcmElValue.h,v 1.9 2003/11/10 14:17:12 jpr Exp $
2
3 #ifndef GDCMELVALUE_H
4 #define GDCMELVALUE_H
5
6 #include "gdcmDictEntry.h"
7 class gdcmHeader;
8
9 #include <stdio.h>
10
11 ///////////////////////////////////////////////////////////////////////////
12 // The dicom header of a Dicom file contains a set of such ELement VALUES
13 // (when successfuly parsed against a given Dicom dictionary)
14 class GDCM_EXPORT gdcmElValue {
15 private:
16    gdcmDictEntry *entry;
17    guint32 UsableLength;  // Updated from ReadLength, by FixFoungLentgh()
18                           // for fixing a bug in the header or helping
19                           // the parser going on 
20                           
21    guint32 ReadLength;    // Length actually read on disk
22                           // (before FixFoundLength)
23                           // ReadLength will be updated only when
24                           // FixFoundLength actually fixes a bug in the header,
25                           // not when it performs a trick to help the Parser
26                           // going on.
27                           // *for internal* use only
28         
29    bool ImplicitVr;       // Even when reading explicit vr files, some
30                           // elements happen to be implicit. Flag them here
31                           // since we can't use the entry->vr without breaking
32                           // the underlying dictionary.
33                           
34    void SetOffset(size_t of){ Offset = of; };
35    // FIXME: In fact we should be more specific and use :
36    //friend gdcmElValue * gdcmHeader::ReadNextElement(void);
37    friend class gdcmHeader;
38 public:
39    std::string  value;
40    void * voidArea;  // unsecure memory area to hold 'non string' values 
41                      // (ie : Lookup Tables, overlays)
42    size_t Offset;    // Offset from the begining of file for direct user access
43         
44    gdcmElValue(gdcmDictEntry*);
45    void SetDictEntry(gdcmDictEntry *NewEntry) { entry = NewEntry; };
46    bool   IsVrUnknown(void) { return entry->IsVrUnknown(); };
47    void SetImplicitVr(void) { ImplicitVr = true; };
48    bool  IsImplicitVr(void) { return ImplicitVr; };
49         
50    gdcmDictEntry * GetDictEntry(void) { return entry;    };
51    
52    guint16      GetGroup(void)     { return entry->GetGroup();  };
53    guint16      GetElement(void)   { return entry->GetElement();};
54    std::string  GetKey(void)       { return entry->GetKey();    };
55    std::string  GetName(void)      { return entry->GetName();   };
56    std::string  GetVR(void)        { return entry->GetVR();     };
57    std::string  GetValue(void)     { return value;              };
58    void *       GetVoidArea(void)  { return voidArea;           };
59    size_t       GetOffset(void)    { return Offset;             };   
60    guint32      GetLength(void)    { return UsableLength;       };
61    // for internal use only!
62    guint32      GetReadLength(void){ return ReadLength;         };
63    
64    void         SetVR(std::string v)      { entry->SetVR(v);          };    
65    void         SetLength(guint32 l)      { ReadLength=UsableLength=l;};   
66    // The following 2 members, for internal use only ! 
67    void         SetReadLength(guint32 l)  { ReadLength = l;           };        
68    void         SetUsableLength(guint32 l){ UsableLength = l;         };        
69         
70    void         SetValue(std::string val) { value = val;       };
71    void         SetVoidArea(void * area)  { voidArea = area;   };       
72  
73 };
74
75 #endif