Index: /trunk/ArchTOIPipe/Kernel/toiprocessor.cc
===================================================================
--- /trunk/ArchTOIPipe/Kernel/toiprocessor.cc	(revision 1742)
+++ /trunk/ArchTOIPipe/Kernel/toiprocessor.cc	(revision 1743)
@@ -3,5 +3,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toiprocessor.cc,v 1.15 2001-11-09 23:13:15 aubourg Exp $
+// $Id: toiprocessor.cc,v 1.16 2001-11-09 23:14:28 aubourg Exp $
 
 #include "toiprocessor.h"
@@ -394,5 +394,5 @@
 
 void TOIProcessor::putData(int toiIndex, int i, int n, double const* val,
-			   uint_8 const* flg=0) {
+			   uint_8 const* flg) {
   TOI* toi = getOutputTOI(toiIndex);
   toi->putData(i, n, val, flg);
Index: /trunk/ArchTOIPipe/Kernel/toiprocessor.h
===================================================================
--- /trunk/ArchTOIPipe/Kernel/toiprocessor.h	(revision 1742)
+++ /trunk/ArchTOIPipe/Kernel/toiprocessor.h	(revision 1743)
@@ -5,5 +5,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toiprocessor.h,v 1.10 2001-11-08 15:47:46 aubourg Exp $
+// $Id: toiprocessor.h,v 1.11 2001-11-09 23:13:15 aubourg Exp $
 
 
@@ -62,4 +62,7 @@
   double        getData(int toiIndex, int i);
   void          getData(int toiIndex, int i, double &data, uint_8 &flag);
+
+  void          getData(int toiIndex, int i, int n, double* d);
+  void          getData(int toiIndex, int i, int n, double* d, uint_8* f);
   
   //RZCMV  double        getError(int toiIndex, int i);
@@ -73,4 +76,7 @@
   //RZCMV  void          putDataError(int toiIndex, int i, double value, 
   //RZCMV		             double error, int_4 flag=0);
+
+  void          putData(int toiIndex, int i, int n, double const* val,
+			uint_8 const* flg=0);
 
   // Gestion des bornes pour les transformations de TOIs...
Index: /trunk/ArchTOIPipe/Kernel/toisegment.cc
===================================================================
--- /trunk/ArchTOIPipe/Kernel/toisegment.cc	(revision 1742)
+++ /trunk/ArchTOIPipe/Kernel/toisegment.cc	(revision 1743)
@@ -3,5 +3,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toisegment.cc,v 1.15 2001-11-08 23:23:58 aubourg Exp $
+// $Id: toisegment.cc,v 1.16 2001-11-09 23:13:15 aubourg Exp $
 
 #include "toisegment.h"
@@ -67,6 +67,14 @@
 }
 
+void TOISegmented::getData(int i, int n, double* data, uint_8* flg) { /* reader thread */
+  master->getData(i, n, data, flg);
+}
+
 void TOISegmented::putData(int i, double value, uint_8 flag) { /* writer thread */
   master->putData(i, value, flag);
+}
+
+void TOISegmented::putData(int i, int n, double const* val, uint_8 const* flg) { /* writer thread */
+  master->putData(i, n, val, flg);
 }
 
@@ -152,4 +160,14 @@
   delete[] flags;
   pthread_mutex_destroy(&refcount_mutex);
+}
+
+void TOISegmented::BufferSegment::getData(int sn, int n, double* d, uint_8* f) {
+  checkCommitted();
+  checkInRange(sn);
+  checkInRange(sn+n-1);
+  memcpy(d, data+(sn-sn0), n*sizeof(double));
+  if (f != NULL) {
+    memcpy(f, flags+(sn-sn0), n*sizeof(uint_8));
+  }
 }
 
@@ -166,4 +184,16 @@
   data[sn-sn0] = d;
   flags[sn-sn0] = f;
+}
+
+void TOISegmented::BufferSegment::putData(int sn, int n, double const* d, uint_8 const* f) {
+  checkCommitted();
+  checkInRange(sn);
+  checkInRange(sn+n-1);
+  memcpy(data+(sn-sn0), d, n*sizeof(double));
+  if (f != NULL) {
+    memcpy(flags+(sn-sn0), f, n*sizeof(uint_8));
+  } else {
+    memset(flags+(sn-sn0), 0, n*sizeof(uint_8));
+  }
 }
 
@@ -215,4 +245,28 @@
   int seg = (sn-sn0)/segmentSize;
   return segments[seg]->getFlag(sn);
