]> Creatis software - gdcm.git/blobdiff - src/gdcmDict.cxx
Coding Style + Doxygenation
[gdcm.git] / src / gdcmDict.cxx
index 051d44dee8bde4c8ed186df9554e2ed0cf0bc2d2..8887d8b21d6d9ce79deb9cf5e84f395d1506938d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDict.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/03 18:08:56 $
-  Version:   $Revision: 1.51 $
+  Date:      $Date: 2005/01/06 20:03:27 $
+  Version:   $Revision: 1.54 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -30,10 +30,10 @@ void FillDefaultDataDict(Dict *d);
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
- * \brief   Construtor
+ * \brief   Constructor
  * @param   filename from which to build the dictionary.
  */
-Dict::Dict(std::string const & filename)
+Dict::Dict(std::string const &filename)
 {
    uint16_t group;
    uint16_t element;
@@ -63,10 +63,10 @@ Dict::Dict(std::string const & filename)
          const DictEntry newEntry(group, element, vr, fourth, name);
          AddNewEntry(newEntry);
       }
-      from.close();
 
       Filename = filename;
    }
+   from.close();
 }
 
 /**
@@ -123,7 +123,7 @@ void Dict::PrintByKey(std::ostream &os)
  *                           unpredictable result
  * @param   os The output stream to be written to.
  */
-void Dict::PrintByName(std::ostreamos)
+void Dict::PrintByName(std::ostream &os)
 {
    std::ostringstream s;
 
@@ -148,9 +148,9 @@ void Dict::PrintByName(std::ostream& os)
  * @param   newEntry entry to add 
  * @return  false if Dicom Element already exists
  */
-bool Dict::AddNewEntry(DictEntry const & newEntry) 
+bool Dict::AddNewEntry(DictEntry const &newEntry) 
 {
-   const TagKey & key = newEntry.GetKey();
+   const TagKey &key = newEntry.GetKey();
 
    if(KeyHt.count(key) == 1)
    {
@@ -159,12 +159,8 @@ bool Dict::AddNewEntry(DictEntry const & newEntry)
    } 
    else 
    {
-      KeyHt.insert( 
-         std::map<TagKey, DictEntry>::value_type
-            (newEntry.GetKey(), newEntry));
-      NameHt.insert(
-         std::map<TagName, DictEntry>::value_type
-            (newEntry.GetName(), newEntry ));
+      KeyHt.insert( TagKeyHT::value_type(newEntry.GetKey(), newEntry));
+      NameHt.insert( TagNameHT::value_type(newEntry.GetName(), newEntry ));
       return true;
    }
 }
@@ -175,16 +171,12 @@ bool Dict::AddNewEntry(DictEntry const & newEntry)
  * @param   newEntry new entry (overwrites any previous one with same tag)
  * @return  false if Dicom Element doesn't exist
  */
-bool Dict::ReplaceEntry(DictEntry const & newEntry)
+bool Dict::ReplaceEntry(DictEntry const &newEntry)
 {
    if ( RemoveEntry(newEntry.GetKey()) )
    {
-      KeyHt.insert( 
-         std::map<TagKey, DictEntry>::value_type
-            (newEntry.GetKey(), newEntry));
-      NameHt.insert(
-         std::map<TagName, DictEntry>::value_type
-            (newEntry.GetName(), newEntry ));
+       KeyHt.insert( TagKeyHT::value_type(newEntry.GetKey(), newEntry));
+       NameHt.insert( TagNameHT::value_type(newEntry.GetName(), newEntry ));
        return true;
    } 
    return false;
@@ -197,12 +189,12 @@ bool Dict::ReplaceEntry(DictEntry const & newEntry)
  * @param   key (group|element)
  * @return  false if Dicom Dictionary Entry doesn't exist
  */
-bool Dict::RemoveEntry (TagKey const & key) 
+bool Dict::RemoveEntry (TagKey const &key) 
 {
    TagKeyHT::const_iterator it = KeyHt.find(key);
    if(it != KeyHt.end()) 
    {
-      const DictEntry & entryToDelete = it->second;
+      const DictEntry& entryToDelete = it->second;
       NameHt.erase(entryToDelete.GetName());
       KeyHt.erase(key);
 
@@ -219,12 +211,12 @@ bool Dict::RemoveEntry (TagKey const & key)
  * \brief  removes an already existing Dicom Dictionary Entry, 
  *          identified by its group,element number
  * @param   group   Dicom group number of the Dicom Element
- * @param   element Dicom element number of the Dicom Element
+ * @param   elem Dicom element number of the Dicom Element
  * @return  false if Dicom Dictionary Entry doesn't exist
  */
-bool Dict::RemoveEntry (uint16_t group, uint16_t element)
+bool Dict::RemoveEntry (uint16_t group, uint16_t elem)
 {
-   return RemoveEntry(DictEntry::TranslateToKey(group, element));
+   return RemoveEntry(DictEntry::TranslateToKey(group, elem));
 }
 
 /**
@@ -235,7 +227,7 @@ bool Dict::RemoveEntry (uint16_t group, uint16_t element)
  *            the name MAY CHANGE between two versions !
  * @return  the corresponding dictionnary entry when existing, NULL otherwise
  */
-DictEntry* Dict::GetDictEntryByName(TagName const & name)
+DictEntry *Dict::GetDictEntryByName(TagName const &name)
 {
    TagNameHT::iterator it = NameHt.find(name);
    if ( it == NameHt.end() )
@@ -251,7 +243,7 @@ DictEntry* Dict::GetDictEntryByName(TagName const & name)
  * @param   element element of the entry to be found
  * @return  the corresponding dictionnary entry when existing, NULL otherwise
  */
-DictEntryDict::GetDictEntryByNumber(uint16_t group, uint16_t element)
+DictEntry *Dict::GetDictEntryByNumber(uint16_t group, uint16_t element)
 {
    TagKey key = DictEntry::TranslateToKey(group, element);
    TagKeyHT::iterator it = KeyHt.find(key);
@@ -268,7 +260,7 @@ DictEntry* Dict::GetDictEntryByNumber(uint16_t group, uint16_t element)
  * \sa      DictSet::GetPubDictTagNamesByCategory
  * @return  A list of all entries of the public dicom dictionnary.
  */
-EntryNamesListDict::GetDictEntryNames() 
+EntryNamesList *Dict::GetDictEntryNames() 
 {
    EntryNamesList *result = new EntryNamesList;
    for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag)