cawlign 0.0.1
Codon-aware pairwise sequence alignment
Loading...
Searching...
No Matches
stringBuffer.h
1#ifndef __STRINGBUFFER__
2#define __STRINGBUFFER__
3
4#include "alignment.h"
5
6//__________________________________________________________________________________________
7
9
10 char *sData;
11 unsigned long sLength, saLength;
12
13public:
14 StringBuffer(void);
15 ~StringBuffer(void);
16
17 char *getString(void) const { return sData; }
18 void appendChar(const char);
19 void appendBuffer(const char *, const long = -1);
20 void resetString(void);
21 void swap(StringBuffer &);
22 unsigned long length(void) const { return sLength; }
23 void reset_length(unsigned long newL) {
24 if (newL < sLength) {
25 sLength = newL;
26 }
27 }
28
29 char setChar(const long i, const char c) {
30 char oc = sData[i];
31 sData[i] = c;
32 return oc;
33 }
34
35 char getChar(const long i) const { return sData[i]; }
36 void flip (void);
37 void detach (void) { sData = nullptr;}
38
39 static long sbDefaultLength, sbDefaultBoost;
40};
41
42//__________________________________________________________________________________________
43
44class VectorFP {
45
46 cawlign_fp *vData;
47
48 unsigned long vLength, vaLength;
49
50public:
51 VectorFP(void);
52 ~VectorFP(void);
53
54 void appendValue(const cawlign_fp);
55 void appendValues(const cawlign_fp*, long);
56 void storeValue(const cawlign_fp, const unsigned long);
57 cawlign_fp value(const long idx) { return vData[idx]; }
58 unsigned long length(void) const { return vLength; }
59 const cawlign_fp * values (void) {return vData;}
60 cawlign_fp * rvalues (void) {return vData;}
61
62 static long vDefaultLength, vDefaultBoost;
63};
64
65//__________________________________________________________________________________________
66
67class Vector {
68
69 long *vData;
70
71 unsigned long vLength, vaLength;
72
73public:
74 Vector(void);
75 ~Vector(void);
76
77 void appendValue(const long);
78 void appendVector(const Vector &);
79 long extractMin(VectorFP &);
80 void resetVector(void);
81 void remove(const unsigned long);
82 void storeValue(const long, const unsigned long);
83 void storeVector(const Vector &, const unsigned long);
84 void sort(void);
85 void swap(Vector &);
86 long value(const long idx) const;
87 unsigned long length(void) const { return vLength; }
88
89 static long vDefaultLength, vDefaultBoost;
90};
91
92#endif
Definition stringBuffer.h:8
void swap(StringBuffer &)
Definition stringBuffer.cc:44
void appendChar(const char)
Definition stringBuffer.cc:84
StringBuffer(void)
Definition stringBuffer.cc:27
void resetString(void)
Definition stringBuffer.cc:136
void flip(void)
Definition stringBuffer.cc:58
void appendBuffer(const char *, const long=-1)
Definition stringBuffer.cc:106
~StringBuffer(void)
Definition stringBuffer.cc:74
Definition stringBuffer.h:44
~VectorFP(void)
Definition stringBuffer.cc:377
void storeValue(const cawlign_fp, const unsigned long)
Definition stringBuffer.cc:440
VectorFP(void)
Definition stringBuffer.cc:365
void appendValue(const cawlign_fp)
Definition stringBuffer.cc:389
void appendValues(const cawlign_fp *, long)
Definition stringBuffer.cc:410
Definition stringBuffer.h:67
void appendVector(const Vector &)
Definition stringBuffer.cc:211
void storeVector(const Vector &, const unsigned long)
Definition stringBuffer.cc:266
void storeValue(const long, const unsigned long)
Definition stringBuffer.cc:227
long extractMin(VectorFP &)
Definition stringBuffer.cc:299
void swap(Vector &)
Definition stringBuffer.cc:163
void appendValue(const long)
Definition stringBuffer.cc:191
void resetVector(void)
Definition stringBuffer.cc:357
Vector(void)
Definition stringBuffer.cc:147
~Vector(void)
Definition stringBuffer.cc:177
long value(const long idx) const
Definition stringBuffer.cc:249
void remove(const unsigned long)
Definition stringBuffer.cc:281
void sort(void)
Definition stringBuffer.cc:345