[1738] | 1 | // ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL
|
---|
| 2 | // Eric Aubourg
|
---|
| 3 | // Christophe Magneville
|
---|
| 4 | // Reza Ansari
|
---|
[2133] | 5 | // $Id: toiprocessor.cc,v 1.25 2002-07-26 08:52:43 vfebvre Exp $
|
---|
[1738] | 6 |
|
---|
[1365] | 7 | #include "toiprocessor.h"
|
---|
| 8 | #include "toimanager.h"
|
---|
| 9 | #include <pthread.h>
|
---|
[2133] | 10 | #include <typeinfo> // ajout pour linux
|
---|
[1663] | 11 | #ifdef HAVE_VALUES_H
|
---|
[1365] | 12 | #include <values.h>
|
---|
[1663] | 13 | #endif
|
---|
[1365] | 14 |
|
---|
[1663] | 15 | #ifndef MAXINT
|
---|
| 16 | #define MAXINT 2147483647
|
---|
| 17 | #endif
|
---|
| 18 |
|
---|
| 19 | #ifdef HAVE_STDINT_H
|
---|
| 20 | #include <stdint.h>
|
---|
| 21 | #endif
|
---|
| 22 |
|
---|
[1365] | 23 | #ifdef WITH_SOPHYA
|
---|
| 24 | #include "pexceptions.h"
|
---|
| 25 | #else
|
---|
| 26 | #include "apexceptions.h"
|
---|
| 27 | #endif
|
---|
| 28 |
|
---|
| 29 | #define pthread_mutexattr_setkind_np pthread_mutexattr_settype
|
---|
| 30 |
|
---|
[2133] | 31 |
|
---|
[1365] | 32 | TOIProcessor::TOIProcessor() {
|
---|
| 33 | //cout << "TOIProcessor::TOIProcessor" << endl;
|
---|
| 34 | outTOIs = NULL;
|
---|
| 35 | inTOIs = NULL;
|
---|
| 36 | inited=false;
|
---|
| 37 |
|
---|
| 38 | upExtra = 0;
|
---|
| 39 | lowExtra = 0;
|
---|
| 40 | minOut = -1;
|
---|
| 41 | maxOut = -1;
|
---|
[1787] | 42 | forcedMinIn = -1;
|
---|
| 43 | forcedMaxIn = -1;
|
---|
[1365] | 44 | neededHistory = 1000;
|
---|
| 45 | lastAWN = 0;
|
---|
| 46 | wontNeedValue = -1;
|
---|
| 47 |
|
---|
[2133] | 48 | // Pour referencer un TOIProcessor, il faut recuperer le TOIManager correspondant
|
---|
| 49 | TOIManager::getManager()->registerProcessor(this);
|
---|
| 50 |
|
---|
[1365] | 51 | }
|
---|
| 52 |
|
---|
[2133] | 53 |
|
---|
| 54 |
|
---|
[1365] | 55 | TOIProcessor::~TOIProcessor() {
|
---|
| 56 | delete[] outTOIs;
|
---|
| 57 | delete[] inTOIs;
|
---|
| 58 | //if (mutex)
|
---|
| 59 | pthread_mutex_destroy(&mutex);
|
---|
| 60 | //if (dataReady)
|
---|
| 61 | pthread_cond_destroy(&dataReady);
|
---|
[2021] | 62 | // Il ne faut apparemment pas appeler pthread_detach si on a fait join avant
|
---|
| 63 | // Extrait du man (Reza - Mai 2002)
|
---|
| 64 | //man: The pthread_join(3) routine also detaches the target thread after
|
---|
| 65 | //man: pthread_join(3) returns successfully.
|
---|
| 66 | // pthread_detach(thread); $CHECK$ - Reza Mai 2002
|
---|
[1365] | 67 | }
|
---|
| 68 |
|
---|
| 69 |
|
---|
| 70 | void TOIProcessor::init() {
|
---|
| 71 | //cout << "TOIProcessor::init" << endl;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | void TOIProcessor::afterinit() {
|
---|
[1437] | 75 | int i;
|
---|
[1365] | 76 | inTOIs = new (TOI*[inIx.size()]);
|
---|
[1437] | 77 | for(i=0; i<inIx.size(); i++)
|
---|
[1439] | 78 | inTOIs[i] = NULL; // Protection-Initialisation - Reza 11/3/2001
|
---|
[1365] | 79 | outTOIs = new (TOI*[outIx.size()]);
|
---|
[1437] | 80 | for(i=0; i<outIx.size(); i++)
|
---|
[1439] | 81 | outTOIs[i] = NULL; // Protection-Initialisation - Reza 11/3/2001
|
---|
[1365] | 82 | }
|
---|
| 83 |
|
---|
| 84 | int TOIProcessor::getMinOut() {
|
---|
| 85 | //cout << name << "minout" << endl;
|
---|
[1787] | 86 | if (minOut < 0) minOut = calcMinOut();
|
---|
[1365] | 87 | //cout << name << "minout=" << minOut << endl;
|
---|
| 88 | return minOut;
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | int TOIProcessor::getMaxOut() {
|
---|
| 92 | //cout << name << "maxout" << endl;
|
---|
| 93 | if (maxOut < 0) maxOut = calcMaxOut();
|
---|
| 94 | //cout << name << "maxout=" << maxOut << endl;
|
---|
| 95 | return maxOut;
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | int TOIProcessor::calcMinOut() {
|
---|
| 99 | return getMinIn() + lowExtra;
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | int TOIProcessor::calcMaxOut() {
|
---|
| 103 | return getMaxIn() - upExtra;
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | int TOIProcessor::getMinIn() {
|
---|
| 107 | int nIn = inIx.size();
|
---|
| 108 | int minIn = 0;
|
---|
| 109 | for (int i=0; i<nIn; i++) {
|
---|
| 110 | TOI* toi = inTOIs[i];
|
---|
[1439] | 111 | if (toi == NULL) continue; // Protection - Reza 13/3/2001
|
---|
[1365] | 112 | int x = toi->getMinSn();
|
---|
| 113 | if (x > minIn) minIn = x;
|
---|
| 114 | }
|
---|
[1787] | 115 | if (forcedMinIn > 0 && forcedMinIn > minIn) minIn = forcedMinIn;
|
---|
[1365] | 116 | return minIn;
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | int TOIProcessor::getMaxIn() {
|
---|
[1663] | 120 | int_4 nIn = inIx.size();
|
---|
| 121 | int_4 maxIn = MAXINT;
|
---|
[1365] | 122 | for (int i=0; i<nIn; i++) {
|
---|
| 123 | TOI* toi = inTOIs[i];
|
---|
[1439] | 124 | if (toi == NULL) continue; // Protection - Reza 13/3/2001
|
---|
[1663] | 125 | int_4 x = toi->getMaxSn();
|
---|
[1365] | 126 | if (x < maxIn) maxIn = x;
|
---|
| 127 | }
|
---|
[1787] | 128 | if (forcedMaxIn > 0 && forcedMaxIn < maxIn) maxIn = forcedMaxIn;
|
---|
[1365] | 129 | return maxIn;
|
---|
| 130 | }
|
---|
| 131 |
|
---|
| 132 |
|
---|
| 133 | int TOIProcessor::declareInput(string toi) {
|
---|
| 134 | if (inIx.find(toi) != inIx.end())
|
---|
| 135 | throw DuplicateIdExc("TOIProcessor::declareInput : "+toi+" already declared");
|
---|
| 136 | int i = inIx.size();
|
---|
| 137 | inIx[toi] = i;
|
---|
| 138 | return i;
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | int TOIProcessor::declareOutput(string toi) {
|
---|
| 142 | if (outIx.find(toi) != outIx.end())
|
---|
| 143 | throw DuplicateIdExc("TOIProcessor::declareInput : "+toi+" already declared");
|
---|
| 144 | int i = outIx.size();
|
---|
| 145 | outIx[toi] = i;
|
---|
| 146 | return i;
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | int TOIProcessor::getInputTOIIndex(string toi) {
|
---|
[1367] | 150 | chkinit();
|
---|
[1365] | 151 | map<string, int>::iterator i = inIx.find(toi);
|
---|
| 152 | if (i == inIx.end()) return -1;
|
---|
| 153 | return (*i).second;
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | int TOIProcessor::getOutputTOIIndex(string toi) {
|
---|
[1367] | 157 | chkinit();
|
---|
[1365] | 158 | map<string, int>::iterator i = outIx.find(toi);
|
---|
| 159 | if (i == outIx.end()) return -1;
|
---|
| 160 | return (*i).second;
|
---|
| 161 | }
|
---|
| 162 |
|
---|
[1437] | 163 | // Methodes rajoutees par Reza 11/3/2001
|
---|
| 164 | TOI* TOIProcessor::getInputTOI(int toiIndex) {
|
---|
| 165 | // chkinit();
|
---|
| 166 | if (toiIndex >= inIx.size())
|
---|
| 167 | throw RangeCheckError("TOIProcessor::getInputTOI() out of bound toiIndex");
|
---|
| 168 | TOI* toi = inTOIs[toiIndex];
|
---|
| 169 | if (toi == NULL)
|
---|
| 170 | throw NullPtrError("TOIProcessor::getInputTOI() - Not assigned TOI !");
|
---|
| 171 | return(toi);
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | TOI* TOIProcessor::getOutputTOI(int toiIndex) {
|
---|
| 175 | // chkinit();
|
---|
| 176 | if (toiIndex >= outIx.size())
|
---|
| 177 | throw RangeCheckError("TOIProcessor::getOutputTOI() out of bound toiIndex");
|
---|
| 178 | TOI* toi = outTOIs[toiIndex];
|
---|
[1963] | 179 | // if (toi == NULL)
|
---|
| 180 | // throw NullPtrError("TOIProcessor::getOutputTOI() - Not assigned TOI !");
|
---|
[1437] | 181 | return(toi);
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | bool TOIProcessor::checkInputTOIIndex(int toiIndex) {
|
---|
| 185 | if (toiIndex >= inIx.size()) return false;
|
---|
| 186 | if (inTOIs[toiIndex] == NULL) return false;
|
---|
| 187 | return true;
|
---|
| 188 | }
|
---|
| 189 |
|
---|
| 190 | bool TOIProcessor::checkOutputTOIIndex(int toiIndex) {
|
---|
| 191 | if (toiIndex >= outIx.size()) return false;
|
---|
| 192 | if (outTOIs[toiIndex] == NULL) return false;
|
---|
| 193 | return true;
|
---|
| 194 | }
|
---|
| 195 |
|
---|
[1762] | 196 | void TOIProcessor::PrintStatus(::ostream & os)
|
---|
[1437] | 197 | {
|
---|
[1439] | 198 | chkinit();
|
---|
[1437] | 199 | os << " TOIProcessor::PrintStatus() - Name= " << name
|
---|
| 200 | << " MinIn=" << getMinIn() << " MaxIn=" << getMaxIn() << endl;
|
---|
| 201 | os << " --- Inputs N= " << inIx.size() << endl;
|
---|
| 202 | int k;
|
---|
| 203 | for(k=0; k<inIx.size(); k++) {
|
---|
| 204 | os << "Input[" << k << "] : " << getInName(k) ;
|
---|
| 205 | if (inTOIs[k] != NULL)
|
---|
| 206 | os << " Connected TOI " << inTOIs[k]->getName() << endl;
|
---|
| 207 | else os << " NO TOI " << endl;
|
---|
| 208 | }
|
---|
| 209 | os << " --- Outputs N= " << outIx.size() << endl;
|
---|
| 210 | for(k=0; k<outIx.size(); k++) {
|
---|
| 211 | os << "Output[" << k << "] : " << getOutName(k) ;
|
---|
| 212 | if (outTOIs[k] != NULL)
|
---|
| 213 | os << " Connected TOI " << outTOIs[k]->getName() << endl;
|
---|
| 214 | else os << " NO TOI " << endl;
|
---|
| 215 | }
|
---|
| 216 | os << endl;
|
---|
| 217 | return;
|
---|
| 218 | }
|
---|
| 219 |
|
---|
| 220 | // Fin rajout Reza 11/3/2001
|
---|
| 221 |
|
---|
[1365] | 222 | void TOIProcessor::addInput(string name, TOI* toi) {
|
---|
| 223 | chkinit();
|
---|
| 224 | map<string, int>::iterator i = inIx.find(name);
|
---|
| 225 | if (i == inIx.end()) throw NotFoundExc("TOIProcessor::addInput "+
|
---|
| 226 | name+" not declared");
|
---|
[1439] | 227 | inTOIs[(*i).second] = toi;
|
---|
| 228 | toi->addConsumer(this); // $CHECK$ Reza 13/3/2001
|
---|
[1365] | 229 | }
|
---|
| 230 |
|
---|
| 231 | void TOIProcessor::addOutput(string name, TOI* toi) {
|
---|
| 232 | chkinit();
|
---|
| 233 | map<string, int>::iterator i = outIx.find(name);
|
---|
| 234 | if (i == outIx.end()) throw NotFoundExc("TOIProcessor::addOutput "+
|
---|
| 235 | name+" not declared");
|
---|
| 236 | toi->setProducer(this);
|
---|
| 237 | outTOIs[(*i).second] = toi;
|
---|
| 238 | }
|
---|
| 239 |
|
---|
[1367] | 240 | string TOIProcessor::getOutName(int i) {
|
---|
| 241 | if (i > outIx.size()) throw RangeCheckError("TOIProcessor::getOutName "
|
---|
| 242 | " out of bound");
|
---|
[1437] | 243 | map<string, int>::iterator j;
|
---|
| 244 | for(j=outIx.begin(); j!= outIx.end(); j++)
|
---|
| 245 | if ((*j).second == i) return (*j).first;
|
---|
| 246 |
|
---|
| 247 | throw RangeCheckError("TOIProcessor::getOutName Not found index !");
|
---|
[1367] | 248 | }
|
---|
| 249 |
|
---|
| 250 | string TOIProcessor::getInName(int i) {
|
---|
| 251 | if (i > inIx.size()) throw RangeCheckError("TOIProcessor::getInName "
|
---|
| 252 | " out of bound");
|
---|
[1437] | 253 | map<string, int>::iterator j;
|
---|
| 254 | for(j=inIx.begin(); j!= inIx.end(); j++)
|
---|
| 255 | if ((*j).second == i) return (*j).first;
|
---|
| 256 |
|
---|
| 257 | throw RangeCheckError("TOIProcessor::getOutName Not found index !");
|
---|
[1367] | 258 | }
|
---|
| 259 |
|
---|
[1365] | 260 | void TOIProcessor::run() {
|
---|
| 261 |
|
---|
| 262 | }
|
---|
| 263 |
|
---|
[1689] | 264 | void TOIProcessor::warnPutDone() {
|
---|
| 265 | int n = outIx.size();
|
---|
| 266 | for (int i=0; i<n; i++) {
|
---|
| 267 | TOI* toi = outTOIs[i];
|
---|
[1725] | 268 | if (toi) {
|
---|
| 269 | toi->putDone();
|
---|
| 270 | }
|
---|
[1689] | 271 | }
|
---|
| 272 | }
|
---|
| 273 |
|
---|
[1365] | 274 | void* TOIProcessor::ThreadStart(void* arg) {
|
---|
[2026] | 275 |
|
---|
[1365] | 276 | TOIProcessor* p = (TOIProcessor*) arg;
|
---|
| 277 | // cout << p->name << " new thread running " << pthread_self() << endl;
|
---|
[2026] | 278 | try {
|
---|
| 279 | p->run();
|
---|
| 280 | }
|
---|
| 281 | catch (PThrowable & exc) {
|
---|
| 282 | cerr << "\n TOIProcessor::ThreadStart() Catched Exception TOIProcessor@"
|
---|
| 283 | << hex << p << dec << "\n"
|
---|
| 284 | << (string)typeid(exc).name()
|
---|
| 285 | << " - Msg= " << exc.Msg() << endl;
|
---|
| 286 | }
|
---|
| 287 | catch (const std::exception & sex) {
|
---|
| 288 | cerr << "\n TOIProcessor::ThreadStart() Catched std::exception TOIProcessor@"
|
---|
| 289 | << hex << p << dec << "\n"
|
---|
| 290 | << (string)typeid(sex).name() << endl;
|
---|
| 291 | }
|
---|
| 292 | catch (...) {
|
---|
| 293 | cerr << "\n TOIProcessor::ThreadStart() Catched ... exception TOIProcessor@"
|
---|
| 294 | << hex << p << dec << endl;
|
---|
| 295 | }
|
---|
[1689] | 296 | p->warnPutDone();
|
---|
[1629] | 297 | pthread_exit(NULL);
|
---|
[1365] | 298 | // cout << p->name << " thread done " << pthread_self() << endl;
|
---|
| 299 | return NULL;
|
---|
| 300 | }
|
---|
| 301 |
|
---|
| 302 | #ifdef Linux
|
---|
| 303 | #define pthread_mutexattr_settype pthread_mutexattr_setkind_np
|
---|
| 304 | #define PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP
|
---|
| 305 | #define pthread_mutex_setname_np(a,b,c)
|
---|
| 306 | #define pthread_cond_setname_np(a,b,c)
|
---|
| 307 | #endif
|
---|
| 308 |
|
---|
| 309 | void TOIProcessor::start() {
|
---|
| 310 | pthread_cond_init(&dataReady, NULL);
|
---|
| 311 | pthread_mutexattr_init(&mutattr);
|
---|
| 312 | // pthread_mutexattr_settype(&mutattr, PTHREAD_MUTEX_ERRORCHECK);
|
---|
| 313 | pthread_mutex_init(&mutex, &mutattr);
|
---|
| 314 | //pthread_mutex_setname_np(&mutex, (name + "_proc_mutex").c_str(), 0);
|
---|
| 315 | //pthread_cond_setname_np(&dataReady, (name + "_proc_cond").c_str(), 0);
|
---|
| 316 | //cout << name << " starting thread " << &thread << endl;
|
---|
| 317 | pthread_create(&thread, NULL, ThreadStart, this);
|
---|
| 318 | TOIManager::getManager()->addThread(&thread);
|
---|
| 319 | }
|
---|
| 320 |
|
---|
| 321 | #ifndef NO_SOPHYA
|
---|
[1464] | 322 | /* ---- l'interface va etre modifiee, NE PAS UTILISER
|
---|
[1365] | 323 | Array TOIProcessor::getData(int toiIndex, int iStart, int iEnd) {
|
---|
[1437] | 324 | TOI* toi = getInputTOI(toiIndex);
|
---|
[1365] | 325 | toi->waitForData(iStart, iEnd);
|
---|
| 326 | return toi->getData(iStart, iEnd);
|
---|
| 327 | }
|
---|
| 328 |
|
---|
| 329 | Array TOIProcessor::getError(int toiIndex, int iStart, int iEnd) {
|
---|
[1437] | 330 | TOI* toi = getInputTOI(toiIndex);
|
---|
[1365] | 331 | toi->waitForData(iStart, iEnd);
|
---|
| 332 | return toi->getError(iStart, iEnd);
|
---|
| 333 | }
|
---|
| 334 |
|
---|
| 335 | TArray<int_4> TOIProcessor::getFlag(int toiIndex, int iStart, int iEnd) {
|
---|
[1437] | 336 | TOI* toi = getInputTOI(toiIndex);
|
---|
[1365] | 337 | toi->waitForData(iStart, iEnd);
|
---|
| 338 | return toi->getFlag(iStart, iEnd);
|
---|
| 339 | }
|
---|
[1464] | 340 | l'interface va etre modifiee, NE PAS UTILISER ---- */
|
---|
[1365] | 341 | #endif
|
---|
| 342 |
|
---|
| 343 | double TOIProcessor::getData(int toiIndex, int i) {
|
---|
[1437] | 344 | TOI* toi = getInputTOI(toiIndex);
|
---|
[1740] | 345 | if (toi->needSyncOldWay()) toi->waitForData(i); // seulement pour autre que segmented
|
---|
| 346 | autoWontNeed(i);
|
---|
[1365] | 347 | return toi->getData(i);
|
---|
| 348 | }
|
---|
| 349 |
|
---|
[1532] | 350 | void TOIProcessor::getData(int toiIndex, int i, double &data, uint_8 &flag)
|
---|
[1462] | 351 | {
|
---|
| 352 | TOI* toi = getInputTOI(toiIndex);
|
---|
[1740] | 353 | if (toi->needSyncOldWay()) toi->waitForData(i); // seulement pour autre que segmented
|
---|
[1462] | 354 | toi->getData(i, data, flag);
|
---|
[1742] | 355 | autoWontNeed(i);
|
---|
[1462] | 356 | return;
|
---|
| 357 | }
|
---|
| 358 |
|
---|
[1742] | 359 | void TOIProcessor::getData(int toiIndex, int i, int n, double* d)
|
---|
| 360 | {
|
---|
| 361 | TOI* toi = getInputTOI(toiIndex);
|
---|
| 362 | if (toi->needSyncOldWay()) toi->waitForData(i+n); // seulement pour autre que segmented
|
---|
| 363 | toi->getData(i, n, d);
|
---|
| 364 | autoWontNeed(i);
|
---|
| 365 | return;
|
---|
| 366 | }
|
---|
| 367 |
|
---|
| 368 | void TOIProcessor::getData(int toiIndex, int i, int n, double* d, uint_8* f)
|
---|
| 369 | {
|
---|
| 370 | TOI* toi = getInputTOI(toiIndex);
|
---|
| 371 | if (toi->needSyncOldWay()) toi->waitForData(i+n); // seulement pour autre que segmented
|
---|
| 372 | toi->getData(i, n, d, f);
|
---|
| 373 | autoWontNeed(i);
|
---|
| 374 | return;
|
---|
| 375 | }
|
---|
| 376 |
|
---|
| 377 |
|
---|
[1462] | 378 | /*RZCMV
|
---|
[1365] | 379 | double TOIProcessor::getError(int toiIndex, int i) {
|
---|
[1437] | 380 | TOI* toi = getInputTOI(toiIndex);
|
---|
[1365] | 381 | toi->waitForData(i);
|
---|
| 382 | return toi->getError(i);
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | int_4 TOIProcessor::getFlag(int toiIndex, int i) {
|
---|
[1437] | 386 | TOI* toi = getInputTOI(toiIndex);
|
---|
[1365] | 387 | toi->waitForData(i);
|
---|
| 388 | return toi->getFlag(i);
|
---|
| 389 | }
|
---|
[1462] | 390 | */
|
---|
[1365] | 391 |
|
---|
| 392 | void TOIProcessor::setNeededHistory(int nsamples) {
|
---|
| 393 | neededHistory = nsamples;
|
---|
| 394 | }
|
---|
| 395 |
|
---|
| 396 | void TOIProcessor::wontNeedBefore(int i) {
|
---|
| 397 | if (i<wontNeedValue) return;
|
---|
| 398 | wontNeedValue = i;
|
---|
| 399 | for (int j=0; j< (int) inIx.size(); j++) {
|
---|
[1490] | 400 | // $CHECK$ Reza 6/5/2001 Protection sur non connected TOI
|
---|
| 401 | if (inTOIs[j]) inTOIs[j]->wontNeedBefore(i);
|
---|
[1365] | 402 | }
|
---|
| 403 | }
|
---|
| 404 |
|
---|
| 405 | void TOIProcessor::autoWontNeed(int iCur) {
|
---|
| 406 | if (neededHistory <=0) return;
|
---|
[1773] | 407 | if (iCur < lastAWN + neededHistory/10) return;
|
---|
[1365] | 408 | lastAWN = iCur;
|
---|
[1750] | 409 | // cout << name << " wontNeedBefore " << iCur-neededHistory << endl;
|
---|
[1365] | 410 | wontNeedBefore(iCur-neededHistory);
|
---|
| 411 | }
|
---|
| 412 |
|
---|
| 413 | void TOIProcessor::notify() {
|
---|
[1740] | 414 | lock();
|
---|
[1365] | 415 | pthread_cond_broadcast(&dataReady);
|
---|
| 416 | unlock();
|
---|
| 417 | }
|
---|
| 418 |
|
---|
| 419 |
|
---|
[1532] | 420 | void TOIProcessor::putData(int toiIndex, int i, double value, uint_8 flg) {
|
---|
[1437] | 421 | TOI* toi = getOutputTOI(toiIndex);
|
---|
[1963] | 422 | if (toi == NULL) return;
|
---|
[1365] | 423 | toi->putData(i, value, flg);
|
---|
[1742] | 424 | // autoWontNeed(i); // now done on getData
|
---|
[1740] | 425 | if (toi->needSyncOldWay()) notify(); // seulement pour non segmented
|
---|
[1365] | 426 | }
|
---|
| 427 |
|
---|
[1742] | 428 | void TOIProcessor::putData(int toiIndex, int i, int n, double const* val,
|
---|
[1743] | 429 | uint_8 const* flg) {
|
---|
[1742] | 430 | TOI* toi = getOutputTOI(toiIndex);
|
---|
[1963] | 431 | if (toi == NULL) return;
|
---|
[1742] | 432 | toi->putData(i, n, val, flg);
|
---|
| 433 | if (toi->needSyncOldWay()) notify(); // seulement pour non segmented
|
---|
| 434 | }
|
---|
| 435 |
|
---|
[1462] | 436 | /*RZCMV
|
---|
[1365] | 437 | void TOIProcessor::putDataError(int toiIndex, int i, double value,
|
---|
| 438 | double error, int_4 flg) {
|
---|
[1437] | 439 | TOI* toi = getOutputTOI(toiIndex);
|
---|
| 440 | if (toi == NULL)
|
---|
| 441 | throw NullPtrError("TOIProcessor::putDataError() - Not assigned TOI !");
|
---|
[1365] | 442 | toi->putDataError(i, value, error, flg);
|
---|
| 443 | autoWontNeed(i);
|
---|
| 444 | notify();
|
---|
| 445 | }
|
---|
[1462] | 446 | */
|
---|
[1365] | 447 |
|
---|
[2133] | 448 |
|
---|
| 449 |
|
---|
| 450 |
|
---|
| 451 |
|
---|
| 452 |
|
---|
| 453 |
|
---|
| 454 |
|
---|
| 455 |
|
---|