ARB
AliView.cxx
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : AliView.cxx //
4 // Purpose : Defines a filtered view onto an alignment //
5 // //
6 // Coded by Ralf Westram (coder@reallysoft.de) in October 2009 //
7 // Institute of Microbiology (Technical University Munich) //
8 // http://www.arb-home.de/ //
9 // //
10 // =============================================================== //
11 
12 #include "AliView.hxx"
13 
14 #include <AP_filter.hxx>
15 
16 #define av_assert(cond) arb_assert(cond)
17 
18 using namespace std;
19 
20 void AliView::create_real_view(const AP_filter *filter_, const AP_weights *weights_, const char *aliname_) {
21  av_assert(!filter && !weights && !aliname);
22  av_assert(filter_ && weights_ && aliname_);
23 
24  filter = new AP_filter(*filter_);
25  weights = new AP_weights(*weights_);
26  aliname = strdup(aliname_);
27 
28  av_assert(filter->get_filtered_length() == weights->length());
29  av_assert(filter->was_checked_for_validity());
30 }
31 
32 
34  gb_main(gb_main_),
35  filter(NULp),
36  weights(NULp),
37  aliname(NULp)
38 {
39  // this creates a fake-AliView (used for AP_tree w/o sequence)
40 }
41 
42 AliView::AliView(GBDATA *gb_main_, const AP_filter& filter_, const AP_weights& weights_, const char *aliname_) :
43  gb_main(gb_main_),
44  filter(NULp),
45  weights(NULp),
46  aliname(NULp)
47 {
48  create_real_view(&filter_, &weights_, aliname_);
49 }
50 
51 AliView::AliView(const AliView& other) :
52  gb_main(other.gb_main),
53  filter(NULp),
54  weights(NULp),
55  aliname(NULp)
56 {
57  create_real_view(other.filter, other.weights, other.aliname);
58 }
59 
61  delete filter;
62  delete weights;
63  free(aliname);
64 }
65 
66 size_t AliView::get_length() const {
67  return filter->get_filtered_length();
68 }
69 
STL namespace.
static int weights[MAX_BASETYPES][MAX_BASETYPES]
Definition: ClustalV.cxx:71
#define av_assert(cond)
Definition: AliView.cxx:16
size_t get_filtered_length() const
Definition: AP_filter.hxx:82
~AliView()
Definition: AliView.cxx:60
AliView(GBDATA *gb_main_)
Definition: AliView.cxx:33
#define NULp
Definition: cxxforward.h:116
GBDATA * gb_main
Definition: adname.cxx:32
size_t get_length() const
Definition: AliView.cxx:66