Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2006/07/10 09:37:33 $
- Version: $Revision: 1.185 $
+ Date: $Date: 2007/10/17 08:57:55 $
+ Version: $Revision: 1.189 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <thread.h>
#endif
-namespace gdcm
+namespace GDCM_NAME_SPACE
{
//-------------------------------------------------------------------------
const std::string Util::GDCM_UID = "1.2.826.0.1.3680043.2.1143";
* value 0x0001 encoded as a little endian 16 bit short value,
* which would be the other way around...
*/
-const uint16_t Util::FMIV = 0x0100;
-uint8_t *Util::FileMetaInformationVersion = (uint8_t *)&FMIV;
-std::string Util::GDCM_MAC_ADRESS = GetMACAddress();
+
+#if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)
+ const uint16_t Util::FMIV = 0x0001;
+#else
+ const uint16_t Util::FMIV = 0x0100;
+#endif
+ uint8_t *Util::FileMetaInformationVersion = (uint8_t *)&FMIV;
+
+ std::string Util::GDCM_MAC_ADRESS = GetMACAddress();
//-------------------------------------------------------------------------
// Public
str[i] = '.';
}
}
-
if (str.size() > 0 )
{
if (!isprint((unsigned char)s[str.size()-1]) )
}
}
}
-
return str;
}
+/**
+ * \brief Replaces all special characters
+ * @param s string to modify
+ * @param rep replacement char
+ */
+void Util::ReplaceSpecChar(std::string &s, std::string &rep)
+{
+ unsigned int s_size = s.size();
+ for(unsigned int i=0; i<s_size; i++)
+ {
+ if (! ( s[i] == '.' || s[i] == '%' || s[i] == '_'
+ || (s[i] >= '+' && s[i] <= '-')
+ || (s[i] >= 'a' && s[i] <= 'z')
+ || (s[i] >= '0' && s[i] <= '9')
+ || (s[i] >= 'A' && s[i] <= 'Z')))
+ {
+ s.replace(i, 1, rep);
+ }
+ }
+ // deal with Dicom strings trailing '\0'
+ if(s[s_size-1] == rep.c_str()[0])
+ s.erase(s_size-1, 1);
+}
+
/**
* \brief Weed out a string from the non-printable characters (in order
// Not implemented platforms (or no Ethernet cable !)
/// \todo FIXME I wish we don't pollute command line applications when no Ethernet cable !
- //perror("in Get MAC Adress (internal) : There was a configuration problem (or no Ethernet cable !) on your plateform");
+ //perror("Probabely your computer is not connected on a network, therefore its MAC adress cannot be found (or there is a configuration problem on your platform)");
// But the following -> error: invalid use of 'this' in non-member function
- //gdcmWarningMacro( "in Get MAC Adress (internal) : There was a configuration problem (or no Ethernet cable !) on your plateform");
+ //gdcmWarningMacro( "Probabely your computer is not connected on a network, therefore its MAC adress cannot be found (or there is a configuration problem on your platform)");
memset(addr,0,6);
return -1;
ghost@aladdin.com
*/
-/* $Id: gdcmUtil.cxx,v 1.185 2006/07/10 09:37:33 jpr Exp $ */
+/* $Id: gdcmUtil.cxx,v 1.189 2007/10/17 08:57:55 jpr Exp $ */
/*
Independent implementation of MD5 (RFC 1321).