| 1 | // ==================================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : probe_match_parser.hxx // |
|---|
| 4 | // Purpose : parse the results of a probe match // |
|---|
| 5 | // // |
|---|
| 6 | // // |
|---|
| 7 | // Coded by Ralf Westram (coder@reallysoft.de) in June 2004 // |
|---|
| 8 | // Copyright Department of Microbiology (Technical University Munich) // |
|---|
| 9 | // // |
|---|
| 10 | // Visit our web site at: http://www.arb-home.de/ // |
|---|
| 11 | // // |
|---|
| 12 | // ==================================================================== // |
|---|
| 13 | |
|---|
| 14 | #ifndef PROBE_MATCH_PARSER_HXX |
|---|
| 15 | #define PROBE_MATCH_PARSER_HXX |
|---|
| 16 | |
|---|
| 17 | #ifndef ARBTOOLS_H |
|---|
| 18 | #include <arbtools.h> |
|---|
| 19 | #endif |
|---|
| 20 | |
|---|
| 21 | // -------------------------------------------------------------------------------- |
|---|
| 22 | // helper class to parse probe match results |
|---|
| 23 | |
|---|
| 24 | class ProbeMatch_impl; |
|---|
| 25 | |
|---|
| 26 | class ProbeMatchParser : virtual Noncopyable { |
|---|
| 27 | ProbeMatch_impl *pimpl; |
|---|
| 28 | char *init_error; |
|---|
| 29 | |
|---|
| 30 | public: |
|---|
| 31 | ProbeMatchParser(const char *probe_target, const char *headline); |
|---|
| 32 | ~ProbeMatchParser(); |
|---|
| 33 | |
|---|
| 34 | const char *get_error() const { return init_error; } |
|---|
| 35 | bool is_gene_result() const; |
|---|
| 36 | int get_probe_region_offset() const; |
|---|
| 37 | |
|---|
| 38 | bool getColumnRange(const char *columnName, int *startCol, int *endCol) const; |
|---|
| 39 | |
|---|
| 40 | friend class ParsedProbeMatch; |
|---|
| 41 | }; |
|---|
| 42 | |
|---|
| 43 | class ParsedProbeMatch : virtual Noncopyable { |
|---|
| 44 | const ProbeMatchParser& parser; |
|---|
| 45 | char *match; |
|---|
| 46 | mutable const char *error; |
|---|
| 47 | public: |
|---|
| 48 | |
|---|
| 49 | ParsedProbeMatch(const char *match_, const ProbeMatchParser& parser_); |
|---|
| 50 | ~ParsedProbeMatch(); |
|---|
| 51 | |
|---|
| 52 | const char *get_error() const { return error; } |
|---|
| 53 | int get_position() const; |
|---|
| 54 | const char *get_probe_region() const; |
|---|
| 55 | |
|---|
| 56 | char *get_column_content(const char *columnName, bool chop_spaces) const; |
|---|
| 57 | }; |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | #else |
|---|
| 61 | #error probe_match_parser.hxx included twice |
|---|
| 62 | #endif // PROBE_MATCH_PARSER_HXX |
|---|
| 63 | |
|---|