1 | // ================================================================ // |
---|
2 | // // |
---|
3 | // File : Location.h // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Coded by Ralf Westram (coder@reallysoft.de) in November 2006 // |
---|
7 | // Institute of Microbiology (Technical University Munich) // |
---|
8 | // http://www.arb-home.de/ // |
---|
9 | // // |
---|
10 | // ================================================================ // |
---|
11 | #ifndef LOCATION_H |
---|
12 | #define LOCATION_H |
---|
13 | |
---|
14 | #ifndef SMARTPTR_H |
---|
15 | #include <smartptr.h> |
---|
16 | #endif |
---|
17 | #ifndef _GLIBCXX_VECTOR |
---|
18 | #include <vector> |
---|
19 | #endif |
---|
20 | #ifndef _GLIBCXX_MAP |
---|
21 | #include <map> |
---|
22 | #endif |
---|
23 | #ifndef _GLIBCXX_STRING |
---|
24 | #include <string> |
---|
25 | #endif |
---|
26 | |
---|
27 | typedef std::map<std::string, std::string> stringMap; |
---|
28 | |
---|
29 | typedef std::vector<int> intVector; |
---|
30 | typedef std::vector<char> charVector; |
---|
31 | typedef std::vector<bool> boolVector; |
---|
32 | |
---|
33 | struct GEN_position; |
---|
34 | |
---|
35 | enum LocationJoinType { |
---|
36 | LJT_UNDEF, // undefined |
---|
37 | LJT_NOT_JOINED, // location does not contain multiple parts |
---|
38 | LJT_JOIN, // sequence data may be joined |
---|
39 | LJT_ORDER, // nothing is implied about the reasonableness about joining |
---|
40 | }; |
---|
41 | |
---|
42 | |
---|
43 | struct Location : public Noncopyable { |
---|
44 | Location() {} |
---|
45 | virtual ~Location() {} |
---|
46 | |
---|
47 | virtual int count() const = 0; |
---|
48 | virtual bool isInRange(long pos1, long pos2) const = 0; |
---|
49 | virtual void save(GEN_position *into, bool complementary) const = 0; |
---|
50 | virtual LocationJoinType getJoinType() const = 0; |
---|
51 | virtual std::string as_string() const = 0; |
---|
52 | |
---|
53 | GEN_position *create_GEN_position() const; |
---|
54 | }; |
---|
55 | |
---|
56 | typedef SmartPtr<Location> LocationPtr; |
---|
57 | |
---|
58 | LocationPtr parseLocation(const std::string& source); |
---|
59 | LocationPtr to_Location(const GEN_position *gp); |
---|
60 | |
---|
61 | #else |
---|
62 | #error Location.h included twice |
---|
63 | #endif // LOCATION_H |
---|
64 | |
---|