File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,13 +47,37 @@ struct SequencePosition{
4747 }
4848};
4949
50- template <typename T>
51- struct __attribute__ ((__packed__))KmerPosition {
50+ template <bool Include>
51+ struct AdjacentSeqArray {
52+ void setAdjacentSeq (int index, const unsigned char val) {
53+ adjacentSeq[index] = val;
54+ }
55+ unsigned char getAdjacentSeq (int index) {
56+ return adjacentSeq[index];
57+ }
58+
59+ private:
60+ unsigned char adjacentSeq[6 ];
61+ };
62+
63+ // save memory when adjacent sequence is unused
64+ template <>
65+ struct AdjacentSeqArray <false > {
66+ void setAdjacentSeq (const int index, const unsigned char val) {
67+ Debug (Debug::ERROR) << " Invalid write attempt at adjacent sequence array" ;
68+ };
69+ unsigned char getAdjacentSeq (int index) {
70+ Debug (Debug::ERROR) << " Invalid read attempt at adjacent sequence array" ;
71+ return ' \0 ' ;
72+ }
73+ };
74+
75+ template <typename T, bool IncludeAdjacentSeq>
76+ struct __attribute__ ((__packed__))KmerPosition : public AdjacentSeqArray<IncludeAdjacentSeq> {
5277 size_t kmer;
5378 unsigned int id;
5479 T seqLen;
5580 T pos;
56- unsigned char adjacentSeq[6 ];
5781
5882 static bool compareRepSequenceAndIdAndPos (const KmerPosition<T> &first, const KmerPosition<T> &second){
5983 if (first.kmer < second.kmer )
You can’t perform that action at this time.
0 commit comments