1 
2 /******************************************************************************
3  *
4  *  This file is part of canu, a software program that assembles whole-genome
5  *  sequencing reads into contigs.
6  *
7  *  This software is based on:
8  *    'Celera Assembler' r4587 (http://wgs-assembler.sourceforge.net)
9  *    the 'kmer package' r1994 (http://kmer.sourceforge.net)
10  *
11  *  Except as indicated otherwise, this is a 'United States Government Work',
12  *  and is released in the public domain.
13  *
14  *  File 'README.licenses' in the root directory of this distribution
15  *  contains full conditions and disclaimers.
16  */
17 
18 #include "runtime.H"
19 #include "sqStore.H"
20 #include "ovStore.H"
21 #include "tgStore.H"
22 
23 #include <set>
24 
25 class overlapReadCache {
26 public:
27   overlapReadCache(sqStore *seqStore_, uint64 memLimit);
28   ~overlapReadCache();
29 
30 private:
31   void         loadRead(uint32 id);
32   void         loadReads(std::set<uint32> reads);
33   void         markForLoading(std::set<uint32> &reads, uint32 id);
34 
35 public:
36   void         loadReads(ovOverlap *ovl, uint32 nOvl);
37   void         loadReads(tgTig *tig);
38 
39   void         purgeReads(void);
40 
getRead(uint32 id)41   char        *getRead(uint32 id) {
42     assert(readLen[id] > 0);
43     return(readSeqFwd[id]);
44   };
45 
getLength(uint32 id)46   uint32       getLength(uint32 id) {
47     assert(readLen[id] > 0);
48     return(readLen[id]);
49   };
50 
51 private:
52   sqStore     *seqStore;
53   uint32       nReads;
54 
55   uint32      *readAge;
56   uint32      *readLen;
57   char       **readSeqFwd;
58 
59   sqRead       read;
60 
61   uint64       memoryLimit;
62 };
63 
64 
65 
66