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