Debian Codegraph @

atac-driver/alignOverlap/overlap-span.H

raw symbols SCIP
1 // This file is part of A2Amapper.cxx . . $ `<file>/atac-driver/alignOverlap/overlap-span.H`/
2 // Copyright (c) 2005 J. Craig Venter Institute
3 // Author: Brian Walenz
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received (LICENSE.txt) a copy of the GNU General Public
16 // License along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 #ifndef OVERLAP_SPAN_H
20 #define OVERLAP_SPAN_Hcxx . . $ `atac-driver/alignOverlap/overlap-span.H:20:9`!
21
22 #include "overlap.H"cxx . . $ `<file>/atac-driver/alignOverlap/overlap.H`/
23
24 #define COLORSHIFTcxx . . $ `atac-driver/alignOverlap/overlap-span.H:24:9`! 24
25 #define COLORMASKcxx . . $ `atac-driver/alignOverlap/overlap-span.H:25:9`! 0x00ffffff
26
27 class span_tcxx . . $ span_t# {
28 public:
29 uint32cxx . . $ uint32# _iidcxx . . $ span_t#_iid.;
30 uint32cxx . . $ uint32# _begcxx . . $ span_t#_beg.;
31 uint32cxx . . $ uint32# _endcxx . . $ span_t#_end.;
32 uint32cxx . . $ uint32# _matchesLencxx . . $ span_t#_matchesLen.;
33 uint32cxx . . $ uint32# _matchesMaxcxx . . $ span_t#_matchesMax.;
34 uint32cxx . . $ uint32# *_matchescxx . . $ span_t#_matches.;
35
36 span_tcxx . . $ span_t#span_t(6df00707c193238d).(uint32cxx . . $ uint32# iid, uint32cxx . . $ uint32# beg, uint32cxx . . $ uint32# end) {
37 _iidcxx . . $ span_t#_iid. = iid;
38 _begcxx . . $ span_t#_beg. = beg;
39 _endcxx . . $ span_t#_end. = end;
40 _matchesLencxx . . $ span_t#_matchesLen. = 0;
41 _matchesMaxcxx . . $ span_t#_matchesMax. = 0;
42 _matchescxx . . $ span_t#_matches. = 0L;
43 };
44
45 ~cxx . . $ span_t#`~span_t`(ced63f7c635d850d).span_tcxx . . $ span_t#() {
46 delete [] _matchescxx . . $ span_t#_matches.;
47 };
48
49 // The top X bits of the _matches is for storing the color. This
50 // does cut down the number of matches we can store. Human-Human
51 // is ~1 million matches.
52
53 void addMatchcxx . . $ span_t#addMatch(b4d55b1286ff73e8).(uint32cxx . . $ uint32# matchiid, uint32cxx . . $ uint32# color) {
54 if (_matchesLencxx . . $ span_t#_matchesLen. >= _matchesMaxcxx . . $ span_t#_matchesMax.) {
55 if (_matchesMaxcxx . . $ span_t#_matchesMax. == 0)
56 _matchesMaxcxx . . $ span_t#_matchesMax. = 2;
57 _matchesMaxcxx . . $ span_t#_matchesMax. *= 2;
58 uint32cxx . . $ uint32# *X = new uint32cxx . . $ uint32# [_matchesMaxcxx . . $ span_t#_matchesMax.];
59 memcpy(X, _matchescxx . . $ span_t#_matches., sizeof(uint32cxx . . $ uint32#) * _matchesLencxx . . $ span_t#_matchesLen.);
60 delete [] _matchescxx . . $ span_t#_matches.;
61 _matchescxx . . $ span_t#_matches. = X;
62 }
63
64 if (matchiid >> COLORSHIFTcxx . . $ `atac-driver/alignOverlap/overlap-span.H:24:9`!)
65 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR! span_t::addMatch()-- match id too big, decrease the color space.\n"), exitcxx . . $ exit(44ed87f96534fad7).(1);
66
67 _matchescxx . . $ span_t#_matches.[_matchesLencxx . . $ span_t#_matchesLen.++] = (color << COLORSHIFTcxx . . $ `atac-driver/alignOverlap/overlap-span.H:24:9`!) | (matchiid);
68 };
69
70 // Split this span at position, return two new spans
71 //
72 void splitcxx . . $ span_t#split(5bc8c286f40965a5).(uint32cxx . . $ uint32# position, span_tcxx . . $ span_t#* &l, span_tcxx . . $ span_t#* &r) {
73
74 if ((position < _begcxx . . $ span_t#_beg.) || (_endcxx . . $ span_t#_end. < position)) {
75 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "span_t::split()-- _beg="uint32FMTcxx . . $ `libutil/util.h:65:10`!" _end="uint32FMTcxx . . $ `libutil/util.h:65:10`!" postition="uint32FMTcxx . . $ `libutil/util.h:65:10`!"?\n", _begcxx . . $ span_t#_beg., _endcxx . . $ span_t#_end., position);
76 exitcxx . . $ exit(44ed87f96534fad7).(1);
77 }
78
79 l = new span_tcxx . . $ span_t#(_iidcxx . . $ span_t#_iid., _begcxx . . $ span_t#_beg., position);
80 r = new span_tcxx . . $ span_t#(_iidcxx . . $ span_t#_iid., position, _endcxx . . $ span_t#_end.);
81
82 l->_matchesLencxx . . $ span_t#_matchesLen. = _matchesLencxx . . $ span_t#_matchesLen.;
83 l->_matchesMaxcxx . . $ span_t#_matchesMax. = _matchesMaxcxx . . $ span_t#_matchesMax.;
84 l->_matchescxx . . $ span_t#_matches. = new uint32cxx . . $ uint32# [_matchesMaxcxx . . $ span_t#_matchesMax.];
85 memcpy(l->_matchescxx . . $ span_t#_matches., _matchescxx . . $ span_t#_matches., sizeof(uint32cxx . . $ uint32#) * _matchesLencxx . . $ span_t#_matchesLen.);
86
87 r->_matchesLencxx . . $ span_t#_matchesLen. = _matchesLencxx . . $ span_t#_matchesLen.;
88 r->_matchesMaxcxx . . $ span_t#_matchesMax. = _matchesMaxcxx . . $ span_t#_matchesMax.;
89 r->_matchescxx . . $ span_t#_matches. = new uint32cxx . . $ uint32# [_matchesMaxcxx . . $ span_t#_matchesMax.];
90 memcpy(r->_matchescxx . . $ span_t#_matches., _matchescxx . . $ span_t#_matches., sizeof(uint32cxx . . $ uint32#) * _matchesLencxx . . $ span_t#_matchesLen.);
91 };
92 };
93
94 #endif // OPERLAP_SPAN_H