Index: trunk/ArchTOIPipe/Kernel/toisegment.cc
===================================================================
--- trunk/ArchTOIPipe/Kernel/toisegment.cc	(revision 2282)
+++ trunk/ArchTOIPipe/Kernel/toisegment.cc	(revision 2454)
@@ -3,5 +3,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toisegment.cc,v 1.28 2002-11-28 15:49:21 aubourg Exp $
+// $Id: toisegment.cc,v 1.29 2003-11-14 12:34:55 aubourg Exp $
 
 #include "toisegment.h"
@@ -58,22 +58,22 @@
 
 
-double TOISegmented::getData(int i) { /* reader thread */
+double TOISegmented::getData(long i) { /* reader thread */
   return master->getData(i);
 }
 
-void TOISegmented::getData(int i, double& data, uint_8& flag) { /* reader thread */
+void TOISegmented::getData(long i, double& data, uint_8& flag) { /* reader thread */
   data = master->getData(i);
   flag = master->getFlag(i);
 }
 
-void TOISegmented::getData(int i, int n, double* data, uint_8* flg) { /* reader thread */
+void TOISegmented::getData(long 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 */
+void TOISegmented::putData(long 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 */
+void TOISegmented::putData(long i, int n, double const* val, uint_8 const* flg) { /* writer thread */
   master->putData(i, n, val, flg);
 }
@@ -83,9 +83,9 @@
 }
 
-void TOISegmented::wontNeedBefore(int i) {  /* reader thread */
+void TOISegmented::wontNeedBefore(long i) {  /* reader thread */
   master->getView()->wontNeedBefore(i);
 }
 
-TOI::DataStatus TOISegmented::isDataAvail(int i, int j) {
+TOI::DataStatus TOISegmented::isDataAvail(long i, long j) {
   // return master->getView()->isDataAvail(i, j);
   cout << "TOISegmented::isDataAvail unimplemented" << endl;
@@ -93,21 +93,21 @@
 }
 
-TOI::DataStatus TOISegmented::isDataAvail(int i) {
+TOI::DataStatus TOISegmented::isDataAvail(long i) {
   return isDataAvail(i,i);
 }
 
-TOI::DataStatus TOISegmented::isDataAvailNL(int i, int j) {
+TOI::DataStatus TOISegmented::isDataAvailNL(long i, long j) {
   return isDataAvail(i,j);
 }
 
-TOI::DataStatus TOISegmented::isDataAvailNL(int i) {
+TOI::DataStatus TOISegmented::isDataAvailNL(long i) {
   return isDataAvail(i);
 }
 
-void TOISegmented::waitForData(int iStart, int iEnd) {
+void TOISegmented::waitForData(long iStart, long iEnd) {
   // get will wait...
 }
 
-void TOISegmented::waitForData(int i) {
+void TOISegmented::waitForData(long i) {
   // get will wait...
 }
@@ -118,5 +118,5 @@
 }
 
-int TOISegmented::nextDataAvail(int iAfter) {
+long TOISegmented::nextDataAvail(long iAfter) {
   cout << "TOISegmented::nextDataAvail" << endl;
   return iAfter+1;
@@ -128,10 +128,10 @@
 }
 
-void TOISegmented::doPutData(int i, double value, uint_8 flag) {
+void TOISegmented::doPutData(long i, double value, uint_8 flag) {
   cout << "TOISegmented::doPutData unimplemented" << endl;
   throw PError("TOISegmented::doPutData unimplemented");
 }
 
-void TOISegmented::doGetData(int i, double& value, uint_8& flag) {
+void TOISegmented::doGetData(long i, double& value, uint_8& flag) {
   cout << "TOISegmented::doGetData unimplemented" << endl;
   throw PError("TOISegmented::doGetData unimplemented");
@@ -167,5 +167,5 @@
 }
 
-void TOISegmented::BufferSegment::getData(int sn, int n, double* d, uint_8* f) {
+void TOISegmented::BufferSegment::getData(long sn, int n, double* d, uint_8* f) {
   checkCommitted();
   checkInRange(sn);
@@ -177,5 +177,5 @@
 }
 
-void TOISegmented::BufferSegment::putData(int sn, double d, uint_8 f) { 
+void TOISegmented::BufferSegment::putData(long sn, double d, uint_8 f) { 
   /* writer thread*/
   if (status == NEW) {
@@ -192,5 +192,5 @@
 }
 
-void TOISegmented::BufferSegment::putData(int sn, int n, double const* d, uint_8 const* f) {
+void TOISegmented::BufferSegment::putData(long sn, int n, double const* d, uint_8 const* f) {
   if (status == NEW) {
     status = WRITE;
@@ -252,21 +252,21 @@
 }
 
-double TOISegmented::BufferView::getData(int sn) { /* Single-thread, reader thread*/
+double TOISegmented::BufferView::getData(long sn) { /* Single-thread, reader thread*/
   ensure(sn);
-  int seg = (sn-sn0)/segmentSize;
+  long seg = (sn-sn0)/segmentSize;
   return segments[seg]->getData(sn);
 }
 
-uint_8 TOISegmented::BufferView::getFlag(int sn) { /* Single-thread, reader thread */
+uint_8 TOISegmented::BufferView::getFlag(long sn) { /* Single-thread, reader thread */
   ensure(sn);
-  int seg = (sn-sn0)/segmentSize;
+  long 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 */
+void TOISegmented::BufferView::getData(long sn, int n, double* dat, uint_8* flg) { /* Single-thread, reader thread */
   ensure(sn);
   ensure(sn+n-1);
   
-  int  sn1  = sn;
+  long  sn1  = sn;
   int  nsam = n;
   double* pdat = dat;
@@ -274,9 +274,9 @@
 
   while (true) {
-    int seg = (sn1-sn0)/segmentSize;
+    long 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;
+    long snmax = s->sn0 + s->bufferSize - 1;
+    long sn2 = snmax > (sn1+nsam-1) ? (sn1+nsam-1) : snmax;
+    long nget = sn2-sn1+1;
     s->getData(sn1, nget, pdat, pflg);
     pdat += nget;
@@ -288,5 +288,5 @@
 }
 
-void  TOISegmented::BufferView::ensure(int sn) { /* Single-thread, reader thread */
+void  TOISegmented::BufferView::ensure(long sn) { /* Single-thread, reader thread */
   if (sn < sn0) {
     cout << "TOISegmented::BufferView::ensure : requested sample before first" << endl;
@@ -321,5 +321,5 @@
 }
 
-void TOISegmented::BufferView::wait(int sn) { /* reader thread, master read wait lock taken */
+void TOISegmented::BufferView::wait(long sn) { /* reader thread, master read wait lock taken */
   //pthread_mutex_lock(&(master->read_wait_mutex));
   waiting = true;
@@ -334,5 +334,5 @@
 
 
-void TOISegmented::BufferView::wontNeedBefore(int sn) { /* reader thread */
+void TOISegmented::BufferView::wontNeedBefore(long sn) { /* reader thread */
   if (sn > firstNeeded) {
     firstNeeded = sn;
@@ -383,5 +383,5 @@
 }
 
-void TOISegmented::MasterView::putData(int sn, double data, uint_8 flags) { /* writer thread */
+void TOISegmented::MasterView::putData(long sn, double data, uint_8 flags) { /* writer thread */
   if (sn0<0) {
     LOG(cout << "***MasterView::putData sn0<0 -> " << sn << endl);
@@ -398,5 +398,5 @@
 }
 
-void TOISegmented::MasterView::putData(int sn, int n, double const* data, uint_8 const* flags) { /* writer thread */
+void TOISegmented::MasterView::putData(long sn, int n, double const* data, uint_8 const* flags) { /* writer thread */
   if (sn0<0) {
     LOG(cout << "***MasterView::putData sn0<0 -> " << sn << endl);
@@ -405,14 +405,14 @@
   double const*  pdat = data;
   uint_8 const*  pflg = flags;
-  int     nsam  = n;
-  int     sn1   = sn;
+  long     nsam  = n;
+  long     sn1   = sn;
   while (true) {
     // maximum that current segment can take
-    int snmax = -1;
+    long snmax = -1;
     if (currentSegment != NULL) {
       snmax = currentSegment->sn0 + currentSegment->bufferSize-1;
     }
-    int sn2 = snmax > (sn1+nsam-1) ? (sn1+nsam-1) : snmax;
-    int nput = sn2-sn1+1;
+    long sn2 = snmax > (sn1+nsam-1) ? (sn1+nsam-1) : snmax;
+    long nput = sn2-sn1+1;
     if (snmax>0 && nput>0) {
       currentSegment->putData(sn1, nput, pdat, pflg);
@@ -428,13 +428,13 @@
 }
 
-double TOISegmented::MasterView::getData(int sn) { /* reader thread */
+double TOISegmented::MasterView::getData(long sn) { /* reader thread */
   return getView()->getData(sn); /* thread-specific */
 }
 
-uint_8 TOISegmented::MasterView::getFlag(int sn) { /* reader thread */
+uint_8 TOISegmented::MasterView::getFlag(long sn) { /* reader thread */
   return getView()->getFlag(sn);
 }
 
-void TOISegmented::MasterView::getData(int sn, int n, double* dat, uint_8* flg) { /* reader thread */
+void TOISegmented::MasterView::getData(long sn, int n, double* dat, uint_8* flg) { /* reader thread */
   getView()->getData(sn, n, dat, flg);
 }
@@ -513,6 +513,6 @@
 //  int oldBegin = bv->sn0;
 //  int oldEnd   = bv->sn0 + bv->segmentSize * bv->segments.size();
-  int oldBegin = sn0;
-  int oldEnd   = sn0 + bv->segmentSize * segments.size();
+  long oldBegin = sn0;
+  long oldEnd   = sn0 + bv->segmentSize * segments.size();
 
   for (vector<BufferSegment*>::iterator i = bv->segments.begin();
@@ -529,5 +529,5 @@
 
   if (nConsumers == allViews.size()) {
-    int firstNeeded = MAXINT;
+    long firstNeeded = MAXINT;
     for (set<BufferView*>::iterator i = allViews.begin();
 	 i != allViews.end(); i++) {
@@ -570,5 +570,5 @@
 
   bv->sn0 = -1;
-  int newEnd = -1;
+  long newEnd = -1;
   if (segments.size() > 0) {
     bv->sn0 = bv->segments[0]->sn0;
