]> Creatis software - gdcm.git/commitdiff
ENH: Who would have bet ! Some cosmetic cleanups
authormalaterre <malaterre>
Sun, 1 Aug 2004 03:20:23 +0000 (03:20 +0000)
committermalaterre <malaterre>
Sun, 1 Aug 2004 03:20:23 +0000 (03:20 +0000)
src/gdcmBinEntry.cxx
src/gdcmDocEntry.cxx
src/gdcmDocEntry.h
src/gdcmDocEntrySet.cxx
src/gdcmDocEntrySet.h
src/gdcmDocument.cxx
src/gdcmDocument.h
src/gdcmSQItem.cxx
src/gdcmValEntry.cxx

index 03a93ba24af4486b0e04fbafa99d31d955c0e31a..de10fd2a9d84fb6e6ad0191ac489d75f7d29f90a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/08/01 00:59:21 $
-  Version:   $Revision: 1.20 $
+  Date:      $Date: 2004/08/01 03:20:23 $
+  Version:   $Revision: 1.21 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -41,7 +41,7 @@ gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry())
    ReadLength   = e->GetReadLength();
    ImplicitVR   = e->IsImplicitVR();
    Offset       = e->GetOffset();
-   printLevel   = e->GetPrintLevel();
+   PrintLevel   = e->GetPrintLevel();
    SQDepthLevel = e->GetDepthLevel();
 
    voidArea = NULL; // let's be carefull !
index cd53a4b0e99c94d82eee6c43981cdbf8105e78e7..e299a36b45272349d07b91d7724e3673fa064922 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/08/01 00:59:21 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2004/08/01 03:20:23 $
+  Version:   $Revision: 1.15 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -36,7 +36,7 @@
 gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in)
 {
    ImplicitVR = false;
-   entry = in;
+   DictEntry = in;
 }
 
 //-----------------------------------------------------------------------------
