]> 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 77590de3758fb5c0fdc399f947a7d2c6a73e9b36..886dd48912aa37898cb6854c3471e91d4ffe4d53 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/18 02:35:35 $
-  Version:   $Revision: 1.28 $
+  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
@@ -29,20 +29,20 @@ namespace gdcm
  * \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
 */
 
 DictEntry::DictEntry(uint16_t group, uint16_t element,
-                     TagName const & vr, TagName const & fourth,
-                     TagName const & name)
+                     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);
 }
@@ -61,9 +61,7 @@ DictEntry::DictEntry(uint16_t group, uint16_t element,
  */
 TagKey DictEntry::TranslateToKey(uint16_t group, uint16_t element)
 {
-   TagKey key = Util::Format("%04x|%04x", group , element);
-
-   return key;
+   return Util::Format("%04x|%04x", group, element);
 }
 
 //-----------------------------------------------------------------------------
@@ -72,7 +70,7 @@ TagKey DictEntry::TranslateToKey(uint16_t group, uint16_t element)
  * \            is unset then overwrite it.
  * @param vr    New V(alue) R(epresentation) to be set.
  */
-void DictEntry::SetVR(TagName const & vr) 
+void DictEntry::SetVR(TagName const &vr) 
 {
    if ( IsVRUnknown() )
    {
@@ -80,11 +78,27 @@ void DictEntry::SetVR(TagName const & vr)
    }
    else 
    {
-      dbg.Error(true, "DictEntry::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