]> Creatis software - gdcm.git/blobdiff - src/gdcmTagKey.h
Fix mistypings
[gdcm.git] / src / gdcmTagKey.h
index a498b72a763805b1899b2ba34107f2c0124d1672..e861bcd5320a1f7d8960922e9ce44382907daf61 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmTagKey.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/20 09:23:24 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2007/08/22 16:14:05 $
+  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
                                                                                 
 =========================================================================*/
 
-#ifndef GDCMTAGKEY_H
-#define GDCMTAGKEY_H
+#ifndef _GDCMTAGKEY_H_
+#define _GDCMTAGKEY_H_
 
 #include "gdcmCommon.h"
 
 #include <assert.h>
 #include <iostream>
 #include <iomanip> // for std::ios::left, ...
+#include <stdio.h> // for ugly sprintf
 
-namespace gdcm 
+namespace GDCM_NAME_SPACE 
 {
 //-----------------------------------------------------------------------------
 class TagKey
 {
 public :
-   inline TagKey(const uint16_t &gr, const uint16_t &elt) { tag[0] = gr;tag[1] = elt;}
-   inline TagKey() { tag[0] = tag[1] = 0x0000;}
+   TagKey(uint16_t group, uint16_t elem) { tag[0] = group;tag[1] = elem;}
+   TagKey() { tag[0] = tag[1] = 0x0000;}
 
    friend std::ostream& operator<<(std::ostream& _os, const TagKey &_val);
 
-   inline std::string str() const
+   std::string str() const
    {
       char res[10];
       sprintf(res,"%04x|%04x",tag[0],tag[1]);
       return std::string(res);
    }
-
-   inline void SetGroup(const uint16_t &val) { tag[0] = val; }
-   inline const uint16_t &GetGroup(void) { return tag[0]; }
-
-   inline void SetElement(const uint16_t &val) { tag[1] = val; }
-   inline const uint16_t &GetElement(void) { return tag[1]; }
-
-   inline TagKey &operator=(const TagKey &_val)
+   ///\brief sets the Group Number for the TagKey
+   void SetGroup(uint16_t group) { tag[0] = group; }
+   uint16_t GetGroup() const { return tag[0]; }
+
+   ///\brief sets the Element Number for the TagKey
+   void SetElement(uint16_t elem) { tag[1] = elem; }   
+   uint16_t GetElement() const { return tag[1]; }
+
+   ///\brief sets the Group Number and Element Number for the TagKey
+   void SetGroupElem(uint16_t group, uint16_t elem) 
+                               { tag[0] = group;tag[1] = elem; }
+   
+   TagKey &operator=(const TagKey &_val)
    {
       tag[0] = _val.tag[0];
       tag[1] = _val.tag[1];
       return *this;
    }
 
-   inline const uint16_t &operator[](const unsigned int &_id) const
+   TagKey(const TagKey &_val)
+   {
+     tag[0] = _val[0];
+     tag[1] = _val[1];
+   }
+
+   const uint16_t &operator[](const unsigned int &_id) const
    {
       assert(_id<2);
       return tag[_id];
    }
-   inline const uint16_t &operator[](const unsigned int &_id)
+   const uint16_t &operator[](const unsigned int &_id)
    {
       assert(_id<2);
       return tag[_id];
    }
 
-   inline bool operator==(const TagKey &_val) const
+   bool operator==(const TagKey &_val) const
    {
       return tag[0] == _val.tag[0] && tag[1] == _val.tag[1];
    }
 
-   inline bool operator!=(const TagKey &_val) const
+   bool operator!=(const TagKey &_val) const
    {
       return tag[0] != _val.tag[0] || tag[1] != _val.tag[1];
    }
 
-   inline bool operator<(const TagKey &_val) const
+   bool operator<(const TagKey &_val) const
    {
-      return tag[0] < _val.tag[0] || (tag[0] == _val.tag[0] && tag[1] < _val.tag[1]);
+      return tag[0] < _val.tag[0] 
+        || (tag[0] == _val.tag[0] && tag[1] < _val.tag[1]);
    }
 
 private :