]> git.donarmstrong.com Git - rsem.git/blob - HitWrapper.h
Fixed a bug for calling pthread_join
[rsem.git] / HitWrapper.h
1 #ifndef HITWRAPPER_H_
2 #define HITWRAPPER_H_
3
4 #include "utils.h"
5 #include "HitContainer.h"
6
7 // assume each hit vector contains at least one hit
8
9 template<class HitType>
10 class HitWrapper {
11 public:
12         HitWrapper(int nThreads, HitContainer<HitType> **hitvs) {
13                 this->nThreads = nThreads;
14                 this->hitvs = hitvs;
15                 i = 0; j = 0;
16         }
17
18         HitType* getNextHit() {
19                 HitType *res;
20
21                 if (i >= nThreads) return NULL;
22                 res = &(hitvs[i]->getHitAt(j));
23                 ++j;
24                 if (j >= hitvs[i]->getNHits()) { ++i; j = 0; }
25
26                 return res;
27         }
28
29 private:
30         int i, nThreads;
31         HIT_INT_TYPE j;
32         HitContainer<HitType> **hitvs;
33 };
34
35 #endif /* HITWRAPPER_H_ */