From: frog Date: Wed, 12 Mar 2003 23:38:58 +0000 (+0000) Subject: * gdcmPython/__init__.py fix of GDCM_DICT_PATH which was not X-Git-Tag: April2003~21 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c912efe3318a297cfa8ce267ab57cfee973c8125;p=gdcm.git * gdcmPython/__init__.py fix of GDCM_DICT_PATH which was not to exported to the environement (see gdcmPython/testSuite.py for usage). * src/gdcmElValSet.cxx, src/gdcmUtil.[cxx-h] Tokenize utility function moved away from gdcmElValSet.cxx to gdcmUtil.cxx. --- diff --git a/gdcmPython/__init__.py b/gdcmPython/__init__.py index 34ce06f7..d15ab74d 100644 --- a/gdcmPython/__init__.py +++ b/gdcmPython/__init__.py @@ -43,11 +43,11 @@ except KeyError: # installation scheme and the pre-install mode (see above). InstallModePath = os.path.join(__path__[0], "Data") if os.path.isfile(os.path.join(InstallModePath, "test.acr")): - os.environ["GDCM_DATA_PATH"] = InstallModePath + GDCM_DATA_PATH = InstallModePath else: PreInstallModePath = os.path.join(__path__[0], "..", "Data") if os.path.isfile(os.path.join(PreInstallModePath, "test.acr")): - os.environ["GDCM_DATA_PATH"] = PreInstallModePath + GDCM_DATA_PATH = PreInstallModePath else: print "Unfound data path" sys.exit(1) diff --git a/src/gdcmElValSet.cxx b/src/gdcmElValSet.cxx index 6c140ae1..b71d2784 100644 --- a/src/gdcmElValSet.cxx +++ b/src/gdcmElValSet.cxx @@ -1,13 +1,8 @@ -// $Header: /cvs/public/gdcm/src/Attic/gdcmElValSet.cxx,v 1.17 2003/03/12 21:33:20 frog Exp $ +// $Id: gdcmElValSet.cxx,v 1.18 2003/03/12 23:38:58 frog Exp $ #include "gdcmUtil.h" #include "gdcmElValSet.h" - -#include -static void Tokenize (const string& str, vector& tokens, const string& delimiters = " "); - - TagElValueHT & gdcmElValSet::GetTagHt(void) { return tagHt; } @@ -457,19 +452,3 @@ int gdcmElValSet::WriteAcr(FILE * _fp) { return(1); } - - - - -// mettre ça dans une bibliothèque d'utilitaires ? -// ca peut servir - -static void Tokenize (const string& str, vector& tokens, const string& delimiters = " ") { - string::size_type lastPos = str.find_first_not_of(delimiters,0); - string::size_type pos = str.find_first_of(delimiters,lastPos); - while (string::npos != pos || string::npos != lastPos) { - tokens.push_back(str.substr(lastPos, pos - lastPos)); - lastPos = str.find_first_not_of(delimiters, pos); - pos = str.find_first_of(delimiters, lastPos); - } -} diff --git a/src/gdcmUtil.cxx b/src/gdcmUtil.cxx index 840d6f24..ea90d950 100644 --- a/src/gdcmUtil.cxx +++ b/src/gdcmUtil.cxx @@ -45,7 +45,7 @@ void gdcmDebug::Exit(int a) { gdcmDebug dbg; -// Because is not yet available in g++2.06 +// Because is not yet available in g++2.96 istream& eatwhite(istream& is) { char c; while (is.get(c)) { @@ -57,3 +57,14 @@ istream& eatwhite(istream& is) { return is; } +void Tokenize (const string& str, + vector& tokens, + const string& delimiters = " ") { + string::size_type lastPos = str.find_first_not_of(delimiters,0); + string::size_type pos = str.find_first_of(delimiters,lastPos); + while (string::npos != pos || string::npos != lastPos) { + tokens.push_back(str.substr(lastPos, pos - lastPos)); + lastPos = str.find_first_not_of(delimiters, pos); + pos = str.find_first_of(delimiters, lastPos); + } +} diff --git a/src/gdcmUtil.h b/src/gdcmUtil.h index 32f68172..3432bf93 100644 --- a/src/gdcmUtil.h +++ b/src/gdcmUtil.h @@ -1,6 +1,8 @@ // gdcmUtil.h #include +#include +#include using namespace std; class gdcmDebug { @@ -17,4 +19,8 @@ public: istream & eatwhite(istream & is); +void Tokenize (const string& str, + vector& tokens, + const string& delimiters = " "); + extern gdcmDebug dbg;