+}
+
+void TOISegmented::BufferView::getData(int sn, int n, double* dat, uint_8* flg) { /* Single-thread, reader thread */
+  ensure(sn);
+  ensure(sn+n-1);
+  
+  int  sn1  = sn;
+  int  nsam = n;
+  double* pdat = dat;
+  uint_8* pflg = flg;
+
+  while (true) {
+    int seg = (sn1-sn0)/segmentSize;
+    BufferSegment* s = segments[seg];
+    int snmax = s->sn0 + s->bufferSize - 1;
+    int sn2 = snmax > (sn1+nsam-1) ? (sn1+nsam-1) : snmax;
+    int nget = sn2-sn1+1;
+    s->getData(sn1, nget, pdat, pflg);
+    pdat += nget;
+    if (pflg != NULL) pflg += nget;
+    nsam -= nget;
+    sn1  += nget;
+    if (nsam <= 0) break;
+  }
 }
 
@@ -324,4 +378,34 @@
 }
 
+void TOISegmented::MasterView::putData(int sn, int n, double const* data, uint_8 const* flags) { /* writer thread */
+  if (sn0<0) {
+    LOG(cout << "***MasterView::putData sn0<0" << endl);
+    sn0=sn;
+  }
+  double const*  pdat = data;
+  uint_8 const*  pflg = flags;
+  int     nsam  = n;
+  int     sn1   = sn;
+  while (true) {
+    // maximum that current segment can take
+    int snmax = -1;
+    if (currentSegment != NULL) {
+      snmax = currentSegment->sn0 + currentSegment->bufferSize-1;
+    }
+    int sn2 = snmax > (sn1+nsam-1) ? (sn1+nsam-1) : snmax;
+    if (snmax>0) {
+      int nput = sn2-sn1+1;
+      currentSegment->putData(sn1, nput, pdat, pflg);
+      pdat += nput;
+      if (pflg != NULL) pflg += nput;
+      nsam -= nput;
+      sn1  += nput;
+    }
+    if (nsam <= 0) break;
+    nextSegment();
+    currentSegment->putData(sn1, 0, 0); // dummy, to initialize sn0 in segment : add method ?
+  }
+}
+
 double TOISegmented::MasterView::getData(int sn) { /* reader thread */
   return getView()->getData(sn); /* thread-specific */
@@ -330,4 +414,8 @@
 uint_8 TOISegmented::MasterView::getFlag(int sn) { /* reader thread */
   return getView()->getFlag(sn);
+}
+
+void TOISegmented::MasterView::getData(int sn, int n, double* dat, uint_8* flg) { /* reader thread */
+  getView()->getData(sn, n, dat, flg);
 }
 
Index: /trunk/ArchTOIPipe/Kernel/toisegment.h
===================================================================
--- /trunk/ArchTOIPipe/Kernel/toisegment.h	(revision 1742)
+++ /trunk/ArchTOIPipe/Kernel/toisegment.h	(revision 1743)
@@ -5,5 +5,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toisegment.h,v 1.10 2001-11-08 15:47:46 aubourg Exp $
+// $Id: toisegment.h,v 1.11 2001-11-09 23:13:15 aubourg Exp $
 
 #ifndef TOISEGMENT_H
@@ -32,5 +32,7 @@
   virtual double        getData(int i);
   virtual void          getData(int i, double& data,  uint_8& flag);
+  virtual void          getData(int i, int n, double* data, uint_8* flg=0);
   virtual void          putData(int i, double  value, uint_8  flag=0);
+  virtual void          putData(int i, int n, double const* val, uint_8 const* flg=0);
   virtual void          wontNeedBefore(int i);
   virtual void          putDone();
@@ -72,6 +74,8 @@
     
     void putData(int sn, double data, uint_8 flag);
+    void putData(int sn, int n, double const* data, uint_8 const* flag);
     inline double getData(int sn);
     inline uint_8 getFlag(int sn);
+    void getData(int sn, int n, double* data, uint_8* flag);
 
     bool isPastEnd(int sn) {
@@ -114,4 +118,6 @@
     double getData(int sn);
     uint_8 getFlag(int sn);
+    void   getData(int i, int n, double* data, uint_8* flg);
+    void   putData(int i, int n, double const* val, uint_8 const* flg);
     BufferView* getView(); // thread-specific
     void putDone();
@@ -162,4 +168,5 @@
     double getData(int sn);
     uint_8 getFlag(int sn);    
+    void   getData(int i, int n, double* data, uint_8* flg);
 
     void wontNeedBefore(int sn);
