]> Creatis software - gdcm.git/blobdiff - src/gdcmDataEntry.h
upgrades for 4DSplitter
[gdcm.git] / src / gdcmDataEntry.h
index 0464c372a6b46d2465cd2f5a1032ac0a0c63ca13..a4f25424ffcc6d3dc01c7d3be332a1dc3d5b64ea 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDataEntry.h,v $
   Language:  C++
-  Date:      $Date: 2006/03/01 09:29:29 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2011/03/29 07:36:00 $
+  Version:   $Revision: 1.23 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
      PURPOSE.  See the above copyright notices for more information.
                                                                                 
 =========================================================================*/
-
-#ifndef GDCMDATAENTRY_H
-#define GDCMDATAENTRY_H
+#ifndef _GDCMDATAENTRY_H_
+#define _GDCMDATAENTRY_H_
 
 #include "gdcmDocEntry.h"
 
 #include <vector> // for GetDSValue
 #include <iostream>
 
-namespace gdcm 
+namespace GDCM_NAME_SPACE 
 {
 //-----------------------------------------------------------------------------
 /**
@@ -40,15 +40,19 @@ class GDCM_EXPORT DataEntry  : public DocEntry
 
 public:
 /// \brief Contructs a DataEntry with a RefCounter from DictEntry
-   static DataEntry *New(DictEntry *e) {return new DataEntry(e);}
+//   static DataEntry *New(DictEntry *e) {return new DataEntry(e);}
 /// \brief Contructs a DataEntry with a RefCounter from DocEntry
    static DataEntry *New(DocEntry *d)  {return new DataEntry(d);}
-
+/// \brief Contructs a DataEntry with a RefCounter from elementary items
+   static DataEntry *New(uint16_t group,uint16_t elem, VRKey const &vr)  
+           {return new DataEntry(group,elem,vr);}
+   
 // Print
    void Print(std::ostream &os = std::cout, std::string const &indent = "");
 
 // Write
-   virtual void WriteContent(std::ofstream *fp, FileType filetype);
+   virtual void WriteContent(std::ofstream *fp, FileType filetype,
+                               bool insideMetaElements, bool insideSequence);
    uint32_t ComputeFullLength();
    
 // Set/Get data
@@ -64,11 +68,16 @@ public:
    void SetValue(const uint32_t &id,const double &val);
    double GetValue(const uint32_t &id) const;
    uint32_t GetValueCount() const;
-   bool IsValueCountValid() const;
+   bool IsValueCountValid() /*const*/; // GetVM may update the pointer DicomDict
 
    void SetString(std::string const &value);
    std::string const &GetString() const;
 
+   std::string const &GetHexaRepresentation() const;
+
+   bool IsNumerical();
+   bool GetNumerical(std::vector <double> &valueVector);
+    
    /// \brief Sets SelfArea
    void SetSelfArea(bool area) { SelfArea = area; }
    /// \brief True if Entry owns its BinArea
@@ -94,7 +103,7 @@ public:
    /// \brief Sets the state (Loaded, NotLoaded, UnFound, ...) of the DataEntry
    void SetState(const TValueState &state) { State = state; }
    /// \brief Returns the state (Loaded, NotLoaded, ...) of the DataEntry
-      const TValueState &GetState() const { return State; }
+   const TValueState &GetState() const { return State; }
    /// \brief true when value Entry not loaded  
    bool IsNotLoaded() { return State == STATE_NOTLOADED; }
    /// \brief true if Entry not found  
@@ -107,7 +116,7 @@ public:
    // Flags
    /// \brief sets the 'pixel data flag'   
    void SetFlag(const TValueFlag &flag) { Flag = flag; }
-   /// \brief returns the 'pixel data flag'    
+   /// \brief returns the 'pixel data flag'
    const TValueFlag &GetFlag() const { return Flag; }
    /// \brief true id Entry is a Pixel Data entry
    bool IsPixelData() { return (Flag &FLAG_PIXELDATA) != 0; }
@@ -124,8 +133,9 @@ public:
    bool GetDSValue(std::vector <double> &valueVector);
 
 protected:
-   DataEntry(DictEntry *e);
-   DataEntry(DocEntry *d); 
+  // DataEntry(DictEntry *e);
+   DataEntry(DocEntry *d);
+   DataEntry(uint16_t group,uint16_t elem,VRKey const &vr); 
    ~DataEntry();
 
 // Methods :
@@ -140,8 +150,11 @@ protected:
    bool SelfArea;
    /// \brief  std::string representable value of the Entry. 
    ///        Parts of a multivaluated data are separated by back-slash
-   mutable std::string StrArea;
+   mutable std::string *StrArea; // to avoid allocating useless std::string
 
+   /// \brief  std::string Hexadecimal represention of the value Entry. 
+   ///        Parts of a multivaluated data are separated by back-slash
+   mutable std::string *StrHexaArea; // to avoid allocating useless std::string
 private:
    /// \brief 0 for straight entries, FLAG_PIXELDATA for Pixel Data entries
    TValueFlag Flag;