Index: trunk/SophyaLib/HiStats/basedtable.cc
===================================================================
--- trunk/SophyaLib/HiStats/basedtable.cc	(revision 2693)
+++ trunk/SophyaLib/HiStats/basedtable.cc	(revision 2699)
@@ -117,7 +117,9 @@
 sa_size_t BaseDataTable::IndexNom(char const* nom) const 
 {
-  for(sa_size_t k=0; k<NVar(); k++)
-    if ( mNames[k].nom == nom )  return k;
-  throw NotFoundExc("BaseDataTable::IndexNom() : column name not found ");
+  for(sa_size_t k=0; k<NVar(); k++) 
+    if ( mNames[k].nom == nom )      return k;
+  return -1;
+  // Reza:Avril 2005 : PINtuple se base sur le renvoi de -1 et pas d'une exception
+  //  throw NotFoundExc("BaseDataTable::IndexNom() : column name not found ");
 }
 
@@ -202,13 +204,13 @@
   sa_size_t off = n%mSegSz;
   for(sa_size_t k=0; k<mIColsP.size(); k++) 
-    mVarMTV[mIColIdx[k]] = mIColsP[k]->GetSegment(bid)[off];
+    mVarMTV[mIColIdx[k]] = mIColsP[k]->GetCstSegment(bid)[off];
   for(sa_size_t k=0; k<mLColsP.size(); k++) 
-    mVarMTV[mLColIdx[k]] = mLColsP[k]->GetSegment(bid)[off];
+    mVarMTV[mLColIdx[k]] = mLColsP[k]->GetCstSegment(bid)[off];
   for(sa_size_t k=0; k<mFColsP.size(); k++) 
-    mVarMTV[mFColIdx[k]] = mFColsP[k]->GetSegment(bid)[off];
+    mVarMTV[mFColIdx[k]] = mFColsP[k]->GetCstSegment(bid)[off];
   for(sa_size_t k=0; k<mDColsP.size(); k++) 
-    mVarMTV[mDColIdx[k]] = mDColsP[k]->GetSegment(bid)[off];
+    mVarMTV[mDColIdx[k]] = mDColsP[k]->GetCstSegment(bid)[off];
   for(sa_size_t k=0; k<mSColsP.size(); k++) 
-    mVarMTV[mSColIdx[k]] = atof(mSColsP[k]->GetSegment(bid)[off].c_str());
+    mVarMTV[mSColIdx[k]] = atof(mSColsP[k]->GetCstSegment(bid)[off].c_str());
 
   return mVarMTV;
@@ -307,13 +309,13 @@
   sa_size_t off = n%mSegSz;
   for(sa_size_t k=0; k<mIColsP.size(); k++) 
-    mVarD[mIColIdx[k]] = mIColsP[k]->GetSegment(bid)[off];
+    mVarD[mIColIdx[k]] = mIColsP[k]->GetCstSegment(bid)[off];
   for(sa_size_t k=0; k<mLColsP.size(); k++) 
-    mVarD[mLColIdx[k]] = mLColsP[k]->GetSegment(bid)[off];
+    mVarD[mLColIdx[k]] = mLColsP[k]->GetCstSegment(bid)[off];
   for(sa_size_t k=0; k<mFColsP.size(); k++) 
-    mVarD[mFColIdx[k]] = mFColsP[k]->GetSegment(bid)[off];
+    mVarD[mFColIdx[k]] = mFColsP[k]->GetCstSegment(bid)[off];
   for(sa_size_t k=0; k<mDColsP.size(); k++) 
-    mVarD[mDColIdx[k]] = mDColsP[k]->GetSegment(bid)[off];
+    mVarD[mDColIdx[k]] = mDColsP[k]->GetCstSegment(bid)[off];
   for(sa_size_t k=0; k<mSColsP.size(); k++) 
-    mVarD[mSColIdx[k]] = atof(mSColsP[k]->GetSegment(bid)[off].c_str());
+    mVarD[mSColIdx[k]] = atof(mSColsP[k]->GetCstSegment(bid)[off].c_str());
 
   return mVarD;
@@ -326,5 +328,5 @@
   if ((n < 0) || (n >= NEntry())) 
     throw RangeCheckError("BaseDataTable::GetCell() out of range line index n");
-  if ((k < 0) || (n >= NVar())) 
+  if ((k < 0) || (k >= NVar())) 
     throw RangeCheckError("BaseDataTable::GetCell() out of range column index k");
   double rv = BADVAL;
@@ -332,19 +334,20 @@
   sa_size_t bid = n/mSegSz;
   sa_size_t off = n%mSegSz;
