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