Index: trunk/ArchTOIPipe/Kernel/toiseqbuff.cc
===================================================================
--- trunk/ArchTOIPipe/Kernel/toiseqbuff.cc	(revision 1762)
+++ trunk/ArchTOIPipe/Kernel/toiseqbuff.cc	(revision 1985)
@@ -3,5 +3,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toiseqbuff.cc,v 1.9 2001-11-13 16:22:47 aubourg Exp $
+// $Id: toiseqbuff.cc,v 1.10 2002-05-07 16:38:03 ansari Exp $
 
 #include "toiprocessor.h"
@@ -85,5 +85,5 @@
 }
 
-void TOISeqBuffered::doWontNeedBefore(int i) {
+void TOISeqBuffered::wontNeedBefore(int i) {
   // $CHECK$  Reza 30/4/2001 - Je ne sais pas a quoi ca sert !
   //  next_out = i; $CHECK$  Reza 30/4/2001
@@ -113,7 +113,16 @@
 #endif
 
-void TOISeqBuffered::doGetData(int i, double & val, uint_8 & flg) {
+double TOISeqBuffered::getData(int i)
+{
+  double val; 
+  uint_8 flg;
+  getData(i, val, flg);
+  return(val);
+}
+
+
+void TOISeqBuffered::getData(int i, double & val, uint_8 & flg) {
   if (!started) { 
-    cout << " TOISeqBuffered::doGetData() - waitGet() Waiting for start ... " << endl;
+    cout << " TOISeqBuffered::getData() - waitGet() Waiting for start ... " << endl;
     waitGet(); 
   }
@@ -121,13 +130,13 @@
   if (isDataDeleted(i)) {
     if (dbglev > 0) 
-      cout << " TOISeqBuffered::doGetData() - DataDeleted() name=" << getName()  
-	   << " i=" << i << " next_in= " << next_in 
-	   << " next_out=" << next_out << endl;
-    throw RangeCheckError("TOISeqBuffered::doGetData(i) : data deleted");
+      cout << " TOISeqBuffered::getData() - DataDeleted() name=" << getName()  
+	   << " i=" << i << " next_in= " << next_in 
+	   << " next_out=" << next_out << endl;
+    throw RangeCheckError("TOISeqBuffered::getData(i) : data deleted");
   }
   while (i >= next_in) { 
     if (i>next_out) next_out = i; 
     if (dbglev > 0) 
-      cout << " TOISeqBuffered::doGetData() - waitGet() name=" << getName()  
+      cout << " TOISeqBuffered::getData() - waitGet() name=" << getName()  
 	   << " i=" << i << " next_in= " << next_in 
 	   << " next_out=" << next_out << endl;
@@ -144,10 +153,54 @@
   if (isPutWaiting() && (next_in-next_out < wsize/2 )) { 
     if (dbglev > 0) 
-      cout << " TOISeqBuffered::doGetData() - signalPut() name=" << getName()  
-	   << " i=" << i << " next_in= " << next_in 
-	   << " next_out=" << next_out << endl;
-    signalPut();
+      cout << " TOISeqBuffered::getData() - signalPut() name=" << getName()  
+	   << " i=" << i << " next_in= " << next_in 
+	   << " next_out=" << next_out << endl;
+    signalPut(); signal();
   }
   return;
+}
+
+
+void TOISeqBuffered::getData(int i, int n, double* data, uint_8* flg)
+{
+  if (!started) { 
+    cout << " TOISeqBuffered::getData(i,n ...) - waitGet() Waiting for start ... " << endl;
+    waitGet(); 
+  }
+  cleanWaitGet();
+  if (isDataDeleted(i)) {
+    if (dbglev > 0) 
+      cout << " TOISeqBuffered::getData(i,n ...) - DataDeleted() name=" << getName()  
+	   << " i=" << i << " next_in= " << next_in 
+	   << " next_out=" << next_out << endl;
+    throw RangeCheckError("TOISeqBuffered::getData(i) : data deleted");
+  }
+  for(int j=i; i<i+n; j++) {
+    while (j >= next_in) { 
+      if (j>next_out) next_out = j; 
+      if (dbglev > 0) 
+	cout << " TOISeqBuffered::getData(i,n ...) - waitGet() name=" << getName()  
+	     << " j=" << j << " next_in= " << next_in 
+	     << " next_out=" << next_out << endl;
+      waitGet(); 
+      if (dbglev > 0) 
+	cout << " ... Out of waitGet() j=" << j
+	     << " next_in= " << next_in << " next_out=" << next_out << endl;
+    }
+    cleanWaitGet();
+    data[j-i] = dataRef(j);
+    if (flg) flg[j-i] = flagRef(j);
+    if (first_out < 0)  first_out = j;
+    if ((j+1) > next_out)  next_out = j+1;
+    if (isPutWaiting() && (next_in-next_out < wsize/2 )) { 
+      if (dbglev > 0) 
+	cout << " TOISeqBuffered::getData(i,n ...) - signalPut() name=" << getName()  
+	     << " i=" << i << " next_in= " << next_in 
+	     << " next_out=" << next_out << endl;
+      signalPut(); signal();
+    }
+  }
+  return;
+  
 }
 
@@ -182,5 +235,5 @@
 
 
-void TOISeqBuffered::doPutData(int i, double value, uint_8 flag) {
+void TOISeqBuffered::putData(int i, double value, uint_8 flag) {
   if (!started) {
     first_in = next_in = i;
@@ -191,13 +244,13 @@
     if (i != next_in) {
       if (dbglev > 0) 
-	cout << " TOISeqBuffered::doPutData() - i!=next_in() name=" << getName()  
+	cout << " TOISeqBuffered::putData() - i!=next_in() name=" << getName()  
 	     << " i=" << i << " next_in= " << next_in 
 	     << " next_out=" << next_out << endl;
-      string msg = "TOISeqBuffered::doPutData() : i!=next_in TOIname="  + getName();
+      string msg = "TOISeqBuffered::putData() : i!=next_in TOIname="  + getName();
       throw RangeCheckError(msg);
     }
     if (next_in-next_out >= wsize) { 
       if (dbglev > 0) 
-	cout << " TOISeqBuffered::doPutData() - waitPut() " << getName() 
+	cout << " TOISeqBuffered::putData() - waitPut() " << getName() 
 	     << " i=" << i 
 	     << " next_in= " << next_in << " next_out=" << next_out << endl;
@@ -214,8 +267,50 @@
   if (isGetWaiting() && (next_in-next_out > wsize/8))  { 
     if (dbglev > 0) 
-      cout << " TOISeqBuffered::doPutData() - signalGet() name=" << getName()
-	   << " i=" << i << " next_in= " << next_in 
-	   << " next_out=" << next_out << endl;
-    signalGet();
+      cout << " TOISeqBuffered::putData() - signalGet() name=" << getName()
+	   << " i=" << i << " next_in= " << next_in 
+	   << " next_out=" << next_out << endl;
+    signalGet(); signal();
+  }
+}
+
+void TOISeqBuffered::putData(int i, int n, double const* val, uint_8 const* flg) {
+  if (!started) {
+    first_in = next_in = i;
+    next_out = next_in;
+    started = true;
+  }
+  else {
+    if (i != next_in) {
+      if (dbglev > 0) 
+	cout << " TOISeqBuffered::putData(i,n ...) - i!=next_in() name=" << getName()  
+	     << " i=" << i << " next_in= " << next_in 
+	     << " next_out=" << next_out << endl;
+      string msg = "TOISeqBuffered::putData() : i!=next_in TOIname="  + getName();
+      throw RangeCheckError(msg);
+    }
+  }
+  for(int j=i; j<i+n; j++) {
+    if (next_in-next_out >= wsize) { 
+      if (dbglev > 0) 
+	cout << " TOISeqBuffered::putData(i,n ...) - waitPut() " << getName() 
+	     << " j=" << j 
+	     << " next_in= " << next_in << " next_out=" << next_out << endl;
+      waitPut();
+      if (dbglev > 0) 
+	cout << " ... Out of waitPut() j=" << j
+	     << " next_in= " << next_in << " next_out=" << next_out << endl;
+    }
+    cleanWaitPut();
+    dataRef(j) = val[j-i];
+    if (flg) flagRef(j) = flg[j-i];
+    else flagRef(j) = 0;
+    next_in = j+1;
+  }
+  if (isGetWaiting() && (next_in-next_out > wsize/8))  { 
+    if (dbglev > 0) 
+      cout << " TOISeqBuffered::putData(i,n ...) - signalGet() name=" << getName()
+	   << " i=" << i << " next_in= " << next_in 
+	   << " next_out=" << next_out << endl;
+    signalGet(); signal();
   }
 }
@@ -236,4 +331,15 @@
 }
 
-		 
-
+void TOISeqBuffered::doGetData(int i, double & val, uint_8 & flg)
+{
+  cerr << " TOISeqBuffered::doGetData() not implemented !"
+       << " \n A quoi ca set ??? Reza - Mai 2002 " << endl;
+  throw NotAvailableOperation("TOISeqBuffered::doGetData() not implemented !");
+}
+
+void TOISeqBuffered::doPutData(int i, double value, uint_8 flag)
+{
+  cerr << " TOISeqBuffered::doGetData() not implemented !"
+       << " \n A quoi ca set ??? Reza - Mai 2002 " << endl;
+  throw NotAvailableOperation("TOISeqBuffered::doGetData() not implemented !");
+}
