-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathseqsource.cpp
65 lines (58 loc) · 1012 Bytes
/
seqsource.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "myutils.h"
#include "fastaseqsource.h"
#include "fastqseqsource.h"
#include "objmgr.h"
#include "seqinfo.h"
#include "filetype.h"
#include "seqdb.h"
#define TIME_LOCKS 0
#if TIME_LOCKS
#include "getticks.h"
static TICKS g_tLocks;
static TICKS g_tUnLocks;
#endif
SeqSource::SeqSource()
{
m_SI = ObjMgr::GetSeqInfo();
m_SeqCount = 0;
m_DoGetLock = true;
}
SeqSource::~SeqSource()
{
ObjMgr::Down(m_SI);
}
bool SeqSource::GetNext(SeqInfo *SI)
{
if (m_DoGetLock)
{
#if TIME_LOCKS
TICKS t1 = GetClockTicks();
#endif
LOCK_CLASS();
#if TIME_LOCKS
TICKS t2 = GetClockTicks();
g_tLocks += (t2 - t1);
#endif
}
bool Ok = GetNextLo(SI);
if (m_DoGetLock)
{
#if TIME_LOCKS
TICKS t1 = GetClockTicks();
#endif
UNLOCK_CLASS();
#if TIME_LOCKS
TICKS t2 = GetClockTicks();
g_tUnLocks += (t2 - t1);
#endif
}
if (!Ok)
{
#if TIME_LOCKS
Log("SeqSource locks %.3e, unlocks %.3e\n", double(g_tLocks), double(g_tUnLocks));
#endif
return false;
}
++m_SeqCount;
return true;
}