source: Sophya/trunk/Poubelle/archTOI.old/toipullproducer.cc@ 623

Last change on this file since 623 was 555, checked in by ansari, 26 years ago

portage cxx en cours

File size: 2.2 KB
RevLine 
[534]1// toipullproducer.cc
2// Eric Aubourg CEA/DAPNIA/SPP octobre 1999
3
4
5#include "toipullproducer.h"
6
7TOIPullProducer::TOIPullProducer() {
8 needBefore = needAfter = 0;
9}
10
11bool TOIPullProducer::canGetValue(long sampleNum, TOI const& toi) {
[555]12 map<TOI, TOIProducer*> & m = neededTOIs[toi];
[534]13 for (map<TOI, TOIProducer*>::iterator i = m.begin(); i != m.end(); i++) {
14 if (!(*i).second->canGetValue(sampleNum-needBefore, (*i).first) ||
15 !(*i).second->canGetValue(sampleNum+needAfter, (*i).first)) return false;
16 }
17 return true;
18}
19
20bool TOIPullProducer::canGetPrevValue(long sampleNum, TOI const& toi) {
21 return canGetValue(sampleNum-1, toi);
22}
23
24bool TOIPullProducer::canGetNextValue(long sampleNum, TOI const& toi) {
25 return canGetValue(sampleNum+1, toi);
26}
27
28bool TOIPullProducer::canGetValueLater(long sampleNum, TOI const& toi) {
[555]29 map<TOI, TOIProducer*> & m = neededTOIs[toi];
[534]30 for (map<TOI, TOIProducer*>::iterator i = m.begin(); i != m.end(); i++) {
31 if (!(*i).second->canGetValueLater(sampleNum+needAfter, (*i).first)) return false;
32 }
33 return true;
34}
35
36
37double TOIPullProducer::getPrevValue(long& sampleNum, TOI const& toi) {
38 return getValue(--sampleNum, toi);
39}
40
41double TOIPullProducer::getNextValue(long& sampleNum, TOI const& toi) {
42 return getValue(++sampleNum, toi);
43}
44
45
46long TOIPullProducer::firstSampleNum(TOI const& toi) {
47 long xx = -999999999L;
[555]48 map<TOI, TOIProducer*> & m = neededTOIs[toi];
[534]49 for (map<TOI, TOIProducer*>::iterator i = m.begin(); i != m.end(); i++) {
50 long x = (*i).second->firstSampleNum((*i).first) + needBefore;
51 if (x > xx) xx=x;
52 }
53 return xx;
54}
55
56long TOIPullProducer::lastSampleNum(TOI const& toi) {
57 long xx = 999999999L;
[555]58 map<TOI, TOIProducer*> & m = neededTOIs[toi];
[534]59 for (map<TOI, TOIProducer*>::iterator i = m.begin(); i != m.end(); i++) {
60 long x = (*i).second->lastSampleNum((*i).first) - needAfter;
61 if (x < xx) xx=x;
62 }
63 return xx;
64}
65
66void TOIPullProducer::propagateLowBound(TOI const& toi, long sampleNum) {
67 CHKPROD
[555]68 map<TOI, TOIProducer*> & need = neededTOIs[toi];
[534]69 for (map<TOI, TOIProducer*>::iterator i = need.begin(); i != need.end(); i++) {
70 (*i).second->wontNeedEarlier((*i).first, this, sampleNum-needBefore);
71 }
72}
Note: See TracBrowser for help on using the repository browser.