]> Creatis software - gdcm.git/blobdiff - src/gdcmDictEntry.cxx
2005-01-13 Jean-Pierre Roux <jpr@creatis.univ-lyon1.fr>
[gdcm.git] / src / gdcmDictEntry.cxx
index c37c793842eebf843e0772a0c4893d25b0ac051a..886dd48912aa37898cb6854c3471e91d4ffe4d53 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/09 02:57:11 $
-  Version:   $Revision: 1.24 $
+  Date:      $Date: 2005/01/10 17:17:52 $
+  Version:   $Revision: 1.38 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -20,6 +20,8 @@
 #include "gdcmDebug.h"
 #include "gdcmUtil.h"
 
+namespace gdcm 
+{
 
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
  * \brief   Constructor
  * @param   group      DICOM-Group Number
  * @param   element    DICOM-Element Number
- * @param   vr         Value Representatiion
- * @param   fourth    // DO NOT use any longer; 
- *                       NOT part of the Dicom Standard
+ * @param   vr         Value Representation
+ * @param   vm         Value Mutlplicity 
  * @param   name      description of the element
 */
 
-gdcmDictEntry::gdcmDictEntry(uint16_t group, uint16_t element,
-                             std::string vr, std::string fourth,
-                             std::string name)
+DictEntry::DictEntry(uint16_t group, uint16_t element,
+                     TagName const &vr, 
+                     TagName const &vm,
+                     TagName const &name)
 {
    Group   = group;
    Element = element;
    VR      = vr;
-   Fourth  = fourth;
+   VM      = vm;
    Name    = name;
    Key     = TranslateToKey(group, element);
 }
@@ -57,11 +59,9 @@ gdcmDictEntry::gdcmDictEntry(uint16_t group, uint16_t element,
  * @param  element the Dicom element number used to build the tag
  * @return the built tag
  */
-gdcmTagKey gdcmDictEntry::TranslateToKey(uint16_t group, uint16_t element)
+TagKey DictEntry::TranslateToKey(uint16_t group, uint16_t element)
 {
-   gdcmTagKey key = Format("%04x|%04x", group , element);
-
-   return key;
+   return Util::Format("%04x|%04x", group, element);
 }
 
 //-----------------------------------------------------------------------------
@@ -70,7 +70,7 @@ gdcmTagKey gdcmDictEntry::TranslateToKey(uint16_t group, uint16_t element)
  * \            is unset then overwrite it.
  * @param vr    New V(alue) R(epresentation) to be set.
  */
-void gdcmDictEntry::SetVR(std::string const & vr) 
+void DictEntry::SetVR(TagName const &vr) 
 {
    if ( IsVRUnknown() )
    {
@@ -78,11 +78,27 @@ void gdcmDictEntry::SetVR(std::string const & vr)
    }
    else 
    {
-      dbg.Error(true, "gdcmDictEntry::SetVR",
-                       "Overwriting VR might compromise a dictionary");
+      gdcmErrorMacro( "Overwriting VR might compromise a dictionary");
    }
 }
 
+//-----------------------------------------------------------------------------
+/**
+ * \brief       If-and only if-the V(alue) M(ultiplicity)
+ * \            is unset then overwrite it.
+ * @param vm    New V(alue) M(ultiplicity) to be set.
+ */
+void DictEntry::SetVM(TagName const &vm) 
+{
+   if ( IsVMUnknown() )
+   {
+      VM = vm;
+   }
+   else 
+   {
+      gdcmErrorMacro( "Overwriting VM might compromise a dictionary");
+   }
+}
 //-----------------------------------------------------------------------------
 // Protected
 
@@ -90,3 +106,5 @@ void gdcmDictEntry::SetVR(std::string const & vr)
 // Private
 
 //-----------------------------------------------------------------------------
+} // end namespace gdcm
+