X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmVRKey.h;h=a740d8c6b442212b8bc7e8e05e5c47e25aab6b10;hb=35ee8ee8af32946514713d271177df8bb2298eb2;hp=31221e29ef9976b96345471f84a203447dc0170c;hpb=8fd45dc6d321d1419854dc0e4fa6a37d6826b655;p=gdcm.git diff --git a/src/gdcmVRKey.h b/src/gdcmVRKey.h index 31221e29..a740d8c6 100644 --- a/src/gdcmVRKey.h +++ b/src/gdcmVRKey.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmVRKey.h,v $ Language: C++ - Date: $Date: 2007/05/23 14:18:12 $ - Version: $Revision: 1.7 $ + Date: $Date: 2010/09/01 15:42:28 $ + 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 @@ -16,14 +16,16 @@ =========================================================================*/ -#ifndef GDCMVRKEY_H -#define GDCMVRKEY_H +#ifndef _GDCMVRKEY_H_ +#define _GDCMVRKEY_H_ #include "gdcmCommon.h" #include #include // important +#include // important #include +#include // for sprintf namespace GDCM_NAME_SPACE { @@ -107,6 +109,23 @@ public : return key[0] < _val[0] || (key[0] == _val[0] && key[1] < _val[1]); } + inline std::string GetHexaRepresentation() + { + // We could probabelly write something much more complicated using C++ features ! + // (I really want HexaRepresentation as xx|xx, not ffffffxx|ffffffxx !) + char vr_char[6]; + char buf[5]; + sprintf(buf, "%04x",( unsigned short int)key[0]); + vr_char[0] = buf[2]; + vr_char[1] = buf[3]; + sprintf(buf, "%04x",( unsigned short int)key[1]); + vr_char[2] = '|'; + vr_char[3] = buf[2]; + vr_char[4] = buf[3]; + vr_char[5] = '\0'; + return(vr_char); + } + private : char key[2]; };