bpp-phyl3  3.0.0
PhyloLikelihoodFormula.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_LIKELIHOOD_PHYLOLIKELIHOODS_FORMULAOFPHYLOLIKELIHOOD_H
6 #define BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_FORMULAOFPHYLOLIKELIHOOD_H
7 
9 
10 #include "PhyloLikelihoodSet.h"
11 
12 namespace bpp
13 {
23 {
24 private:
25  std::unique_ptr<ComputationTree> compTree_;
26 
27  std::shared_ptr<LikelihoodCalculation> likCal_;
28 
29 public:
30  PhyloLikelihoodFormula(Context& context, std::shared_ptr<PhyloLikelihoodContainer> pC, const std::string& formula, bool inCollection = true);
31 
33 
34 protected:
39  compTree_(sd.compTree_->clone()),
40  likCal_(sd.likCal_)
41  {}
42 
44  {
46  compTree_.reset(sd.compTree_->clone());
47  likCal_ = sd.likCal_;
48  return *this;
49  }
50 
51 
53  {
54  return new PhyloLikelihoodFormula(*this);
55  }
56 
57 public:
63  void readFormula(const std::string& formula, bool inCollection = true);
64 
70  std::string output() const;
71 
76  {
77  return *likCal_;
78  }
79 
80  std::shared_ptr<LikelihoodCalculation> getLikelihoodCalculation() const
81  {
82  return likCal_;
83  }
84 
85 private:
91  {
92  return makeLikelihoodsFromOperator(compTree_->getRoot());
93  }
94 
100  ValueRef<DataLik> makeLikelihoodsFromOperator(std::shared_ptr<Operator> op);
101 };
102 } // end of namespace bpp.
103 #endif // BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_FORMULAOFPHYLOLIKELIHOOD_H
The PhyloLikelihoodSet class, to manage a subset of PhyloLikelihoods from a given PhyloLikelihoodCont...
AbstractPhyloLikelihoodSet & operator=(const AbstractPhyloLikelihoodSet &sd)
const Context & context() const override
Context for dataflow node construction.
Definition: DataFlow.h:527
The PhyloLikelihoodFormula class, for phylogenetic likelihood on several independent data.
std::unique_ptr< ComputationTree > compTree_
PhyloLikelihoodFormula(const PhyloLikelihoodFormula &sd)
ValueRef< DataLik > makeLikelihoods()
Build the LikelihoodNode from the computation Tree.
PhyloLikelihoodFormula(Context &context, std::shared_ptr< PhyloLikelihoodContainer > pC, const std::string &formula, bool inCollection=true)
LikelihoodCalculation & likelihoodCalculation() const
void readFormula(const std::string &formula, bool inCollection=true)
PhyloLikelihoodFormula & operator=(const PhyloLikelihoodFormula &sd)
ValueRef< DataLik > makeLikelihoodsFromOperator(std::shared_ptr< Operator > op)
Build the LikelihoodNode from a node of the computation Tree.
PhyloLikelihoodFormula * clone() const
std::shared_ptr< LikelihoodCalculation > getLikelihoodCalculation() const
std::shared_ptr< LikelihoodCalculation > likCal_
Defines the basic types of data flow nodes.
std::shared_ptr< Value< T > > ValueRef
Shared pointer alias for Value<T>.
Definition: DataFlow.h:84