]> Creatis software - gdcm.git/commitdiff
ENH: Change the unsafe type char to the full enum type. Much safer, and special flags...
authormalaterre <malaterre>
Wed, 26 Oct 2005 15:56:51 +0000 (15:56 +0000)
committermalaterre <malaterre>
Wed, 26 Oct 2005 15:56:51 +0000 (15:56 +0000)
src/gdcmDataEntry.cxx
src/gdcmDataEntry.h

index 56578ccceb994f314b439a834902d39eb08b5903..6dc581e8b040c535a63a81258bb9fde984a4ec8d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDataEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/26 15:48:33 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2005/10/26 15:56:51 $
+  Version:   $Revision: 1.13 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -54,7 +54,7 @@ DataEntry::DataEntry(DictEntry *e)
 DataEntry::DataEntry(DocEntry *e)
             : DocEntry(e->GetDictEntry())
 {
-   Flag = 0;
+   Flag = FLAG_NONE;
    BinArea = 0;
    SelfArea = true;
 
index d9e71a3a9d14552957b948e22cb4e9be63887bc5..7a85bbf32cc3deb2227ada1564cae9aa8b57ef85 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDataEntry.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/24 16:00:47 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2005/10/26 15:56:51 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -74,9 +74,25 @@ public:
    /// \brief True if Entry owns its BinArea
    bool IsSelfArea() { return SelfArea; }
 
+   ///\brief values for current state of a DataEntry (internal use only)
+   typedef enum
+   {
+      STATE_LOADED    = 0x00,
+      STATE_NOTLOADED = 0x01,
+      STATE_UNFOUND   = 0x02,
+      STATE_UNREAD    = 0x03
+   } TValueState;
+   
+   ///\brief values for current pixel status of a DataEntry (internal use only)
+   typedef enum
+   {
+      FLAG_NONE       = 0x00,
+      FLAG_PIXELDATA  = 0x01
+   } TValueFlag;
+
    // State
-   void SetState(const char &state) { State = state; }
-   const char &GetState() const { return State; }
+   void SetState(const TValueState &state) { State = 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  
@@ -88,9 +104,9 @@ public:
 
    // Flags
    /// \brief sets the 'pixel data flag'   
-   void SetFlag(const char &flag) { Flag = flag; }
+   void SetFlag(const TValueFlag &flag) { Flag = flag; }
    /// \brief returns the 'pixel data flag'    
-   const char &GetFlag() const { return Flag; }
+   const TValueFlag &GetFlag() const { return Flag; }
    /// \brief true id Entry is a Pixel Data entry
    bool IsPixelData() { return (Flag & FLAG_PIXELDATA) != 0; }
 
@@ -102,22 +118,6 @@ public:
    /// \brief Header Elements too long will not be printed
    static void SetMaxSizePrintEntry(const uint32_t &size) { MaxSizePrintEntry = size; }
 
-   ///\brief values for current state of a DataEntry (internal use only)
-   typedef enum
-   {
-      STATE_LOADED    = 0x00,
-      STATE_NOTLOADED = 0x01,
-      STATE_UNFOUND   = 0x02,
-      STATE_UNREAD    = 0x03
-   } TValueState;
-   
-   ///\brief values for current pixel status of a DataEntry (internal use only)
-   typedef enum
-   {
-      FLAG_NONE       = 0x00,
-      FLAG_PIXELDATA  = 0x01
-   } TValueFlag;
-
 protected:
    DataEntry(DictEntry *e);
    DataEntry(DocEntry *d); 
@@ -139,9 +139,9 @@ protected:
 
 private:
    /// \brief 0 for straight entries, FLAG_PIXELDATA for Pixel Data entries
-   char Flag;
+   TValueFlag Flag;
    /// \brief Entry status : STATE_NOTLOADED,STATE_UNFOUND, STATE_UNREAD, 0
-   char State;
+   TValueState State;
 
    /// \brief Size threshold above which an element val
    ///        By default, this upper bound is fixed to 64 bytes.