File: ali_pathmap.hxx

package info (click to toggle)
arb 6.0.6-8
  • links: PTS, VCS
  • area: non-free
  • in suites: sid, trixie
  • size: 66,204 kB
  • sloc: ansic: 394,911; cpp: 250,290; makefile: 19,644; sh: 15,879; perl: 10,473; fortran: 6,019; ruby: 683; xml: 503; python: 53; awk: 32
file content (60 lines) | stat: -rw-r--r-- 2,034 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// =============================================================== //
//                                                                 //
//   File      : ali_pathmap.hxx                                   //
//   Purpose   :                                                   //
//                                                                 //
//   Institute of Microbiology (Technical University Munich)       //
//   http://www.arb-home.de/                                       //
//                                                                 //
// =============================================================== //

#ifndef ALI_PATHMAP_HXX
#define ALI_PATHMAP_HXX

#ifndef ALI_TARRAY_HXX
#include "ali_tarray.hxx"
#endif

#define ALI_UNDEF 0x00
#define ALI_LEFT        0x01
#define ALI_DIAG  0x02
#define ALI_UP    0x04
#define ALI_LUP   0x08

// Structure for a long up pointer (a multi gap)
struct ali_pathmap_up_pointer {
    unsigned long start;
    unsigned char operation;
};

class ALI_PATHMAP : virtual Noncopyable {
    unsigned long width, height;
    unsigned long height_real;
    unsigned char **pathmap;
    ALI_TARRAY<ali_pathmap_up_pointer> ****up_pointers;
    unsigned char **optimized;

public:

    ALI_PATHMAP(unsigned long width, unsigned long height);
    ~ALI_PATHMAP();

    void set(unsigned long x, unsigned long y, unsigned char val,
             ALI_TARRAY<ali_pathmap_up_pointer> *up_pointer = 0);
    void get(unsigned long x, unsigned long y, unsigned char *val,
             ALI_TARRAY<ali_pathmap_up_pointer> **up_pointer);
    unsigned char get_value(unsigned long x, unsigned long y) {
        if (x >= width || y >= height)
            ali_fatal_error("Out of range", "ALI_PATHMAP::get_value()");
        if (y & 0x01)
            return (*pathmap)[x*height_real + y/2] & 0x0f;
        else
            return (*pathmap)[x*height_real + y/2] >> 4;
    }
    void optimize(unsigned long x);
    void print();
};

#else
#error ali_pathmap.hxx included twice
#endif // ALI_PATHMAP_HXX