Changeset 2454 in Sophya for trunk/ArchTOIPipe/Kernel
- Timestamp:
- Nov 14, 2003, 1:34:56 PM (22 years ago)
- Location:
- trunk/ArchTOIPipe/Kernel
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/toi.cc
r2187 r2454 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toi.cc,v 1.1 2 2002-09-09 15:33:14aubourg Exp $5 // $Id: toi.cc,v 1.13 2003-11-14 12:34:55 aubourg Exp $ 6 6 7 7 #include "toiprocessor.h" … … 68 68 } 69 69 70 intTOI::getMinSn(){70 long TOI::getMinSn(){ 71 71 return producer->getMinOut(); 72 72 } 73 73 74 intTOI::getMaxSn(){74 long TOI::getMaxSn(){ 75 75 return producer->getMaxOut(); 76 76 } … … 97 97 RZCMV ----- l'interface va etre modifiee, NE PAS UTILISER 98 98 #ifndef NO_SOPHYA 99 Array TOI::getError( int iStart, intiEnd) {99 Array TOI::getError(long iStart, long iEnd) { 100 100 if (errorTOI == NULL) throw NotFoundExc("TOI::getDataError : no Error TOI"); 101 101 return errorTOI->getData(iStart, iEnd); 102 102 } 103 Array TOI::getData( int iStart, intiEnd) {103 Array TOI::getData(long iStart, long iEnd) { 104 104 lock(); 105 105 Array a = doGetData(iStart, iEnd); … … 108 108 return a; 109 109 } 110 TArray<int_4> TOI::getFlag( int iStart, intiEnd) {110 TArray<int_4> TOI::getFlag(long iStart, long iEnd) { 111 111 lock(); 112 112 TArray<int_4> a = doGetFlag(iStart, iEnd); … … 122 122 /* 123 123 RZCMV ------- A revoir les getError() ... 124 double TOI::getError( inti) {124 double TOI::getError(long i) { 125 125 if (errorTOI == NULL) throw NotFoundExc("TOI::getDataError : no Error TOI"); 126 126 return errorTOI->getData(i); 127 127 } 128 128 129 void TOI::putDataError( inti, double value, double error, int_4 flag) {129 void TOI::putDataError(long i, double value, double error, int_4 flag) { 130 130 if (errorTOI == NULL) throw NotFoundExc("TOI::getDataError : no Error TOI"); 131 131 putData(i, value, flag); … … 135 135 */ 136 136 137 double TOI::getData( inti) { /* deprecated, overriden in toisegment */137 double TOI::getData(long i) { /* deprecated, overriden in toisegment */ 138 138 lock(); 139 139 uint_8 flg; … … 145 145 } 146 146 147 void TOI::getData( inti, double &data, uint_8 &flag) { /* deprecated, overriden in toisegment */147 void TOI::getData(long i, double &data, uint_8 &flag) { /* deprecated, overriden in toisegment */ 148 148 lock(); 149 149 doGetData(i, data, flag); … … 153 153 } 154 154 155 void TOI::getData( inti, int n, double* data, uint_8* flg) {155 void TOI::getData(long i, int n, double* data, uint_8* flg) { 156 156 cerr << "TOI::getData [double*] unimplemented" << endl; 157 157 exit(-1); 158 158 } 159 159 160 void TOI::putData( inti, int n, double const* var, uint_8 const* flg) {160 void TOI::putData(long i, int n, double const* var, uint_8 const* flg) { 161 161 cerr << "TOI::putData [double*] unimplemented" << endl; 162 162 exit(-1); 163 163 } 164 164 165 void TOI::putData( inti, double value, uint_8 flag) { /* deprecated, overriden in toisegment */165 void TOI::putData(long i, double value, uint_8 flag) { /* deprecated, overriden in toisegment */ 166 166 lock(); 167 167 doPutData(i, value, flag); … … 170 170 } 171 171 172 void TOI::waitForData( int iStart, intiEnd) { /* deprecated, overriden in toisegment */172 void TOI::waitForData(long iStart, long iEnd) { /* deprecated, overriden in toisegment */ 173 173 if (producer == NULL) throw NotFoundExc("TOI has no producer !"); 174 174 … … 189 189 } 190 190 191 void TOI::waitForData( inti) { /* deprecated, overriden in toisegment */191 void TOI::waitForData(long i) { /* deprecated, overriden in toisegment */ 192 192 waitForData(i,i); 193 193 } … … 201 201 } 202 202 203 TOI::DataStatus TOI::isDataAvail( inti) {203 TOI::DataStatus TOI::isDataAvail(long i) { 204 204 lock(); 205 205 DataStatus stat = isDataAvailNL(i); … … 208 208 } 209 209 210 TOI::DataStatus TOI::isDataAvail( int i, intj) {210 TOI::DataStatus TOI::isDataAvail(long i, long j) { 211 211 lock(); 212 212 DataStatus stat = isDataAvailNL(i,j); … … 215 215 } 216 216 217 TOI::DataStatus TOI::isDataAvailNL( inti) {217 TOI::DataStatus TOI::isDataAvailNL(long i) { 218 218 return isDataAvailNL(i,i); 219 219 } 220 220 221 void TOI::wontNeedBefore( inti) { /* deprecated, overriden in toisegment */222 intj=i;221 void TOI::wontNeedBefore(long i) { /* deprecated, overriden in toisegment */ 222 long j=i; 223 223 for (vector<TOIProcessor*>::iterator k = consumers.begin(); 224 224 k != consumers.end(); k++) { … … 230 230 } 231 231 232 void TOI::doWontNeedBefore( inti) {233 } 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 232 void TOI::doWontNeedBefore(long i) { 233 } 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 -
trunk/ArchTOIPipe/Kernel/toi.h
r2187 r2454 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: toi.h,v 1.1 7 2002-09-09 15:33:15 aubourg Exp $7 // $Id: toi.h,v 1.18 2003-11-14 12:34:55 aubourg Exp $ 8 8 9 9 #ifndef TOI_H … … 49 49 enum DataStatus {DATA_OK=0, DATA_DELETED, DATA_NOT_YET}; 50 50 51 virtual double getData( inti);52 virtual void getData( inti, double &data, uint_8 &flag);53 //RZCMV virtual DataStatus getDataError( inti,double &data,double &error,int_4 &flag);54 virtual void getData( inti, int n, double* data, uint_8* flg=0);51 virtual double getData(long i); 52 virtual void getData(long i, double &data, uint_8 &flag); 53 //RZCMV virtual DataStatus getDataError(long i,double &data,double &error,int_4 &flag); 54 virtual void getData(long i, int n, double* data, uint_8* flg=0); 55 55 56 virtual DataStatus isDataAvail( int iStart, intiEnd);57 virtual DataStatus isDataAvail( inti);58 virtual void waitForData( int iStart, intiEnd);59 virtual void waitForData( inti);56 virtual DataStatus isDataAvail(long iStart, long iEnd); 57 virtual DataStatus isDataAvail(long i); 58 virtual void waitForData(long iStart, long iEnd); 59 virtual void waitForData(long i); 60 60 virtual void waitForAnyData(); 61 virtual int nextDataAvail(intiAfter)=0;61 virtual long nextDataAvail(long iAfter)=0; 62 62 virtual bool hasSomeData()=0; 63 63 64 virtual void putData( inti, double value, uint_8 flag=0);65 //RZCMV virtual void putDataError( inti, double value,64 virtual void putData(long i, double value, uint_8 flag=0); 65 //RZCMV virtual void putDataError(long i, double value, 66 66 // double error, int_4 flag=0); 67 virtual void putData( inti, int n, double const* val, uint_8 const* flg);67 virtual void putData(long i, int n, double const* val, uint_8 const* flg); 68 68 virtual void putDone() {} 69 69 70 virtual void wontNeedBefore( inti);70 virtual void wontNeedBefore(long i); 71 71 72 72 bool dbg; … … 99 99 #ifdef WITH_SOPHYA 100 100 /* l'interface va etre modifiee, NE PAS UTILISER 101 virtual Array doGetData( int iStart, intiEnd)=0;102 virtual TArray<int_4> doGetFlag( int iStart, intiEnd)=0;101 virtual Array doGetData(long iStart, long iEnd)=0; 102 virtual TArray<int_4> doGetFlag(long iStart, long iEnd)=0; 103 103 l'interface va etre modifiee, NE PAS UTILISER */ 104 104 #endif 105 105 106 virtual void doGetData( inti, double& data, uint_8& flag)=0;107 virtual void doPutData( inti, double value, uint_8 flag=0)=0;108 virtual void doWontNeedBefore( inti);106 virtual void doGetData(long i, double& data, uint_8& flag)=0; 107 virtual void doPutData(long i, double value, uint_8 flag=0)=0; 108 virtual void doWontNeedBefore(long i); 109 109 110 virtual DataStatus isDataAvailNL( int iStart, intiEnd)=0;111 virtual DataStatus isDataAvailNL( inti);110 virtual DataStatus isDataAvailNL(long iStart, long iEnd)=0; 111 virtual DataStatus isDataAvailNL(long i); 112 112 113 113 virtual void setProducer(TOIProcessor* prod); … … 119 119 string name; 120 120 121 virtual intgetMinSn();122 virtual intgetMaxSn();121 virtual long getMinSn(); 122 virtual long getMaxSn(); 123 123 void TOIInit(); 124 124 -
trunk/ArchTOIPipe/Kernel/toisegment.cc
r2282 r2454 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toisegment.cc,v 1.2 8 2002-11-28 15:49:21aubourg Exp $5 // $Id: toisegment.cc,v 1.29 2003-11-14 12:34:55 aubourg Exp $ 6 6 7 7 #include "toisegment.h" … … 58 58 59 59 60 double TOISegmented::getData( inti) { /* reader thread */60 double TOISegmented::getData(long i) { /* reader thread */ 61 61 return master->getData(i); 62 62 } 63 63 64 void TOISegmented::getData( inti, double& data, uint_8& flag) { /* reader thread */64 void TOISegmented::getData(long i, double& data, uint_8& flag) { /* reader thread */ 65 65 data = master->getData(i); 66 66 flag = master->getFlag(i); 67 67 } 68 68 69 void TOISegmented::getData( inti, int n, double* data, uint_8* flg) { /* reader thread */69 void TOISegmented::getData(long i, int n, double* data, uint_8* flg) { /* reader thread */ 70 70 master->getData(i, n, data, flg); 71 71 } 72 72 73 void TOISegmented::putData( inti, double value, uint_8 flag) { /* writer thread */73 void TOISegmented::putData(long i, double value, uint_8 flag) { /* writer thread */ 74 74 master->putData(i, value, flag); 75 75 } 76 76 77 void TOISegmented::putData( inti, int n, double const* val, uint_8 const* flg) { /* writer thread */77 void TOISegmented::putData(long i, int n, double const* val, uint_8 const* flg) { /* writer thread */ 78 78 master->putData(i, n, val, flg); 79 79 } … … 83 83 } 84 84 85 void TOISegmented::wontNeedBefore( inti) { /* reader thread */85 void TOISegmented::wontNeedBefore(long i) { /* reader thread */ 86 86 master->getView()->wontNeedBefore(i); 87 87 } 88 88 89 TOI::DataStatus TOISegmented::isDataAvail( int i, intj) {89 TOI::DataStatus TOISegmented::isDataAvail(long i, long j) { 90 90 // return master->getView()->isDataAvail(i, j); 91 91 cout << "TOISegmented::isDataAvail unimplemented" << endl; … … 93 93 } 94 94 95 TOI::DataStatus TOISegmented::isDataAvail( inti) {95 TOI::DataStatus TOISegmented::isDataAvail(long i) { 96 96 return isDataAvail(i,i); 97 97 } 98 98 99 TOI::DataStatus TOISegmented::isDataAvailNL( int i, intj) {99 TOI::DataStatus TOISegmented::isDataAvailNL(long i, long j) { 100 100 return isDataAvail(i,j); 101 101 } 102 102 103 TOI::DataStatus TOISegmented::isDataAvailNL( inti) {103 TOI::DataStatus TOISegmented::isDataAvailNL(long i) { 104 104 return isDataAvail(i); 105 105 } 106 106 107 void TOISegmented::waitForData( int iStart, intiEnd) {107 void TOISegmented::waitForData(long iStart, long iEnd) { 108 108 // get will wait... 109 109 } 110 110 111 void TOISegmented::waitForData( inti) {111 void TOISegmented::waitForData(long i) { 112 112 // get will wait... 113 113 } … … 118 118 } 119 119 120 int TOISegmented::nextDataAvail(intiAfter) {120 long TOISegmented::nextDataAvail(long iAfter) { 121 121 cout << "TOISegmented::nextDataAvail" << endl; 122 122 return iAfter+1; … … 128 128 } 129 129 130 void TOISegmented::doPutData( inti, double value, uint_8 flag) {130 void TOISegmented::doPutData(long i, double value, uint_8 flag) { 131 131 cout << "TOISegmented::doPutData unimplemented" << endl; 132 132 throw PError("TOISegmented::doPutData unimplemented"); 133 133 } 134 134 135 void TOISegmented::doGetData( inti, double& value, uint_8& flag) {135 void TOISegmented::doGetData(long i, double& value, uint_8& flag) { 136 136 cout << "TOISegmented::doGetData unimplemented" << endl; 137 137 throw PError("TOISegmented::doGetData unimplemented"); … … 167 167 } 168 168 169 void TOISegmented::BufferSegment::getData( intsn, int n, double* d, uint_8* f) {169 void TOISegmented::BufferSegment::getData(long sn, int n, double* d, uint_8* f) { 170 170 checkCommitted(); 171 171 checkInRange(sn); … … 177 177 } 178 178 179 void TOISegmented::BufferSegment::putData( intsn, double d, uint_8 f) {179 void TOISegmented::BufferSegment::putData(long sn, double d, uint_8 f) { 180 180 /* writer thread*/ 181 181 if (status == NEW) { … … 192 192 } 193 193 194 void TOISegmented::BufferSegment::putData( intsn, int n, double const* d, uint_8 const* f) {194 void TOISegmented::BufferSegment::putData(long sn, int n, double const* d, uint_8 const* f) { 195 195 if (status == NEW) { 196 196 status = WRITE; … … 252 252 } 253 253 254 double TOISegmented::BufferView::getData( intsn) { /* Single-thread, reader thread*/254 double TOISegmented::BufferView::getData(long sn) { /* Single-thread, reader thread*/ 255 255 ensure(sn); 256 intseg = (sn-sn0)/segmentSize;256 long seg = (sn-sn0)/segmentSize; 257 257 return segments[seg]->getData(sn); 258 258 } 259 259 260 uint_8 TOISegmented::BufferView::getFlag( intsn) { /* Single-thread, reader thread */260 uint_8 TOISegmented::BufferView::getFlag(long sn) { /* Single-thread, reader thread */ 261 261 ensure(sn); 262 intseg = (sn-sn0)/segmentSize;262 long seg = (sn-sn0)/segmentSize; 263 263 return segments[seg]->getFlag(sn); 264 264 } 265 265 266 void TOISegmented::BufferView::getData( intsn, int n, double* dat, uint_8* flg) { /* Single-thread, reader thread */266 void TOISegmented::BufferView::getData(long sn, int n, double* dat, uint_8* flg) { /* Single-thread, reader thread */ 267 267 ensure(sn); 268 268 ensure(sn+n-1); 269 269 270 intsn1 = sn;270 long sn1 = sn; 271 271 int nsam = n; 272 272 double* pdat = dat; … … 274 274 275 275 while (true) { 276 intseg = (sn1-sn0)/segmentSize;276 long seg = (sn1-sn0)/segmentSize; 277 277 BufferSegment* s = segments[seg]; 278 intsnmax = s->sn0 + s->bufferSize - 1;279 intsn2 = snmax > (sn1+nsam-1) ? (sn1+nsam-1) : snmax;280 intnget = sn2-sn1+1;278 long snmax = s->sn0 + s->bufferSize - 1; 279 long sn2 = snmax > (sn1+nsam-1) ? (sn1+nsam-1) : snmax; 280 long nget = sn2-sn1+1; 281 281 s->getData(sn1, nget, pdat, pflg); 282 282 pdat += nget; … … 288 288 } 289 289 290 void TOISegmented::BufferView::ensure( intsn) { /* Single-thread, reader thread */290 void TOISegmented::BufferView::ensure(long sn) { /* Single-thread, reader thread */ 291 291 if (sn < sn0) { 292 292 cout << "TOISegmented::BufferView::ensure : requested sample before first" << endl; … … 321 321 } 322 322 323 void TOISegmented::BufferView::wait( intsn) { /* reader thread, master read wait lock taken */323 void TOISegmented::BufferView::wait(long sn) { /* reader thread, master read wait lock taken */ 324 324 //pthread_mutex_lock(&(master->read_wait_mutex)); 325 325 waiting = true; … … 334 334 335 335 336 void TOISegmented::BufferView::wontNeedBefore( intsn) { /* reader thread */336 void TOISegmented::BufferView::wontNeedBefore(long sn) { /* reader thread */ 337 337 if (sn > firstNeeded) { 338 338 firstNeeded = sn; … … 383 383 } 384 384 385 void TOISegmented::MasterView::putData( intsn, double data, uint_8 flags) { /* writer thread */385 void TOISegmented::MasterView::putData(long sn, double data, uint_8 flags) { /* writer thread */ 386 386 if (sn0<0) { 387 387 LOG(cout << "***MasterView::putData sn0<0 -> " << sn << endl); … … 398 398 } 399 399 400 void TOISegmented::MasterView::putData( intsn, int n, double const* data, uint_8 const* flags) { /* writer thread */400 void TOISegmented::MasterView::putData(long sn, int n, double const* data, uint_8 const* flags) { /* writer thread */ 401 401 if (sn0<0) { 402 402 LOG(cout << "***MasterView::putData sn0<0 -> " << sn << endl); … … 405 405 double const* pdat = data; 406 406 uint_8 const* pflg = flags; 407 intnsam = n;408 intsn1 = sn;407 long nsam = n; 408 long sn1 = sn; 409 409 while (true) { 410 410 // maximum that current segment can take 411 intsnmax = -1;411 long snmax = -1; 412 412 if (currentSegment != NULL) { 413 413 snmax = currentSegment->sn0 + currentSegment->bufferSize-1; 414 414 } 415 intsn2 = snmax > (sn1+nsam-1) ? (sn1+nsam-1) : snmax;416 intnput = sn2-sn1+1;415 long sn2 = snmax > (sn1+nsam-1) ? (sn1+nsam-1) : snmax; 416 long nput = sn2-sn1+1; 417 417 if (snmax>0 && nput>0) { 418 418 currentSegment->putData(sn1, nput, pdat, pflg); … … 428 428 } 429 429 430 double TOISegmented::MasterView::getData( intsn) { /* reader thread */430 double TOISegmented::MasterView::getData(long sn) { /* reader thread */ 431 431 return getView()->getData(sn); /* thread-specific */ 432 432 } 433 433 434 uint_8 TOISegmented::MasterView::getFlag( intsn) { /* reader thread */434 uint_8 TOISegmented::MasterView::getFlag(long sn) { /* reader thread */ 435 435 return getView()->getFlag(sn); 436 436 } 437 437 438 void TOISegmented::MasterView::getData( intsn, int n, double* dat, uint_8* flg) { /* reader thread */438 void TOISegmented::MasterView::getData(long sn, int n, double* dat, uint_8* flg) { /* reader thread */ 439 439 getView()->getData(sn, n, dat, flg); 440 440 } … … 513 513 // int oldBegin = bv->sn0; 514 514 // int oldEnd = bv->sn0 + bv->segmentSize * bv->segments.size(); 515 intoldBegin = sn0;516 intoldEnd = sn0 + bv->segmentSize * segments.size();515 long oldBegin = sn0; 516 long oldEnd = sn0 + bv->segmentSize * segments.size(); 517 517 518 518 for (vector<BufferSegment*>::iterator i = bv->segments.begin(); … … 529 529 530 530 if (nConsumers == allViews.size()) { 531 intfirstNeeded = MAXINT;531 long firstNeeded = MAXINT; 532 532 for (set<BufferView*>::iterator i = allViews.begin(); 533 533 i != allViews.end(); i++) { … … 570 570 571 571 bv->sn0 = -1; 572 intnewEnd = -1;572 long newEnd = -1; 573 573 if (segments.size() > 0) { 574 574 bv->sn0 = bv->segments[0]->sn0; -
trunk/ArchTOIPipe/Kernel/toisegment.h
r2135 r2454 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: toisegment.h,v 1.2 0 2002-07-26 10:36:19 ansariExp $7 // $Id: toisegment.h,v 1.21 2003-11-14 12:34:55 aubourg Exp $ 8 8 9 9 #ifndef TOISEGMENT_H … … 32 32 ~TOISegmented(); 33 33 34 virtual double getData( inti);35 virtual void getData( inti, double& data, uint_8& flag);36 virtual void getData( inti, int n, double* data, uint_8* flg=0);37 virtual void putData( inti, double value, uint_8 flag=0);38 virtual void putData( inti, int n, double const* val, uint_8 const* flg=0);39 virtual void wontNeedBefore( inti);34 virtual double getData(long i); 35 virtual void getData(long i, double& data, uint_8& flag); 36 virtual void getData(long i, int n, double* data, uint_8* flg=0); 37 virtual void putData(long i, double value, uint_8 flag=0); 38 virtual void putData(long i, int n, double const* val, uint_8 const* flg=0); 39 virtual void wontNeedBefore(long i); 40 40 virtual void putDone(); 41 41 virtual void addConsumer(TOIProcessor*); 42 42 43 43 // Methodes ignorees car on reimplemente les methodes de base 44 virtual DataStatus isDataAvail( int iStart, intiEnd);45 virtual DataStatus isDataAvail( inti);46 virtual DataStatus isDataAvailNL( inti);47 virtual DataStatus isDataAvailNL( int iStart, intiEnd); // abstract48 virtual void waitForData( int iStart, intiEnd);49 virtual void waitForData( inti);44 virtual DataStatus isDataAvail(long iStart, long iEnd); 45 virtual DataStatus isDataAvail(long i); 46 virtual DataStatus isDataAvailNL(long i); 47 virtual DataStatus isDataAvailNL(long iStart, long iEnd); // abstract 48 virtual void waitForData(long iStart, long iEnd); 49 virtual void waitForData(long i); 50 50 virtual void waitForAnyData(); 51 virtual int nextDataAvail(intiAfter); // abstract51 virtual long nextDataAvail(long iAfter); // abstract 52 52 virtual bool hasSomeData(); // abstract 53 virtual void doGetData( inti, double& data, uint_8& flag); // abs54 virtual void doPutData( inti, double value, uint_8 flag=0); // abs53 virtual void doGetData(long i, double& data, uint_8& flag); // abs 54 virtual void doPutData(long i, double value, uint_8 flag=0); // abs 55 55 56 56 … … 76 76 int getRefCount(); 77 77 78 void putData( intsn, double data, uint_8 flag);79 void putData( intsn, int n, double const* data, uint_8 const* flag);80 inline double getData( intsn);81 inline uint_8 getFlag( intsn);82 void getData( intsn, int n, double* data, uint_8* flag);83 84 bool isPastEnd( intsn) {78 void putData(long sn, double data, uint_8 flag); 79 void putData(long sn, int n, double const* data, uint_8 const* flag); 80 inline double getData(long sn); 81 inline uint_8 getFlag(long sn); 82 void getData(long sn, int n, double* data, uint_8* flag); 83 84 bool isPastEnd(long sn) { 85 85 return sn >= sn0+bufferSize; 86 86 } … … 94 94 } 95 95 96 void checkInRange( intsn) {96 void checkInRange(long sn) { 97 97 if (sn < sn0 || sn >= sn0+bufferSize) { 98 98 cerr << "TOISegment: out of range access in buffer segment " << sn << " not in " … … 105 105 int status; // NEW, WRITE, COMMITTED 106 106 int bufferSize; 107 intsn0; // Samplenum du premier echantillon107 long sn0; // Samplenum du premier echantillon 108 108 109 109 int refcount; // Nombre de vues qui utilisent … … 123 123 ~MasterView(); 124 124 125 void putData( intsn, double data, uint_8 flag);126 double getData( intsn);127 uint_8 getFlag( intsn);128 void getData( inti, int n, double* data, uint_8* flg);129 void putData( inti, int n, double const* val, uint_8 const* flg);125 void putData(long sn, double data, uint_8 flag); 126 double getData(long sn); 127 uint_8 getFlag(long sn); 128 void getData(long i, int n, double* data, uint_8* flg); 129 void putData(long i, int n, double const* val, uint_8 const* flg); 130 130 BufferView* getView(); // thread-specific 131 131 void putDone(); … … 147 147 int maxSegments; 148 148 int segmentSize; 149 intsn0; // First sn in first segment149 long sn0; // First sn in first segment 150 150 vector<BufferSegment*> segments; // Committed segments 151 151 int nConsumers; … … 174 174 ~BufferView(); 175 175 176 double getData( intsn);177 uint_8 getFlag( intsn);178 void getData( inti, int n, double* data, uint_8* flg);179 180 void wontNeedBefore( intsn);176 double getData(long sn); 177 uint_8 getFlag(long sn); 178 void getData(long i, int n, double* data, uint_8* flg); 179 180 void wontNeedBefore(long sn); 181 181 182 182 protected: 183 void wait( intsn); // Passe en attente d'un nouveau segment -- lecture183 void wait(long sn); // Passe en attente d'un nouveau segment -- lecture 184 184 void sync(); // recupere les nouveaux segments, resync avec master 185 void ensure( intsn);185 void ensure(long sn); 186 186 187 187 bool waiting; 188 intwaitingFor;188 long waitingFor; 189 189 190 190 friend class MasterView; 191 191 MasterView* master; 192 192 vector<BufferSegment*> segments; // Committed 193 intsn0;193 long sn0; 194 194 int segmentSize; 195 intfirstNeeded;195 long firstNeeded; 196 196 }; 197 197 … … 204 204 /***********************************/ 205 205 206 double TOISegmented::BufferSegment::getData( intsn) {206 double TOISegmented::BufferSegment::getData(long sn) { 207 207 checkCommitted(); 208 208 checkInRange(sn); … … 210 210 } 211 211 212 uint_8 TOISegmented::BufferSegment::getFlag( intsn) {212 uint_8 TOISegmented::BufferSegment::getFlag(long sn) { 213 213 checkCommitted(); 214 214 checkInRange(sn); -
trunk/ArchTOIPipe/Kernel/toiseqbuff.cc
r2024 r2454 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toiseqbuff.cc,v 1.1 5 2002-05-30 10:09:06 ansariExp $5 // $Id: toiseqbuff.cc,v 1.16 2003-11-14 12:34:55 aubourg Exp $ 6 6 7 7 #include "toiprocessor.h" … … 74 74 } 75 75 76 TOI::DataStatus TOISeqBuffered::isDataAvailNL( int iStart, intiEnd) {76 TOI::DataStatus TOISeqBuffered::isDataAvailNL(long iStart, long iEnd) { 77 77 if (iEnd < iStart) 78 78 throw RangeCheckError("TOISeqBuffered::isDataAvailNL : iEnd<iStart !"); … … 83 83 } 84 84 85 TOI::DataStatus TOISeqBuffered::isDataAvailNL( inti) {85 TOI::DataStatus TOISeqBuffered::isDataAvailNL(long i) { 86 86 return TOI::isDataAvailNL(i); 87 87 } 88 88 89 void TOISeqBuffered::wontNeedBefore( inti) {89 void TOISeqBuffered::wontNeedBefore(long i) { 90 90 // $CHECK$ Reza 30/4/2001 - Je ne sais pas a quoi ca sert ! 91 91 // next_out = i; $CHECK$ Reza 30/4/2001 … … 95 95 #ifndef NO_SOPHYA 96 96 /* ---- l'interface va etre modifiee, NE PAS UTILISER 97 Array TOISeqBuffered::doGetData( int iStart, intiEnd) {97 Array TOISeqBuffered::doGetData(long iStart, long iEnd) { 98 98 // if (iEnd < iStart) 99 99 // throw RangeCheckError("TOI::getData : iEnd<iStart !"); … … 104 104 cleanWaitGet(); 105 105 Vector dat(iEnd - iStart + 1); 106 for ( inti=0; i<iEnd-iStart+1; i++) {106 for (long i=0; i<iEnd-iStart+1; i++) { 107 107 dat(i) = dataRef(i+iStart); 108 108 } … … 115 115 #endif 116 116 117 double TOISeqBuffered::getData( inti)117 double TOISeqBuffered::getData(long i) 118 118 { 119 119 double val; … … 124 124 125 125 126 void TOISeqBuffered::getData( inti, double & val, uint_8 & flg) {126 void TOISeqBuffered::getData(long i, double & val, uint_8 & flg) { 127 127 lock(); 128 128 if (!started) { … … 168 168 169 169 170 void TOISeqBuffered::getData( inti, int n, double* data, uint_8* flg)170 void TOISeqBuffered::getData(long i, int n, double* data, uint_8* flg) 171 171 { 172 172 lock(); … … 184 184 throw RangeCheckError("TOISeqBuffered::getData(i) : data deleted"); 185 185 } 186 for( intj=i; j<i+n; j++) {186 for(long j=i; j<i+n; j++) { 187 187 while (j >= next_in) { 188 188 if (j>next_out) next_out = j; … … 218 218 #ifndef NO_SOPHYA 219 219 /* ---- l'interface va etre modifiee, NE PAS UTILISER 220 TArray<int_4> TOISeqBuffered::doGetFlag( int iStart, intiEnd) {220 TArray<int_4> TOISeqBuffered::doGetFlag(long iStart, long iEnd) { 221 221 if (!started) waitGet(); 222 222 cleanWaitGet(); … … 224 224 throw RangeCheckError("TOISeqBuffered::getFlag(iS,iE) : data not available"); 225 225 TVector<int_4> dat(iEnd - iStart + 1); 226 for ( inti=0; i<iEnd-iStart+1; i++) {226 for (long i=0; i<iEnd-iStart+1; i++) { 227 227 dat[i] = flagRef(i+iStart); 228 228 } … … 233 233 234 234 /*RZCMV 235 int_4 TOISeqBuffered::doGetFlag( inti) {235 int_4 TOISeqBuffered::doGetFlag(long i) { 236 236 if (!started) waitGet(); 237 237 cleanWaitGet(); … … 245 245 246 246 247 void TOISeqBuffered::putData( inti, double value, uint_8 flag) {247 void TOISeqBuffered::putData(long i, double value, uint_8 flag) { 248 248 lock(); 249 249 if (!started) { … … 290 290 } 291 291 292 void TOISeqBuffered::putData( inti, int n, double const* val, uint_8 const* flg)292 void TOISeqBuffered::putData(long i, int n, double const* val, uint_8 const* flg) 293 293 { 294 294 lock(); … … 309 309 } 310 310 } 311 for( intj=i; j<i+n; j++) {311 for(long j=i; j<i+n; j++) { 312 312 if (next_in-next_out >= wsize) { 313 313 if (dbglev > 0) … … 357 357 } 358 358 359 int TOISeqBuffered::nextDataAvail(intiAfter) {359 long TOISeqBuffered::nextDataAvail(long iAfter) { 360 360 lock(); 361 361 if (iAfter >= next_in ) {unlock(); return -1;} … … 365 365 } 366 366 367 void TOISeqBuffered::doGetData( inti, double & val, uint_8 & flg)367 void TOISeqBuffered::doGetData(long i, double & val, uint_8 & flg) 368 368 { 369 369 cerr << " TOISeqBuffered::doGetData() not implemented !" … … 372 372 } 373 373 374 void TOISeqBuffered::doPutData( inti, double value, uint_8 flag)374 void TOISeqBuffered::doPutData(long i, double value, uint_8 flag) 375 375 { 376 376 cerr << " TOISeqBuffered::doGetData() not implemented !" -
trunk/ArchTOIPipe/Kernel/toiseqbuff.h
r1985 r2454 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: toiseqbuff.h,v 1.1 0 2002-05-07 16:38:03 ansariExp $7 // $Id: toiseqbuff.h,v 1.11 2003-11-14 12:34:56 aubourg Exp $ 8 8 9 9 #ifndef TOISEQBUFF_H … … 33 33 inline int getDebugLevel() const { return dbglev; } 34 34 35 virtual double getData( inti);36 virtual void getData( inti, double& data, uint_8& flag);37 virtual void getData( inti, int n, double* data, uint_8* flg=0);38 virtual void putData( inti, double value, uint_8 flag=0);39 virtual void putData( inti, int n, double const* val, uint_8 const* flg=0);40 virtual void wontNeedBefore( inti);35 virtual double getData(long i); 36 virtual void getData(long i, double& data, uint_8& flag); 37 virtual void getData(long i, int n, double* data, uint_8* flg=0); 38 virtual void putData(long i, double value, uint_8 flag=0); 39 virtual void putData(long i, int n, double const* val, uint_8 const* flg=0); 40 virtual void wontNeedBefore(long i); 41 41 42 inline intgetFirstIn() const { return first_in; }43 inline intgetFirstOut() const { return first_out; }44 inline intgetLastIn() const { return (next_in-1); }45 inline intgetLastOut() const { return (next_out-1); }42 inline long getFirstIn() const { return first_in; } 43 inline long getFirstOut() const { return first_out; } 44 inline long getLastIn() const { return (next_in-1); } 45 inline long getLastOut() const { return (next_out-1); } 46 46 47 47 48 virtual DataStatus isDataAvailNL( int iStart, intiEnd);49 virtual DataStatus isDataAvailNL( inti); // override required48 virtual DataStatus isDataAvailNL(long iStart, long iEnd); 49 virtual DataStatus isDataAvailNL(long i); // override required 50 50 51 51 protected: … … 54 54 int wsize; 55 55 int buffsize; 56 intnext_in;57 intnext_out;58 intfirst_in;59 intfirst_out;56 long next_in; 57 long next_out; 58 long first_in; 59 long first_out; 60 60 bool started; 61 61 double defaultValue; … … 66 66 #ifdef WITH_SOPHYA 67 67 /* ---- l'interface va etre modifiee, NE PAS UTILISER 68 virtual Array doGetData( int iStart, intiEnd);69 virtual TArray<int_4> doGetFlag( int iStart, intiEnd);68 virtual Array doGetData(long iStart, long iEnd); 69 virtual TArray<int_4> doGetFlag(long iStart, long iEnd); 70 70 l'interface va etre modifiee, NE PAS UTILISER ---- */ 71 71 #endif 72 virtual void doGetData( inti, double & val, uint_8 & flg);72 virtual void doGetData(long i, double & val, uint_8 & flg); 73 73 74 virtual void doPutData( inti, double value, uint_8 flag=0);75 // virtual void doWontNeedBefore( inti); plus besoin ? - Reza Mai 200274 virtual void doPutData(long i, double value, uint_8 flag=0); 75 // virtual void doWontNeedBefore(long i); plus besoin ? - Reza Mai 2002 76 76 77 virtual int nextDataAvail(intiAfter);77 virtual long nextDataAvail(long iAfter); 78 78 virtual bool hasSomeData(); 79 79 80 inline double & dataRef( inti) { return data[i%buffsize]; }81 inline uint_8 & flagRef( inti) { return flags[i%buffsize]; }82 inline bool isDataDeleted( inti)80 inline double & dataRef(long i) { return data[i%buffsize]; } 81 inline uint_8 & flagRef(long i) { return flags[i%buffsize]; } 82 inline bool isDataDeleted(long i) 83 83 { return((i < next_in-buffsize-1) ? true : false); } 84 84 };
Note:
See TracChangeset
for help on using the changeset viewer.