]> Creatis software - gdcm.git/blobdiff - src/gdcmElValSet.cxx
*FIX: Use carnaught table to reduce boolean expr !
[gdcm.git] / src / gdcmElValSet.cxx
index 7678bddb876a46615fd30a7ae0de1cbc6f61f074..634237d2da097a174b036a7afeb4431165ba2c99 100644 (file)
@@ -3,7 +3,13 @@
 #include "gdcmUtil.h"
 #include "gdcmElValSet.h"
 #include "gdcmTS.h"
-#include <sstream>
+#ifdef GDCM_NO_ANSI_STRING_STREAM
+#  include <strstream>
+#  define  ostringstream ostrstream
+# else
+#  include <sstream>
+#endif
+
 
 gdcmElValSet::~gdcmElValSet() {
    for (TagElValueHT::iterator tag = tagHt.begin(); tag != tagHt.end(); ++tag) {
@@ -18,15 +24,6 @@ gdcmElValSet::~gdcmElValSet() {
    NameHt.clear();
 }
 
-TagElValueHT & gdcmElValSet::GetTagHt(void) {
-       return tagHt;
-}
-
-
-ListTag & gdcmElValSet::GetListElem(void) {
-       return listElem;
-}
-
 /**
  * \ingroup gdcmElValSet
  * \brief   
@@ -63,12 +60,12 @@ int gdcmElValSet::CheckIfExistByNumber(guint16 Group, guint16 Elem ) {
 void gdcmElValSet::Print(std::ostream & os) {
 
    size_t o;
-   short int g, e;
+   unsigned short int g, e;
    TSKey v;
    std::string d2;
    gdcmTS * ts = gdcmGlobal::GetTS();
    
-   std::cout << "------------- using tagHt ----------------------------" << std::endl;
+   std::cout << "------------- using tagHt ---------------------" << std::endl;
    
    for (TagElValueHT::iterator tag = tagHt.begin();
           tag != tagHt.end();
@@ -100,24 +97,26 @@ void gdcmElValSet::Print(std::ostream & os) {
       os << std::endl;
    }
    
-   std::cout << "------------ using listElem -----------------" << std::endl;
-   
-   //for (ListTag::iterator i = listElem.begin();
-   
-  char tag[9];
+   std::cout << "------------ using listElem -------------------" << std::endl;
+      
+  guint32 lgth;
+  char greltag[10];  //group element tag
    
-  for (std::list<gdcmElValue*>::iterator i = listElem.begin();  
+  for (ListTag::iterator i = listElem.begin();  
           i != listElem.end();
           ++i){
-      sprintf(tag,"%04x|%04x",(*i)->GetGroup(),(*i)->GetElement());
       g = (*i)->GetGroup();
       e = (*i)->GetElement();
       v = (*i)->GetValue();
       o = (*i)->GetOffset();
+      sprintf(greltag,"%04x|%04x",g,e);           
       d2 = _CreateCleanString(v);  // replace non printable characters by '.'
-      //os << std::hex <<g << "|" << e << std::dec << ": ";
-      os << tag << " : ";
-      os << " lgr : " << (*i)->GetReadLength();
+      os << greltag << ": lgth : ";
+      lgth = (*i)->GetReadLength();
+      if ( lgth == 0xffffffff) 
+         os << std::hex << lgth << std::dec ;
+      else
+         os << lgth;
       os << ", Offset : " << o;
       os << " x(" << std::hex << o << std::dec << ") ";
       os << "\t[" << (*i)->GetVR()    << "]";