1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : ali_pathmap.hxx // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Institute of Microbiology (Technical University Munich) // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // =============================================================== // |
---|
10 | |
---|
11 | #ifndef ALI_PATHMAP_HXX |
---|
12 | #define ALI_PATHMAP_HXX |
---|
13 | |
---|
14 | #ifndef ALI_TARRAY_HXX |
---|
15 | #include "ali_tarray.hxx" |
---|
16 | #endif |
---|
17 | |
---|
18 | #define ALI_UNDEF 0x00 |
---|
19 | #define ALI_LEFT 0x01 |
---|
20 | #define ALI_DIAG 0x02 |
---|
21 | #define ALI_UP 0x04 |
---|
22 | #define ALI_LUP 0x08 |
---|
23 | |
---|
24 | // Structure for a long up pointer (a multi gap) |
---|
25 | struct ali_pathmap_up_pointer { |
---|
26 | unsigned long start; |
---|
27 | unsigned char operation; |
---|
28 | }; |
---|
29 | |
---|
30 | class ALI_PATHMAP : virtual Noncopyable { |
---|
31 | unsigned long width, height; |
---|
32 | unsigned long height_real; |
---|
33 | unsigned char **pathmap; |
---|
34 | ALI_TARRAY<ali_pathmap_up_pointer> ****up_pointers; |
---|
35 | unsigned char **optimized; |
---|
36 | |
---|
37 | public: |
---|
38 | |
---|
39 | ALI_PATHMAP(unsigned long width, unsigned long height); |
---|
40 | ~ALI_PATHMAP(); |
---|
41 | |
---|
42 | void set(unsigned long x, unsigned long y, unsigned char val, ALI_TARRAY<ali_pathmap_up_pointer> *up_pointer = NULp); |
---|
43 | void get(unsigned long x, unsigned long y, unsigned char *val, ALI_TARRAY<ali_pathmap_up_pointer> **up_pointer); |
---|
44 | unsigned char get_value(unsigned long x, unsigned long y) { |
---|
45 | if (x >= width || y >= height) |
---|
46 | ali_fatal_error("Out of range", "ALI_PATHMAP::get_value()"); |
---|
47 | if (y & 0x01) |
---|
48 | return (*pathmap)[x*height_real + y/2] & 0x0f; |
---|
49 | else |
---|
50 | return (*pathmap)[x*height_real + y/2] >> 4; |
---|
51 | } |
---|
52 | void optimize(unsigned long x); |
---|
53 | void print(); |
---|
54 | }; |
---|
55 | |
---|
56 | #else |
---|
57 | #error ali_pathmap.hxx included twice |
---|
58 | #endif // ALI_PATHMAP_HXX |
---|