bpp-phyl3  3.0.0
AbstractFromSubstitutionModelTransitionModel.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_MODEL_ABSTRACTFROMSUBSTITUTIONMODELTRANSITIONMODEL_H
6 #define BPP_PHYL_MODEL_ABSTRACTFROMSUBSTITUTIONMODELTRANSITIONMODEL_H
7 
8 
9 #include "AbstractWrappedModel.h"
10 
11 namespace bpp
12 {
20  public virtual AbstractWrappedTransitionModel
21 {
22 protected:
26  std::unique_ptr<SubstitutionModelInterface> subModel_;
27 
31  size_t size_;
32 
39 
40  std::string nestedPrefix_;
41 
42 public:
44  std::unique_ptr<SubstitutionModelInterface> subModel,
45  const std::string& prefix);
46 
48 
50 
52 
53 public:
55  {
56  return *subModel_;
57  }
58 
59  const TransitionModelInterface& transitionModel() const override
60  {
61  return *subModel_;
62  }
63 
64  const BranchModelInterface& model() const override
65  {
66  return *subModel_;
67  }
68 
69  bool computeFrequencies() const override
70  {
71  return subModel_->computeFrequencies();
72  }
73 
78  void computeFrequencies(bool yn) override
79  {
80  subModel_->computeFrequencies(yn);
81  }
82 
83 
84 protected:
86  {
87  return subModel_->getFrequencies_();
88  }
89 
91  {
92  return *subModel_;
93  }
94 
95 
97  {
98  return *subModel_;
99  }
100 
102  {
103  return *subModel_;
104  }
105 
106 public:
107  virtual void addRateParameter() override
108  {
111  }
112 
113  virtual void fireParameterChanged(const ParameterList& parameters) override
114  {
116  model_().matchParametersValues(parameters);
117  }
118 
119  virtual void setNamespace(const std::string& prefix) override
120  {
122  model_().setNamespace(prefix + nestedPrefix_);
123  }
124 };
125 } // end of namespace bpp.
126 #endif // BPP_PHYL_MODEL_ABSTRACTFROMSUBSTITUTIONMODELTRANSITIONMODEL_H
Virtual class of a Transition Model related to a given SubstitutionModel.
const TransitionModelInterface & transitionModel() const override
virtual void fireParameterChanged(const ParameterList &parameters) override
std::unique_ptr< SubstitutionModelInterface > subModel_
The related model.
AbstractFromSubstitutionModelTransitionModel & operator=(const AbstractFromSubstitutionModelTransitionModel &fmsm)
void addParameter_(Parameter *parameter)
void setNamespace(const std::string &prefix)
virtual void fireParameterChanged(const ParameterList &parameters)
std::string getNamespace() const override
Interface for all Branch models.
virtual double getRate() const =0
Get the rate.
virtual void addRateParameter()=0
static const std::shared_ptr< IntervalConstraint > R_PLUS_STAR
virtual bool matchParametersValues(const ParameterList &parameters)=0
virtual void setNamespace(const std::string &prefix)=0
Interface for all substitution models.
Interface for all transition models.
Defines the basic types of data flow nodes.
std::vector< double > Vdouble