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