X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmVR.cxx;h=bd179cf8538ea9334018a94dcf5e243bbe646c48;hb=7350639601914cd8ab02bfb0d6668c5bf56ce2f4;hp=c400af1489e6200db6120feb75d53fe0b650c765;hpb=f4618aed21f60eeca799cf5807b3dca987831591;p=gdcm.git diff --git a/src/gdcmVR.cxx b/src/gdcmVR.cxx index c400af14..bd179cf8 100644 --- a/src/gdcmVR.cxx +++ b/src/gdcmVR.cxx @@ -3,12 +3,12 @@ Program: gdcm Module: $RCSfile: gdcmVR.cxx,v $ Language: C++ - Date: $Date: 2004/09/10 18:54:39 $ - Version: $Revision: 1.16 $ + Date: $Date: 2005/02/01 10:29:56 $ + Version: $Revision: 1.34 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details. + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -16,71 +16,66 @@ =========================================================================*/ -#include - -#include - #include "gdcmVR.h" #include "gdcmUtil.h" #include "gdcmDictSet.h" #include "gdcmDebug.h" +#include +#include + +namespace gdcm +{ +//----------------------------------------------------------------------------- +void FillDefaultVRDict(VRHT &vr); + //----------------------------------------------------------------------------- +// Constructor / Destructor /** * \brief Constructor */ -gdcmVR::gdcmVR(void) +VR::VR() { - std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_VR); + std::string filename = DictSet::BuildDictPath() + DICT_VR; std::ifstream from(filename.c_str()); - dbg.Error(!from, "gdcmVR::gdcmVR: can't open dictionary",filename.c_str()); - - char buff[1024]; - std::string key; - std::string name; - - while (!from.eof()) + if(!from) { - eatwhite(from); - from.getline(buff, 1024, ' '); - key = buff; - eatwhite(from); - from.getline(buff, 1024, ';'); - name = buff; - - eatwhite(from); - from.getline(buff, 1024, '\n'); - - if(key!="") + gdcmVerboseMacro("Can't open dictionary" << filename.c_str()); + FillDefaultVRDict(vr); + } + else + { + char buff[1024]; + VRKey key; + VRAtr name; + + while (!from.eof()) { - vr[key]=name; + from >> std::ws; + from.getline(buff, 1024, ' '); + key = buff; + from >> std::ws; + from.getline(buff, 1024, ';'); + name = buff; + + from >> std::ws; + from.getline(buff, 1024, '\n'); + + if(key != "") + { + vr[key] = name; + } } + from.close(); } - from.close(); } /** * \brief Destructor */ -gdcmVR::~gdcmVR() { - vr.clear(); -} - -//----------------------------------------------------------------------------- -// Print -/** - * \brief Print all - * @param os The output stream to be written to. - */ -void gdcmVR::Print(std::ostream &os) +VR::~VR() { - std::ostringstream s; - - for (gdcmVRHT::iterator it = vr.begin(); it != vr.end(); ++it) - { - s << "VR : "<first<<" = "<second<first << " = " << it->second << std::endl; + } + os << s.str(); +} + +//----------------------------------------------------------------------------- +} // end namespace gdcm