+
   switch (mNames[k].type) {
   case IntegerField :
-    rv = mIColsP[sk]->GetSegment(bid)[off];
+    rv = mIColsP[sk]->GetCstSegment(bid)[off];
     break;
   case LongField :
-    rv = mLColsP[sk]->GetSegment(bid)[off];
+    rv = mLColsP[sk]->GetCstSegment(bid)[off];
     break;
   case FloatField :
-    rv = mFColsP[sk]->GetSegment(bid)[off];
+    rv = mFColsP[sk]->GetCstSegment(bid)[off];
     break;
   case DoubleField :
-    rv = mDColsP[sk]->GetSegment(bid)[off];
+    rv = mDColsP[sk]->GetCstSegment(bid)[off];
     break;
   case StringField :
-    rv = atof(mSColsP[sk]->GetSegment(bid)[off].c_str());
+    rv = atof(mSColsP[sk]->GetCstSegment(bid)[off].c_str());
     break;
   default:
@@ -365,5 +368,5 @@
   if ((n < 0) || (n >= NEntry())) 
     throw RangeCheckError("BaseDataTable::GetCell() out of range line index n");
-  if ((k < 0) || (n >= NVar())) 
+  if ((k < 0) || (k >= NVar())) 
     throw RangeCheckError("BaseDataTable::GetCell() out of range column index k");
   MuTyV rv;;
@@ -373,17 +376,17 @@
   switch (mNames[k].type) {
   case IntegerField :
-    rv = mIColsP[sk]->GetSegment(bid)[off];
+    rv = mIColsP[sk]->GetCstSegment(bid)[off];
     break;
   case LongField :
-    rv = mLColsP[sk]->GetSegment(bid)[off];
+    rv = mLColsP[sk]->GetCstSegment(bid)[off];
     break;
   case FloatField :
-    rv = mFColsP[sk]->GetSegment(bid)[off];
+    rv = mFColsP[sk]->GetCstSegment(bid)[off];
     break;
   case DoubleField :
-    rv = mDColsP[sk]->GetSegment(bid)[off];
+    rv = mDColsP[sk]->GetCstSegment(bid)[off];
     break;
   case StringField :
-    rv = atof(mSColsP[sk]->GetSegment(bid)[off].c_str());
+    rv = mSColsP[sk]->GetCstSegment(bid)[off];
     break;
   default:
@@ -420,5 +423,5 @@
   case IntegerField :
     for(size_t is=0; is<mIColsP[sk]->NbSegments(); is++) {
-      int_4* sp = mIColsP[sk]->GetSegment(is);
+      const int_4* sp = mIColsP[sk]->GetCstSegment(is);
       for(size_t n=0; n<mIColsP[sk]->SegmentSize(); n++) {
 	if (cnt >= NEntry())  break;
@@ -432,5 +435,5 @@
   case LongField :
     for(size_t is=0; is<mLColsP[sk]->NbSegments(); is++) {
-      int_8* sp = mLColsP[sk]->GetSegment(is);
+      const int_8* sp = mLColsP[sk]->GetCstSegment(is);
       for(size_t n=0; n<mLColsP[sk]->SegmentSize(); n++) {
 	if (cnt >= NEntry())  break;
@@ -443,5 +446,5 @@
   case FloatField :
     for(size_t is=0; is<mFColsP[sk]->NbSegments(); is++) {
-      r_4* sp = mFColsP[sk]->GetSegment(is);
+      const r_4* sp = mFColsP[sk]->GetCstSegment(is);
       for(size_t n=0; n<mFColsP[sk]->SegmentSize(); n++) {
 	if (cnt >= NEntry())  break;
@@ -454,5 +457,5 @@
   case DoubleField :
     for(size_t is=0; is<mDColsP[sk]->NbSegments(); is++) {
-      r_8* sp = mDColsP[sk]->GetSegment(is);
+      const r_8* sp = mDColsP[sk]->GetCstSegment(is);
       for(size_t n=0; n<mDColsP[sk]->SegmentSize(); n++) {
 	if (cnt >= NEntry())  break;
@@ -524,11 +527,13 @@
 string BaseDataTable::LineHeaderToString() const 
 {
-  char buff[32];
-  string rets=" Num    ";
+  string rets,s;
+  
   for(int i=0; i<NVar(); i++) {
-    sprintf(buff, "%8s ", NomIndex(i).c_str() );
-    rets += buff;
-  }
-  rets += '\n';
+    s = mNames[i].nom;
+    s += ' ';
+    size_t l = s.length();
+    for(size_t ii=l; ii<10; ii++) s += ' ';
+    rets += s;
+  }
   return(rets);  
 }
@@ -547,17 +552,17 @@
     switch (mNames[k].type) {
     case IntegerField :
-      rv = mIColsP[sk]->GetSegment(bid)[off];
+      rv = mIColsP[sk]->GetCstSegment(bid)[off];
       break;
     case LongField :
-      rv = mLColsP[sk]->GetSegment(bid)[off];
+      rv = mLColsP[sk]->GetCstSegment(bid)[off];
       break;
     case FloatField :
-      rv = mFColsP[sk]->GetSegment(bid)[off];
+      rv = mFColsP[sk]->GetCstSegment(bid)[off];
       break;
     case DoubleField :
-      rv = mDColsP[sk]->GetSegment(bid)[off];
+      rv = mDColsP[sk]->GetCstSegment(bid)[off];
       break;
     case StringField :
-      rv = atof(mSColsP[sk]->GetSegment(bid)[off].c_str());
+      rv = mSColsP[sk]->GetCstSegment(bid)[off];
     break;
     default:
@@ -565,6 +570,9 @@
       break;
     }
-    rs += " ";
-    rs += (string)rv;
+    string s = (string)rv;
+    s += ' ';
+    size_t l = s.length();
+    for(size_t ii=l; ii<10; ii++) s += ' ';
+    rs += s;
   }
   return rs;
