bpp-phyl3  3.0.0
WeightedSubstitutionCount.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_MAPPING_WEIGHTEDSUBSTITUTIONCOUNT_H
6 #define BPP_PHYL_MAPPING_WEIGHTEDSUBSTITUTIONCOUNT_H
7 
8 
9 #include "SubstitutionCount.h"
10 
11 // From bpp-seq:
14 
15 namespace bpp
16 {
27  public virtual SubstitutionCountInterface
28 {
29 public:
30  virtual void setWeights(std::shared_ptr<const AlphabetIndex2> index) = 0;
31  virtual bool hasWeights() const = 0;
32  virtual std::shared_ptr<const AlphabetIndex2> getWeights() const = 0;
33 };
34 
39  public virtual WeightedSubstitutionCount
40 {
41 protected:
42  std::shared_ptr<const AlphabetIndex2> weights_;
43 
44 public:
45  AbstractWeightedSubstitutionCount(std::shared_ptr<const AlphabetIndex2> weights) :
46  weights_(weights)
47  {}
48 
50  weights_(index.weights_)
51  {}
52 
54  {
55  weights_ = index.weights_;
56 
57  return *this;
58  }
59 
61  {}
62 
63 public:
64  void setWeights(std::shared_ptr<const AlphabetIndex2> weights);
65  bool hasWeights() const { return weights_.get() != 0; }
66  std::shared_ptr<const AlphabetIndex2> getWeights() const { return weights_; }
67 
68 protected:
69  virtual void weightsHaveChanged() = 0;
70 };
71 } // end of namespace bpp.
72 #endif // BPP_PHYL_MAPPING_WEIGHTEDSUBSTITUTIONCOUNT_H
Partial implementation of the WeightedSubstitutionCount interface.
AbstractWeightedSubstitutionCount(std::shared_ptr< const AlphabetIndex2 > weights)
AbstractWeightedSubstitutionCount & operator=(const AbstractWeightedSubstitutionCount &index)
std::shared_ptr< const AlphabetIndex2 > getWeights() const
AbstractWeightedSubstitutionCount(const AbstractWeightedSubstitutionCount &index)
void setWeights(std::shared_ptr< const AlphabetIndex2 > weights)
std::shared_ptr< const AlphabetIndex2 > weights_
The SubstitutionsCount interface.
Interface allowing for weighting of substitution counts according to state properties.
virtual bool hasWeights() const =0
virtual std::shared_ptr< const AlphabetIndex2 > getWeights() const =0
virtual void setWeights(std::shared_ptr< const AlphabetIndex2 > index)=0
Defines the basic types of data flow nodes.