@@ -48,7 +48,7 @@ gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in)
  */
 void gdcmDocEntry::Print(std::ostream & os)
 {
-   printLevel=2; // FIXME
+   PrintLevel = 2; // FIXME
    
    size_t o;
    unsigned short int g, e;
@@ -66,7 +66,7 @@ void gdcmDocEntry::Print(std::ostream & os)
    sprintf(greltag,"%04x|%04x ",g,e);           
    s << greltag ;
        
-   if (printLevel>=2)
+   if (PrintLevel >= 2)
    {
       s << "lg : ";
       lgth = GetReadLength(); // ReadLength, as opposed to UsableLength
@@ -97,7 +97,7 @@ void gdcmDocEntry::Print(std::ostream & os)
 
    s << "[" << vr  << "] ";
 
-   if (printLevel >= 1)
+   if (PrintLevel >= 1)
    {
       s.setf(std::ios::left);
       s << std::setw(66-GetName().length()) << " ";
@@ -119,7 +119,7 @@ void gdcmDocEntry::Write(FILE *fp, FileType filetype)
    uint16_t el    = GetElement();
    uint32_t lgr   = GetReadLength();
 
-   if ( (group == 0xfffe) && (el == 0x0000) )
+   if ( group == 0xfffe && el == 0x0000 )
    {
      // Fix in order to make some MR PHILIPS images e-film readable
      // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm:
@@ -235,12 +235,12 @@ uint32_t gdcmDocEntry::GetFullLength()
  */
 void gdcmDocEntry::Copy (gdcmDocEntry* e)
 {
-   entry        = e->entry;
+   DictEntry    = e->DictEntry;
    UsableLength = e->UsableLength;
    ReadLength   = e->ReadLength;
    ImplicitVR   = e->ImplicitVR;
    Offset       = e->Offset;
-   printLevel   = e->printLevel;
+   PrintLevel   = e->PrintLevel;
    // TODO : remove gdcmDocEntry SQDepth
 }
 
@@ -249,7 +249,7 @@ void gdcmDocEntry::Copy (gdcmDocEntry* e)
  * \brief   tells us if entry is the last one of a 'no length' SequenceItem 
  *          (fffe,e00d) 
  */
-bool gdcmDocEntry::isItemDelimitor()
+bool gdcmDocEntry::IsItemDelimitor()
 {
    return (GetGroup() == 0xfffe && GetElement() == 0xe00d);
 }
@@ -258,7 +258,7 @@ bool gdcmDocEntry::isItemDelimitor()
  * \brief   tells us if entry is the last one of a 'no length' Sequence 
  *          (fffe,e0dd) 
  */
-bool gdcmDocEntry::isSequenceDelimitor()
+bool gdcmDocEntry::IsSequenceDelimitor()
 {
    return (GetGroup() == 0xfffe && GetElement() == 0xe0dd);
 }
index 9f7a59a65c4b8a91f38e3b1aa2f9360aec16e032..194501ccb35b41a8fbdcba65d608dbe747d5a3d9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.h,v $
   Language:  C++
-  Date:      $Date: 2004/08/01 00:59:21 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2004/08/01 03:20:23 $
+  Version:   $Revision: 1.16 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -41,22 +41,22 @@ public:
    gdcmDocEntry(gdcmDictEntry*);
 
    /// Returns the Dicom Group number of the current Dicom Header Entry
-   uint16_t      GetGroup()     { return entry->GetGroup();  };
+   uint16_t      GetGroup()     { return DictEntry->GetGroup();  };
 
    /// Returns the Dicom Element number of the current Dicom Header Entry
-   uint16_t      GetElement()   { return entry->GetElement();};
+   uint16_t      GetElement()   { return DictEntry->GetElement();};
 
    /// Returns the 'key' of the current Dicom Header Entry
-   std::string  GetKey()       { return entry->GetKey();    };
+   std::string  GetKey()       { return DictEntry->GetKey();    };
 
    /// \brief Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom
    /// Dictionnary of the current Dicom Header Entry
-   std::string  GetName()      { return entry->GetName();   };
+   std::string  GetName()      { return DictEntry->GetName();   };
 
    /// \brief Returns the 'Value Representation' (e.g. "PN" : Person Name,
    /// "SL" : Signed Long), found in the Dicom Header or in the Dicom
    /// Dictionnary, of the current Dicom Header Entry
-   std::string  GetVR()        { return entry->GetVR();     };
+   std::string  GetVR()        { return DictEntry->GetVR();     };
 
    /// \brief Returns offset (since the beginning of the file, including
    /// the File Pramble, if any) of the value of the current Dicom HeaderEntry
@@ -75,17 +75,17 @@ public:
    uint32_t GetReadLength() { return ReadLength; };
 
    /// Sets the 'Value Representation' of the current Dicom Header Entry
-   void SetVR(std::string const & v) { entry->SetVR(v); };    
+   void SetVR(std::string const & v) { DictEntry->SetVR(v); };    
 
    /// \brief Sets both 'Read Length' and 'Usable Length' of the current
    /// Dicom Header Entry
-   void SetLength(uint32_t l) { ReadLength=UsableLength=l;};
+   void SetLength(uint32_t l) { ReadLength = UsableLength = l;};
       
    // The following 3 members, for internal use only ! 
    
    /// \brief Sets only 'Read Length' (*not* 'Usable Length') of the current
    /// Dicom Header Entry
-   void SetReadLength(uint32_t l) { ReadLength   = l; };
+   void SetReadLength(uint32_t l) { ReadLength = l; };
 
    /// \brief Sets only 'Usable Length' (*not* 'Read Length') of the current
    /// Dicom Header Entry
@@ -105,22 +105,22 @@ public:
 
    /// \brief Tells us if the VR of the current Dicom Element is Unknown
    /// @return true if the VR is unkonwn
-   bool IsVRUnknown() { return entry->IsVRUnknown(); };
+   bool IsVRUnknown() { return DictEntry->IsVRUnknown(); };
 
    /// \brief   Sets the DicEntry of the current Dicom Element
    /// @param   NewEntry pointer to the DictEntry
-   void SetDictEntry(gdcmDictEntry *NewEntry) { entry = NewEntry; };
+   void SetDictEntry(gdcmDictEntry *newEntry) { DictEntry = newEntry; };
 
    /// \brief  Gets the DicEntry of the current Dicom Element
    /// @return The DicEntry of the current Dicom Element
-   gdcmDictEntry * GetDictEntry() { return entry; }; 
+   gdcmDictEntry * GetDictEntry() { return DictEntry; }; 
 
    /// \brief Sets the print level for the Dicom Header Elements
    /// \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
-   void SetPrintLevel(int level) { printLevel = level; };
+   void SetPrintLevel(int level) { PrintLevel = level; };
 
    /// \brief Gets the print level for the Dicom Header Elements
-   int GetPrintLevel() { return printLevel; };
+   int GetPrintLevel() { return PrintLevel; };
    
    virtual void Print (std::ostream & os = std::cout); 
    virtual void Write(FILE *fp, FileType filetype);
@@ -129,8 +129,8 @@ public:
    
    void Copy(gdcmDocEntry *doc);
 
-   bool isItemDelimitor();
-   bool isSequenceDelimitor();   
+   bool IsItemDelimitor();
+   bool IsSequenceDelimitor();   
 
    /// \brief Gets the depth level of a Dicom header entry embedded in
    ///        a SeQuence
@@ -138,8 +138,8 @@ public:
 
    /// \brief Sets the depth level of a Dicom header entry embedded in
    ///        a SeQuence
-   void SetDepthLevel(int depth) {SQDepthLevel = depth;}
-            
+   void SetDepthLevel(int depth) { SQDepthLevel = depth; }
+
 private:
    // FIXME: In fact we should be more specific and use :
    // friend gdcmDocEntry * gdcmHeader::ReadNextElement(void);
@@ -149,7 +149,7 @@ protected:
 // Variables
 
    /// \brief pointer to the underlying Dicom dictionary element
-   gdcmDictEntry *entry;
+   gdcmDictEntry *DictEntry;
    
    /// \brief Updated from ReadLength, by FixFoungLentgh() for fixing a bug
    /// in the header or helping the parser going on    
@@ -169,7 +169,7 @@ protected:
    size_t Offset; 
 
    /// How many details are to be printed (value : 0,1,2)      
-   int printLevel;
+   int PrintLevel;
    
    /// Gives the depth level of elements inside SeQuences   
    int SQDepthLevel;
index f2ba890326188a95ca50526b68cb345d4d8bb8ef..e33a0cbc06dbcf060661c8b820800e154df9640b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntrySet.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/30 11:40:13 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2004/08/01 03:20:23 $
+  Version:   $Revision: 1.15 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
  * \ingroup gdcmDocEntrySet
  * \brief   Constructor from a given gdcmDocEntrySet
  */
-gdcmDocEntrySet::gdcmDocEntrySet(int depthLevel) {
-   SQDepthLevel = depthLevel + 1;
+gdcmDocEntrySet::gdcmDocEntrySet(int depthLevel)
+{
+   SQDepthLevel = depthLevel + 1;   //magic +1 !
 }
 /**
  * \brief   Canonical destructor.
  */
-gdcmDocEntrySet::~gdcmDocEntrySet(){
+gdcmDocEntrySet::~gdcmDocEntrySet()
+{
 }
 //-----------------------------------------------------------------------------
 // Print
@@ -60,22 +62,24 @@ gdcmDocEntrySet::~gdcmDocEntrySet(){
  * @param   Group group   number of the underlying DictEntry
  * @param   Elem  element number of the underlying DictEntry
  */
-gdcmValEntry *gdcmDocEntrySet::NewValEntryByNumber(uint16_t Group,
-                                                   uint16_t Elem) 
+gdcmValEntry *gdcmDocEntrySet::NewValEntryByNumber(uint16_t group,
+                                                   uint16_t elem) 
 {
    // Find out if the tag we encountered is in the dictionaries:
-   gdcmDictEntry *DictEntry = GetDictEntryByNumber(Group, Elem);
-   if (!DictEntry)
-      DictEntry = NewVirtualDictEntry(Group, Elem);
+   gdcmDictEntry *dictEntry = GetDictEntryByNumber(group, elem);
+   if (!dictEntry)
+   {
+      dictEntry = NewVirtualDictEntry(group, elem);
+   }
 
-   gdcmValEntry *NewEntry = new gdcmValEntry(DictEntry);
-   if (!NewEntry) 
+   gdcmValEntry *newEntry = new gdcmValEntry(dictEntry);
+   if (!newEntry) 
    {
       dbg.Verbose(1, "gdcmDocument::NewValEntryByNumber",
                   "failed to allocate gdcmValEntry");
-      return NULL;
+      return 0;
    }
-   return NewEntry;
+   return newEntry;
 }
 
 
@@ -86,22 +90,24 @@ gdcmValEntry *gdcmDocEntrySet::NewValEntryByNumber(uint16_t Group,
  * @param   Group group   number of the underlying DictEntry
  * @param   Elem  element number of the underlying DictEntry
  */
-gdcmBinEntry *gdcmDocEntrySet::NewBinEntryByNumber(uint16_t Group,
-                                                   uint16_t Elem) 
+gdcmBinEntry *gdcmDocEntrySet::NewBinEntryByNumber(uint16_t group,
+                                                   uint16_t elem) 
 {
    // Find out if the tag we encountered is in the dictionaries:
-   gdcmDictEntry *DictEntry = GetDictEntryByNumber(Group, Elem);
-   if (!DictEntry)
-      DictEntry = NewVirtualDictEntry(Group, Elem);
+   gdcmDictEntry *dictEntry = GetDictEntryByNumber(group, elem);
+   if (!dictEntry)
+   {
+      dictEntry = NewVirtualDictEntry(group, elem);
+   }
 
-   gdcmBinEntry *NewEntry = new gdcmBinEntry(DictEntry);
-   if (!NewEntry) 
+   gdcmBinEntry *newEntry = new gdcmBinEntry(dictEntry);
+   if (!newEntry) 
    {
       dbg.Verbose(1, "gdcmDocument::NewBinEntryByNumber",
                   "failed to allocate gdcmBinEntry");
-      return NULL;
+      return 0;
    }
-   return NewEntry;
+   return newEntry;
 }
 //-----------------------------------------------------------------------------
 // Protected
@@ -110,11 +116,15 @@ gdcmBinEntry *gdcmDocEntrySet::NewBinEntryByNumber(uint16_t Group,
  * \brief   Gets a Dicom Element inside a SQ Item Entry, by name
  * @return
  */
- gdcmDocEntry *gdcmDocEntrySet::GetDocEntryByName(std::string name) {
-   gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict();
-   gdcmDictEntry *dictEntry = (*PubDict).GetDictEntryByName(name);
-   if( dictEntry == NULL)
-      return NULL;
+ gdcmDocEntry *gdcmDocEntrySet::GetDocEntryByName(std::string const & name)
+ {
+   gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+   gdcmDictEntry *dictEntry = pubDict->GetDictEntryByName(name);
+   if( !dictEntry )
+   {
+      return 0;
+   }
+
    return GetDocEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement());      
 }
 
@@ -125,13 +135,17 @@ gdcmBinEntry *gdcmDocEntrySet::NewBinEntryByNumber(uint16_t Group,
  * @return
  */ 
 
-std::string gdcmDocEntrySet::GetEntryByName(TagName name)  {
-   gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict();
-   gdcmDictEntry *dictEntry = (*PubDict).GetDictEntryByName(name); 
+std::string gdcmDocEntrySet::GetEntryByName(TagName const & name)
+{
+   gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+   gdcmDictEntry *dictEntry = pubDict->GetDictEntryByName(name); 
 
-   if( dictEntry == NULL)
+   if( !dictEntry )
+   {
       return GDCM_UNFOUND;
-   return GetEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement()); 
+   }
+
+   return GetEntryByNumber(dictEntry->GetGroup(), dictEntry->GetElement()); 
 }
 
 
@@ -145,9 +159,9 @@ std::string gdcmDocEntrySet::GetEntryByName(TagName name)  {
  */
 gdcmDictEntry* gdcmDocEntrySet::NewVirtualDictEntry(uint16_t group,
                                                     uint16_t element,
-                                                    std::string vr,
-                                                    std::string fourth,
-                                                    std::string name)
+                                                    std::string const & vr,
+                                                    std::string const & fourth,
+                                                    std::string const & name)
 {
    return gdcmGlobal::GetDicts()->NewVirtualDictEntry(group,element,vr,fourth,name);
 }
@@ -160,37 +174,42 @@ gdcmDocEntry* gdcmDocEntrySet::NewDocEntryByNumber(uint16_t group,
                                                    uint16_t elem)
 {
    // Find out if the tag we encountered is in the dictionaries:
-   gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict();
-   gdcmDictEntry *DictEntry = (*PubDict).GetDictEntryByNumber(group, elem);
-   if (!DictEntry)
-      DictEntry = NewVirtualDictEntry(group, elem);
+   gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+   gdcmDictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, elem);
+   if (!dictEntry)
+   {
+      dictEntry = NewVirtualDictEntry(group, elem);
+   }
 
-   gdcmDocEntry *NewEntry = new gdcmDocEntry(DictEntry);
-   if (!NewEntry) 
+   gdcmDocEntry *newEntry = new gdcmDocEntry(dictEntry);
+   if (!newEntry) 
    {
       dbg.Verbose(1, "gdcmSQItem::NewDocEntryByNumber",
                   "failed to allocate gdcmDocEntry");
-      return (gdcmDocEntry*)0;
+      return 0;
    }
-   return NewEntry;
+   return newEntry;
 }
 
 /// \brief 
-gdcmDocEntry *gdcmDocEntrySet::NewDocEntryByName  (std::string Name) {
-
-  gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict();
-  gdcmDictEntry *NewTag = (*PubDict).GetDictEntryByName(Name);
-   if (!NewTag)
-      NewTag = NewVirtualDictEntry(0xffff, 0xffff, "LO", "unkn", Name);
+gdcmDocEntry *gdcmDocEntrySet::NewDocEntryByName  (std::string const & name)
+{
+  gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+  gdcmDictEntry *newTag = pubDict->GetDictEntryByName(name);
+   if (!newTag)
+   {
+      newTag = NewVirtualDictEntry(0xffff, 0xffff, "LO", "unkn", name);
+   }
 
-   gdcmDocEntry* NewEntry = new gdcmDocEntry(NewTag);
-   if (!NewEntry) 
+   gdcmDocEntry* newEntry = new gdcmDocEntry(newTag);
+   if (!newEntry) 
    {
       dbg.Verbose(1, "gdcmSQItem::ObtainDocEntryByName",
                   "failed to allocate gdcmDocEntry");
-      return (gdcmDocEntry *)0;
+      return 0;
    }
-   return NewEntry;
+
+   return newEntry;
 }
 
 
@@ -201,17 +220,19 @@ gdcmDocEntry *gdcmDocEntrySet::NewDocEntryByName  (std::string Name) {
  * @param   Name name of the searched DictEntry
  * @return  Corresponding DictEntry when it exists, NULL otherwise.
  */
-gdcmDictEntry *gdcmDocEntrySet::GetDictEntryByName(std::string Name) 
+gdcmDictEntry *gdcmDocEntrySet::GetDictEntryByName(std::string const & name) 
 {
-   gdcmDictEntry *found = (gdcmDictEntry *)0;
-   gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict();
-   if (!PubDict) 
+   gdcmDictEntry *found = 0;
+   gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+   if (!pubDict) 
    {
       dbg.Verbose(0, "gdcmDocument::GetDictEntry",
                      "we SHOULD have a default dictionary");
    }
-   else 
-     found = PubDict->GetDictEntryByName(Name);  
+   else
+   {
+      found = pubDict->GetDictEntryByName(name);  
+   }
    return found;
 }
 
@@ -227,15 +248,17 @@ gdcmDictEntry *gdcmDocEntrySet::GetDictEntryByName(std::string Name)
 gdcmDictEntry *gdcmDocEntrySet::GetDictEntryByNumber(uint16_t group,
                                                      uint16_t element) 
 {
-   gdcmDictEntry *found = (gdcmDictEntry *)0;
-   gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict();
-   if (!PubDict) 
+   gdcmDictEntry *found = 0;
+   gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+   if (!pubDict) 
    {
       dbg.Verbose(0, "gdcmDocument::GetDictEntry",
                      "we SHOULD have a default dictionary");
    }
-   else 
-     found = PubDict->GetDictEntryByNumber(group, element);  
+   else
+   {
+      found = pubDict->GetDictEntryByNumber(group, element);  
+   }
    return found;
 }
 
index 4ed6d4a0e0f8bedac3f0e630297c4e1b305ef193..e3af97b3cbb4998ff58a706f47b218f6d434a2a8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntrySet.h,v $
   Language:  C++
-  Date:      $Date: 2004/07/02 13:55:27 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2004/08/01 03:20:23 $
+  Version:   $Revision: 1.14 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -38,11 +38,11 @@ public:
    virtual void Print (std::ostream & os = std::cout) = 0;// pure virtual
 
    /// \brief write any type of entry to the entry set
-   virtual void Write (FILE *fp, FileType filetype)=0;// pure virtual
+   virtual void Write (FILE *fp, FileType filetype) = 0;// pure virtual
 
    /// \brief Gets the depth level of a Dicom Header Entry embedded in a
    ///        SeQuence
-   int GetDepthLevel(void) { return SQDepthLevel; }
+   int GetDepthLevel() { return SQDepthLevel; }
 
    /// \brief Sets the depth level of a Dicom Header Entry embedded in a
    /// SeQuence
@@ -50,14 +50,14 @@ public:
 
    virtual gdcmDocEntry* GetDocEntryByNumber(uint16_t group,
                                              uint16_t element) = 0;
-   gdcmDocEntry *GetDocEntryByName(std::string name);
+   gdcmDocEntry *GetDocEntryByName(std::string const & name);
    virtual std::string GetEntryByNumber(uint16_t group,uint16_t element) = 0;
-   std::string GetEntryByName(TagName name);
+   std::string GetEntryByName(TagName const & name);
    gdcmDictEntry *NewVirtualDictEntry(uint16_t group, 
                                       uint16_t element,
-                                      std::string vr     = "unkn",
-                                      std::string fourth = "unkn",
-                                      std::string name   = "unkn");
+                                      std::string const & vr     = "unkn",
+                                      std::string const & fourth = "unkn",
+                                      std::string const & name   = "unkn");
   
 protected:
 
@@ -68,17 +68,15 @@ protected:
                                      uint16_t element);
    gdcmDocEntry* NewDocEntryByNumber(uint16_t group, 
                                      uint16_t element); 
-   gdcmDocEntry* NewDocEntryByName  (std::string Name);
+   gdcmDocEntry* NewDocEntryByName  (std::string const & name);
 
 // DictEntry  related utilities
-   gdcmDictEntry *GetDictEntryByName  (std::string Name);
+   gdcmDictEntry *GetDictEntryByName  (std::string const & name);
    gdcmDictEntry *GetDictEntryByNumber(uint16_t, uint16_t);
 
    /// Gives the depth level of the element set inside SeQuences   
    int SQDepthLevel;
-
 private:
-    
 };
 
 
index 499accac5410d45dee99ccb863dedd6eaa0adfab..36d1703c4d4548d6973ea45e747ad937fa2323db 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/08/01 00:59:21 $
-  Version:   $Revision: 1.62 $
+  Date:      $Date: 2004/08/01 03:20:23 $
+  Version:   $Revision: 1.63 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -244,7 +244,7 @@ bool gdcmDocument::SetShaDict(gdcmDict *dict)
  * \brief   Set the shadow dictionary used
  * \param   dictName name of the dictionary to use in shadow
  */
-bool gdcmDocument::SetShaDict(DictKey dictName)
+bool gdcmDocument::SetShaDict(DictKey const & dictName)
 {
    RefShaDict = gdcmGlobal::GetDicts()->GetDict(dictName);
    return !RefShaDict;
@@ -831,7 +831,7 @@ int gdcmDocument::GetEntryLengthByNumber(uint16_t group, uint16_t element)
  * @param   tagName name of the searched Dicom Element.
  * @return  true when found
  */
-bool gdcmDocument::SetEntryByName(std::string content,std::string tagName)
+bool gdcmDocument::SetEntryByName(std::string const & content,std::string const & tagName)
 {
    gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName); 
    if( !dictEntry )
@@ -851,7 +851,7 @@ bool gdcmDocument::SetEntryByName(std::string content,std::string tagName)
  * @param   group     group number of the Dicom Element to modify
  * @param   element element number of the Dicom Element to modify
  */
-bool gdcmDocument::SetEntryByNumber(std::string content, 
+bool gdcmDocument::SetEntryByNumber(std::string const & content, 
                                     uint16_t group,
                                     uint16_t element) 
 {
@@ -863,11 +863,12 @@ bool gdcmDocument::SetEntryByNumber(std::string content,
       return false;
    }
    // Non even content must be padded with a space (020H)...
-   if( content.length() % 2 )
+   std::string evenContent = content;
+   if( evenContent.length() % 2 )
    {
-      content += '\0';  // ... therefore we padd with (000H) .!?!
+      evenContent += '\0';  // ... therefore we padd with (000H) .!?!
    }      
-   valEntry->SetValue(content);
+   valEntry->SetValue(evenContent);
    
    // Integers have a special treatement for their length:
    gdcmVRKey vr = valEntry->GetVR();
@@ -881,7 +882,7 @@ bool gdcmDocument::SetEntryByNumber(std::string content,
    }
    else
    {
-      valEntry->SetLength(content.length());
+      valEntry->SetLength(evenContent.length());
    }
 
    return true;
@@ -915,10 +916,10 @@ bool gdcmDocument::SetEntryByNumber(void *content,
       //content = content + '\0'; // fing a trick to enlarge a binary field?
    }
 */      
-   gdcmBinEntry * a;
-   a = (gdcmBinEntry *)TagHT[key];           
+   gdcmBinEntry* a = (gdcmBinEntry *)TagHT[key];           
    a->SetVoidArea(content);  
    //a->SetLength(lgth);  // ???  
+
    return true;
 } 
 
@@ -1065,8 +1066,9 @@ bool gdcmDocument::SetEntryVoidAreaByNumber(void * area,
    {
       return false;
    }
-      // This was for multimap ?
-    (( gdcmBinEntry *)( ((TagHT.equal_range(key)).first)->second ))->SetVoidArea(area);
+
+   // This was for multimap ?
+   (( gdcmBinEntry *)( ((TagHT.equal_range(key)).first)->second ))->SetVoidArea(area);
       
    return true;
 }
@@ -1244,7 +1246,7 @@ uint16_t gdcmDocument::SwapShort(uint16_t a)
 {
    if ( SwapCode == 4321 || SwapCode == 2143 )
    {
-      a =((( a << 8 ) & 0x0ff00 ) | (( a >> 8 ) & 0x00ff ) );
+      a = ((( a << 8 ) & 0x0ff00 ) | (( a >> 8 ) & 0x00ff ) );
    }
    return a;
 }
@@ -1300,7 +1302,7 @@ long gdcmDocument::ParseDES(gdcmDocEntrySet *set,
             newValEntry->SetDepthLevel(depth);
             set->AddEntry(newValEntry);
             LoadDocEntry(newValEntry);
-            if (newValEntry->isItemDelimitor())
+            if (newValEntry->IsItemDelimitor())
             {
                break;
             }
@@ -1410,7 +1412,7 @@ long gdcmDocument::ParseSQ(gdcmSeqEntry *set,
       }
       if( delim_mode )
       {
-         if ( newDocEntry->isSequenceDelimitor() )
+         if ( newDocEntry->IsSequenceDelimitor() )
          {
             set->SetSequenceDelimitationItem( newDocEntry );
             break;
@@ -1688,9 +1690,9 @@ void gdcmDocument::FindDocEntryLength (gdcmDocEntry *entry)
       // endian encoding". When this is the case, chances are we have got our
       // hands on a big endian encoded file: we switch the swap code to
       // big endian and proceed...
-      if ( (element  == 0x0000) && (length16 == 0x0400) ) 
+      if ( element  == 0x0000 && length16 == 0x0400 ) 
       {
-         if ( ! IsExplicitVRBigEndianTransferSyntax() ) 
+         if ( !IsExplicitVRBigEndianTransferSyntax() ) 
          {
             dbg.Verbose(0, "gdcmDocument::FindLength", "not explicit VR");
             errno = 1;
@@ -1801,7 +1803,7 @@ bool gdcmDocument::CheckDocEntryVR(gdcmDocEntry *entry, gdcmVRKey vr)
    // expected VR read happens to be non-ascii characters we consider
    // we hit falsely explicit VR tag.
 
-   if ( (!isalpha(vr[0])) && (!isalpha(vr[1])) )
+   if ( !isalpha(vr[0]) && !isalpha(vr[1]) )
    {
       realExplicit = false;
    }
@@ -2542,7 +2544,7 @@ gdcmDocEntry *gdcmDocument::ReadNextDocEntry()
    {
       // Call it quits
       delete newEntry;
-      return NULL;
+      return 0;
    }
    newEntry->SetOffset(ftell(Fp));  
 
@@ -2625,8 +2627,8 @@ bool gdcmDocument::ReadTag(uint16_t testGroup, uint16_t testElement)
  */
 uint32_t gdcmDocument::ReadTagLength(uint16_t testGroup, uint16_t testElement)
 {
-   long PositionOnEntry = ftell(Fp);
-   (void)PositionOnEntry;
+   long positionOnEntry = ftell(Fp);
+   (void)positionOnEntry;
 
    if ( !ReadTag(testGroup, testElement) )
    {
@@ -2743,7 +2745,7 @@ void gdcmDocument::Parse7FE0 ()
 
       // Make sure that at the end of the item we encounter a 'Sequence
       // Delimiter Item':
-      if ( ! ReadTag(0xfffe, 0xe0dd) )
+      if ( !ReadTag(0xfffe, 0xe0dd) )
       {
          dbg.Verbose(0, "gdcmDocument::Parse7FE0: no sequence delimiter item");
          dbg.Verbose(0, "    at end of RLE item sequence");
index c5b4eac08a97b3b21b05405004ff230afe71aefa..b5d1523731de8e184bc34113b1b1b191a92c5227 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.h,v $
   Language:  C++
-  Date:      $Date: 2004/07/31 23:30:04 $
-  Version:   $Revision: 1.27 $
+  Date:      $Date: 2004/08/01 03:20:23 $
+  Version:   $Revision: 1.28 $
  
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -111,11 +111,11 @@ public:
    gdcmDict *GetPubDict();
    gdcmDict *GetShaDict();
    bool SetShaDict(gdcmDict *dict);
-   bool SetShaDict(DictKey dictName);
+   bool SetShaDict(DictKey const & dictName);
 
 // Informations contained in the parser
    virtual bool IsReadable();
-   bool IsGivenTransferSyntax(std::string const & SyntaxToCheck);
+   bool IsGivenTransferSyntax(std::string const & syntaxToCheck);
    bool IsImplicitVRLittleEndianTransferSyntax();
    bool IsExplicitVRLittleEndianTransferSyntax();
    bool IsDeflatedExplicitVRLittleEndianTransferSyntax();
@@ -171,8 +171,9 @@ public:
    virtual std::string GetEntryVRByNumber(uint16_t group, uint16_t elem);
    virtual int     GetEntryLengthByNumber(uint16_t group, uint16_t elem);
 protected:
-   virtual bool SetEntryByName  (std::string content, std::string tagName);
-   virtual bool SetEntryByNumber(std::string content,
+   virtual bool SetEntryByName  (std::string const & content, 
+                                 std::string const & tagName);
+   virtual bool SetEntryByNumber(std::string const & content,
                                  uint16_t group, uint16_t element);
    virtual bool SetEntryByNumber(void *content, int lgth,
                                  uint16_t group, uint16_t element);
@@ -198,7 +199,7 @@ protected:
 private:
    // Read
    long ParseDES(gdcmDocEntrySet *set, long offset, long l_max,bool delim_mode);
-   long ParseSQ(gdcmSeqEntry *seq, long offset, long l_max, bool delim_mode); 
+   long ParseSQ (gdcmSeqEntry *seq, long offset, long l_max, bool delim_mode); 
    
    void LoadDocEntry      (gdcmDocEntry *);
    void FindDocEntryLength(gdcmDocEntry *);
index cdd330d0b00a4f1dcac4f44d2d8163faa5b0faa5..b861e9d98364aa2af6fdf94e871145bd078d171f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSQItem.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/08/01 00:59:21 $
-  Version:   $Revision: 1.22 $
+  Date:      $Date: 2004/08/01 03:20:23 $
+  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
@@ -105,7 +105,7 @@ void gdcmSQItem::Write(FILE *fp,FileType filetype)
       // (when it exists) we don't write it right now
       // It will be written outside, because ALL the SQItems are written
       // as 'no length'
-      if ( (*i)->isItemDelimitor() )
+      if ( (*i)->IsItemDelimitor() )
       {
          break;
       }
index 2ab55cbfaf39685372e476628e464dde7c47ed3d..3dd80953caa06389b42baaa21f9537ab9b645e4a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmValEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/08/01 00:59:22 $
-  Version:   $Revision: 1.19 $
+  Date:      $Date: 2004/08/01 03:20:23 $
+  Version:   $Revision: 1.20 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -45,7 +45,7 @@ gdcmValEntry::gdcmValEntry(gdcmDocEntry* e) : gdcmDocEntry(e->GetDictEntry())
    ReadLength   = e->GetReadLength();
    ImplicitVR   = e->IsImplicitVR();
    Offset       = e->GetOffset();
-   printLevel   = e->GetPrintLevel();
+   PrintLevel   = e->GetPrintLevel();
    SQDepthLevel = e->GetDepthLevel();
 
    voidArea = NULL; // will be in BinEntry ?
@@ -92,7 +92,7 @@ void gdcmValEntry::Print(std::ostream & os)
    v  = GetValue();  // not applicable for SQ ...     
    d2 = CreateCleanString(v);  // replace non printable characters by '.'            
    if( (GetLength()<=MAX_SIZE_PRINT_ELEMENT_VALUE) || 
-       (printLevel>=3)  || (d2.find("gdcm::NotLoaded.") < d2.length()) )
+       (PrintLevel>=3)  || (d2.find("gdcm::NotLoaded.") < d2.length()) )
    {
       s << " [" << d2 << "]";
    }