Program: gdcm
Module: $RCSfile: gdcmDict.cxx,v $
Language: C++
- Date: $Date: 2006/04/11 16:03:26 $
- Version: $Revision: 1.84 $
+ Date: $Date: 2007/05/23 14:18:09 $
+ Version: $Revision: 1.87 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <iostream>
#include <iomanip>
-namespace gdcm
+namespace GDCM_NAME_SPACE
{
//-----------------------------------------------------------------------------
/// \brief auto generated function, to fill up the Dicom Dictionnary,
FillDefaultDataDict( this );
}
else
- {
+ {
gdcmDebugMacro( "in Dict::Dict, DoTheLoadingJob filename =["
<< filename << "]" );
DoTheLoadingJob(from);
*/
bool Dict::AddDict(std::string const &filename)
{
-
std::ifstream from( filename.c_str() );
if ( !from )
{
}
}
-
/**
* \brief Removes from the current Dicom Dict all the entries held in a source dictionary
* \note it concerns only Private Dictionnary
TagName vm;
TagName name;
- while (!from.eof() && from)
+ while ( true )
{
from >> std::hex;
from >> group;
+
+ if (from.eof())
+ break;
+
from >> elem;
from >> vr;
from >> vm;
}
}
-/**
- * \brief replaces an already existing Dicom Element by a new one
- * @param newEntry new entry (overwrites any previous one with same tag)
- * @return false if Dicom Element doesn't exist
+/*
+ * \ brief replaces an already existing Dicom Element by a new one
+ * @ param newEntry new entry (overwrites any previous one with same tag)
+ * @ return false if Dicom Element doesn't exist
*/
/* seems to be useless
return false;
}
*/
+
/**
* \brief removes an already existing Dicom Dictionary Entry,
* identified by its Tag
return it->second;
}
/**
- * \brief Get the dictionary entry identified by it's "group" and "element")
+ * \brief Get the dictionary entry identified by its "group" and "element")
* @param group Group number of the searched entry.
* @param elem Element number of the searched entry.
* @return the corresponding dictionary entry when existing, NULL otherwise
*/
void Dict::DoTheLoadingJob(std::ifstream &from)
{
+ if (!from)
+ return;
+
uint16_t group;
uint16_t elem;
VRKey vr;
TagName name;
DictEntry *newEntry;
- while (!from.eof() && from)
+ while ( true )
{
from >> std::hex;
- from >> group;
+ from >> group;
from >> elem;
from >> vr;
from >> vm;
from >> std::ws; //remove white space
std::getline(from, name);
-
+
+ if(from.eof()) {
+ break;
+ }
+
newEntry = DictEntry::New(group, elem, vr, vm, name);
AddEntry(newEntry);
newEntry->Delete();