File: HitWrapper.h

package info (click to toggle)
rsem 1.3.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 37,668 kB
  • sloc: cpp: 19,230; perl: 1,326; python: 1,245; ansic: 547; makefile: 186; sh: 154
file content (35 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (5)
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_ */