Changeset 1985 in Sophya for trunk/ArchTOIPipe/Kernel/toiseqbuff.cc
- Timestamp:
- May 7, 2002, 6:38:03 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/toiseqbuff.cc
r1762 r1985 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toiseqbuff.cc,v 1. 9 2001-11-13 16:22:47 aubourgExp $5 // $Id: toiseqbuff.cc,v 1.10 2002-05-07 16:38:03 ansari Exp $ 6 6 7 7 #include "toiprocessor.h" … … 85 85 } 86 86 87 void TOISeqBuffered:: doWontNeedBefore(int i) {87 void TOISeqBuffered::wontNeedBefore(int i) { 88 88 // $CHECK$ Reza 30/4/2001 - Je ne sais pas a quoi ca sert ! 89 89 // next_out = i; $CHECK$ Reza 30/4/2001 … … 113 113 #endif 114 114 115 void TOISeqBuffered::doGetData(int i, double & val, uint_8 & flg) { 115 double TOISeqBuffered::getData(int i) 116 { 117 double val; 118 uint_8 flg; 119 getData(i, val, flg); 120 return(val); 121 } 122 123 124 void TOISeqBuffered::getData(int i, double & val, uint_8 & flg) { 116 125 if (!started) { 117 cout << " TOISeqBuffered:: doGetData() - waitGet() Waiting for start ... " << endl;126 cout << " TOISeqBuffered::getData() - waitGet() Waiting for start ... " << endl; 118 127 waitGet(); 119 128 } … … 121 130 if (isDataDeleted(i)) { 122 131 if (dbglev > 0) 123 cout << " TOISeqBuffered:: doGetData() - DataDeleted() name=" << getName()124 << " i=" << i << " next_in= " << next_in 125 << " next_out=" << next_out << endl; 126 throw RangeCheckError("TOISeqBuffered:: doGetData(i) : data deleted");132 cout << " TOISeqBuffered::getData() - DataDeleted() name=" << getName() 133 << " i=" << i << " next_in= " << next_in 134 << " next_out=" << next_out << endl; 135 throw RangeCheckError("TOISeqBuffered::getData(i) : data deleted"); 127 136 } 128 137 while (i >= next_in) { 129 138 if (i>next_out) next_out = i; 130 139 if (dbglev > 0) 131 cout << " TOISeqBuffered:: doGetData() - waitGet() name=" << getName()140 cout << " TOISeqBuffered::getData() - waitGet() name=" << getName() 132 141 << " i=" << i << " next_in= " << next_in 133 142 << " next_out=" << next_out << endl; … … 144 153 if (isPutWaiting() && (next_in-next_out < wsize/2 )) { 145 154 if (dbglev > 0) 146 cout << " TOISeqBuffered:: doGetData() - signalPut() name=" << getName()147 << " i=" << i << " next_in= " << next_in 148 << " next_out=" << next_out << endl; 149 signalPut(); 155 cout << " TOISeqBuffered::getData() - signalPut() name=" << getName() 156 << " i=" << i << " next_in= " << next_in 157 << " next_out=" << next_out << endl; 158 signalPut(); signal(); 150 159 } 151 160 return; 161 } 162 163 164 void TOISeqBuffered::getData(int i, int n, double* data, uint_8* flg) 165 { 166 if (!started) { 167 cout << " TOISeqBuffered::getData(i,n ...) - waitGet() Waiting for start ... " << endl; 168 waitGet(); 169 } 170 cleanWaitGet(); 171 if (isDataDeleted(i)) { 172 if (dbglev > 0) 173 cout << " TOISeqBuffered::getData(i,n ...) - DataDeleted() name=" << getName() 174 << " i=" << i << " next_in= " << next_in 175 << " next_out=" << next_out << endl; 176 throw RangeCheckError("TOISeqBuffered::getData(i) : data deleted"); 177 } 178 for(int j=i; i<i+n; j++) { 179 while (j >= next_in) { 180 if (j>next_out) next_out = j; 181 if (dbglev > 0) 182 cout << " TOISeqBuffered::getData(i,n ...) - waitGet() name=" << getName() 183 << " j=" << j << " next_in= " << next_in 184 << " next_out=" << next_out << endl; 185 waitGet(); 186 if (dbglev > 0) 187 cout << " ... Out of waitGet() j=" << j 188 << " next_in= " << next_in << " next_out=" << next_out << endl; 189 } 190 cleanWaitGet(); 191 data[j-i] = dataRef(j); 192 if (flg) flg[j-i] = flagRef(j); 193 if (first_out < 0) first_out = j; 194 if ((j+1) > next_out) next_out = j+1; 195 if (isPutWaiting() && (next_in-next_out < wsize/2 )) { 196 if (dbglev > 0) 197 cout << " TOISeqBuffered::getData(i,n ...) - signalPut() name=" << getName() 198 << " i=" << i << " next_in= " << next_in 199 << " next_out=" << next_out << endl; 200 signalPut(); signal(); 201 } 202 } 203 return; 204 152 205 } 153 206 … … 182 235 183 236 184 void TOISeqBuffered:: doPutData(int i, double value, uint_8 flag) {237 void TOISeqBuffered::putData(int i, double value, uint_8 flag) { 185 238 if (!started) { 186 239 first_in = next_in = i; … … 191 244 if (i != next_in) { 192 245 if (dbglev > 0) 193 cout << " TOISeqBuffered:: doPutData() - i!=next_in() name=" << getName()246 cout << " TOISeqBuffered::putData() - i!=next_in() name=" << getName() 194 247 << " i=" << i << " next_in= " << next_in 195 248 << " next_out=" << next_out << endl; 196 string msg = "TOISeqBuffered:: doPutData() : i!=next_in TOIname=" + getName();249 string msg = "TOISeqBuffered::putData() : i!=next_in TOIname=" + getName(); 197 250 throw RangeCheckError(msg); 198 251 } 199 252 if (next_in-next_out >= wsize) { 200 253 if (dbglev > 0) 201 cout << " TOISeqBuffered:: doPutData() - waitPut() " << getName()254 cout << " TOISeqBuffered::putData() - waitPut() " << getName() 202 255 << " i=" << i 203 256 << " next_in= " << next_in << " next_out=" << next_out << endl; … … 214 267 if (isGetWaiting() && (next_in-next_out > wsize/8)) { 215 268 if (dbglev > 0) 216 cout << " TOISeqBuffered::doPutData() - signalGet() name=" << getName() 217 << " i=" << i << " next_in= " << next_in 218 << " next_out=" << next_out << endl; 219 signalGet(); 269 cout << " TOISeqBuffered::putData() - signalGet() name=" << getName() 270 << " i=" << i << " next_in= " << next_in 271 << " next_out=" << next_out << endl; 272 signalGet(); signal(); 273 } 274 } 275 276 void TOISeqBuffered::putData(int i, int n, double const* val, uint_8 const* flg) { 277 if (!started) { 278 first_in = next_in = i; 279 next_out = next_in; 280 started = true; 281 } 282 else { 283 if (i != next_in) { 284 if (dbglev > 0) 285 cout << " TOISeqBuffered::putData(i,n ...) - i!=next_in() name=" << getName() 286 << " i=" << i << " next_in= " << next_in 287 << " next_out=" << next_out << endl; 288 string msg = "TOISeqBuffered::putData() : i!=next_in TOIname=" + getName(); 289 throw RangeCheckError(msg); 290 } 291 } 292 for(int j=i; j<i+n; j++) { 293 if (next_in-next_out >= wsize) { 294 if (dbglev > 0) 295 cout << " TOISeqBuffered::putData(i,n ...) - waitPut() " << getName() 296 << " j=" << j 297 << " next_in= " << next_in << " next_out=" << next_out << endl; 298 waitPut(); 299 if (dbglev > 0) 300 cout << " ... Out of waitPut() j=" << j 301 << " next_in= " << next_in << " next_out=" << next_out << endl; 302 } 303 cleanWaitPut(); 304 dataRef(j) = val[j-i]; 305 if (flg) flagRef(j) = flg[j-i]; 306 else flagRef(j) = 0; 307 next_in = j+1; 308 } 309 if (isGetWaiting() && (next_in-next_out > wsize/8)) { 310 if (dbglev > 0) 311 cout << " TOISeqBuffered::putData(i,n ...) - signalGet() name=" << getName() 312 << " i=" << i << " next_in= " << next_in 313 << " next_out=" << next_out << endl; 314 signalGet(); signal(); 220 315 } 221 316 } … … 236 331 } 237 332 238 239 333 void TOISeqBuffered::doGetData(int i, double & val, uint_8 & flg) 334 { 335 cerr << " TOISeqBuffered::doGetData() not implemented !" 336 << " \n A quoi ca set ??? Reza - Mai 2002 " << endl; 337 throw NotAvailableOperation("TOISeqBuffered::doGetData() not implemented !"); 338 } 339 340 void TOISeqBuffered::doPutData(int i, double value, uint_8 flag) 341 { 342 cerr << " TOISeqBuffered::doGetData() not implemented !" 343 << " \n A quoi ca set ??? Reza - Mai 2002 " << endl; 344 throw NotAvailableOperation("TOISeqBuffered::doGetData() not implemented !"); 345 }
Note:
See TracChangeset
for help on using the changeset viewer.