}
//-----------------------------------------------------------------------------
-gdcmVR *gdcmGlobal::VR = (gdcmVR *)0;
-gdcmTS *gdcmGlobal::TS = (gdcmTS *)0;
-gdcmDictSet *gdcmGlobal::Dicts = (gdcmDictSet *)0;
+gdcmDictSet *gdcmGlobal::Dicts = (gdcmDictSet *)0;
+gdcmVR *gdcmGlobal::VR = (gdcmVR *)0;
+gdcmTS *gdcmGlobal::TS = (gdcmTS *)0;
+gdcmDicomDirElement *gdcmGlobal::ddElem = (gdcmDicomDirElement *)0;
gdcmGlobal gdcmGlob;
gdcmGlobal::gdcmGlobal(void) {
if (VR || TS || Dicts)
dbg.Verbose(0, "gdcmGlobal::gdcmGlobal : VR or TS or Dicts already allocated");
+ Dicts = new gdcmDictSet();
VR = new gdcmVR();
TS = new gdcmTS();
- Dicts = new gdcmDictSet();
+ ddElem = new gdcmDicomDirElement();
}
gdcmGlobal::~gdcmGlobal() {
+ delete Dicts;
delete VR;
delete TS;
- delete Dicts;
+ delete ddElem;
}
gdcmVR *gdcmGlobal::GetVR(void) {
return Dicts;
}
+gdcmDicomDirElement *gdcmGlobal::GetDicomDirElements(void) {
+ return ddElem;
+}
+
//-----------------------------------------------------------------------------
// Because is not yet available in g++2.96
std::istream& eatwhite(std::istream& is) {
int i, l;
l = strlen(v);
for (i=0,d=v;
- i<l ;
- i++,d++) {
- if (!isprint(*d))
+ i<l ;
+ i++,d++) {
+ if (!isprint(*d))
*d = '.';
- }
+ }
return v;
}
///////////////////////////////////////////////////////////////////////////
// to prevent a flashing screen when non-printable character
std::string _CreateCleanString(std::string s) {
- std::string str=s;
- int n = str.size();
- for(int i=0;i<n-1;i++)
- {
- if(!isprint(str[i]))
- str[i]='.';
- }
- if(!isprint(str[n])) { // to avoid trouble with odd length fields
- // padded with zeo to become even
-
- if (str[n] == '\0')
- str[n] = ' ';
- else
- str[n] = '.';
- }
- return(str);
-}
+ std::string str=s;
+
+ for(int i=0;i<str.size();i++)
+ {
+ if(!isprint(str[i]))
+ str[i]='.';
+ }
+
+ if(str.size()>0)
+ if(!isprint(s[str.size()-1]))
+ if(s[str.size()-1]==0)
+ str[str.size()-1]=' ';
+
+ return(str);
+}