]> Creatis software - gdcm.git/blobdiff - src/gdcmVRKey.h
UserDefinedFileIdentifier is now more human readable
[gdcm.git] / src / gdcmVRKey.h
index 71449375ae89de57e64d18ab80cb73c63d4c888e..2ef89e2aee6aae351d97048ef824fb22d78cc983 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmVRKey.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 12:58:29 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2007/08/22 16:14:05 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
                                                                                 
 =========================================================================*/
 
-#ifndef GDCMVRKEY_H
-#define GDCMVRKEY_H
+#ifndef _GDCMVRKEY_H_
+#define _GDCMVRKEY_H_
 
 #include "gdcmCommon.h"
-#include "gdcmDebug.h"
 
 #include <assert.h>
+#include <iomanip> // important
+#include <string>
 
-namespace gdcm 
+namespace GDCM_NAME_SPACE 
 {
 //-----------------------------------------------------------------------------
 class VRKey
@@ -36,8 +37,8 @@ public :
 
    inline std::string str() const { return std::string(key,2); }
 
-   friend std::ostream& operator<<(std::ostream& _os, const VRKey &_val);
-   friend std::istream& operator>>(std::istream& _is, VRKey &_val);
+   friend std::ostream &operator<<(std::ostream &_os, const VRKey &_val);
+   friend std::istream &operator>>(std::istream &_is, VRKey &_val);
 
    inline VRKey &operator=(const VRKey &_val)
    {
@@ -45,12 +46,14 @@ public :
       key[1] = _val.key[1];
       return *this;
    }
+   
    inline VRKey &operator=(const std::string &_val)
    {
       key[0] = _val[0];
       key[1] = _val[1];
       return *this;
    }
+   
    inline VRKey &operator=(const char *_val)
    {
       key[0] = _val[0];
@@ -63,6 +66,7 @@ public :
       assert(_id<2);
       return key[_id];
    }
+   
    inline char &operator[](const unsigned int &_id)
    {
       assert(_id<2);
@@ -73,10 +77,12 @@ public :
    {
       return key[0] == _val.key[0] && key[1] == _val.key[1];
    }
+   
    inline bool operator==(const std::string &_val) const
    {
       return key[0] == _val[0] && key[1] == _val[1];
    }
+   
    inline bool operator==(const char *_val) const
    {
       return key[0] == _val[0] && key[1] == _val[1];
@@ -86,6 +92,7 @@ public :
    {
       return key[0] != _val.key[0] || key[1] != _val.key[1];
    }
+   
    inline bool operator!=(const std::string &_val) const
    {
       return key[0] != _val[0] || key[1] != _val[1];
@@ -105,15 +112,15 @@ private :
 };
 
 //-----------------------------------------------------------------------------
-inline std::ostream& operator<<(std::ostream& _os, const VRKey &_val)
+inline std::ostream &operator<<(std::ostream &_os, const VRKey &_val)
 {
-   _os << _val.key[0] << _val[1];
+   _os << _val.key[0] << _val.key[1];
    return _os;
 }
 
-inline std::istream& operator>>(std::istream& _is, VRKey &_val)
+inline std::istream &operator>>(std::istream &_is, VRKey &_val)
 {
-   _is >> _val.key[0] >> _val[1];
+   _is >> _val.key[0] >> _val.key[1];
    return _is;
 }