bpp-phyl3  3.0.0
AbstractTreeParsimonyData.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_PHYL_PARSIMONY_ABSTRACTTREEPARSIMONYDATA_H
6 #define BPP_PHYL_PARSIMONY_ABSTRACTTREEPARSIMONYDATA_H
7 
8 
9 #include "TreeParsimonyData.h"
10 
11 namespace bpp
12 {
32  public virtual TreeParsimonyDataInterface
33 {
34 protected:
35  std::vector<size_t> rootPatternLinks_;
36  std::vector<unsigned int> rootWeights_;
37  std::shared_ptr<const TreeTemplate<Node>> tree_;
38 
39 public:
42  rootWeights_(),
43  tree_(tree)
44  {}
45 
49  tree_(atpd.tree_)
50  {}
51 
53  {
56  tree_ = atpd.tree_;
57  return *this;
58  }
59 
60 
62 
63 public:
64  size_t getRootArrayPosition(size_t site) const override
65  {
66  return rootPatternLinks_[site];
67  }
68 
69  unsigned int getWeight(size_t pos) const
70  {
71  return rootWeights_[pos];
72  }
73 
74  const TreeTemplate<Node>& tree() const override { return *tree_; }
75 
76  std::shared_ptr<const TreeTemplate<Node>> getTree() const override { return tree_; }
77 
78 protected:
79  void setTree(std::shared_ptr<const TreeTemplate<Node>> tree) { tree_ = tree; }
80 };
81 } // end of namespace bpp.
82 #endif // BPP_PHYL_PARSIMONY_ABSTRACTTREEPARSIMONYDATA_H
Partial implementation of the TreeParsimonyData interface.
const TreeTemplate< Node > & tree() const override
std::shared_ptr< const TreeTemplate< Node > > getTree() const override
void setTree(std::shared_ptr< const TreeTemplate< Node >> tree)
size_t getRootArrayPosition(size_t site) const override
std::shared_ptr< const TreeTemplate< Node > > tree_
AbstractTreeParsimonyData & operator=(const AbstractTreeParsimonyData &atpd)
AbstractTreeParsimonyData(std::shared_ptr< const TreeTemplate< Node >> tree)
AbstractTreeParsimonyData(const AbstractTreeParsimonyData &atpd)
std::vector< unsigned int > rootWeights_
unsigned int getWeight(size_t pos) const
TreeParsimonyScore data structure.
The phylogenetic tree class.
Definition: TreeTemplate.h:59
Defines the basic types of data flow nodes.