bpp-phyl3  3.0.0
SingleDataPhyloLikelihood.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_SINGLEDATAPHYLOLIKELIHOOD_H
6 #define BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_SINGLEDATAPHYLOLIKELIHOOD_H
7 
8 
9 // From bpp-seq:
12 
13 // from bpp-core
14 
16 
17 #include "AlignedPhyloLikelihood.h"
18 
19 namespace bpp
20 {
29  public virtual AlignedPhyloLikelihoodInterface
30 {
31 public:
34 
36 
37 public:
50  virtual void setData(std::shared_ptr<const AlignmentDataInterface> sites, size_t nData = 0) = 0;
51 
57  virtual std::shared_ptr<const AlignmentDataInterface> getData() const = 0;
58 
62  virtual size_t getNData() const = 0;
63 
67  virtual size_t getNumberOfStates() const = 0;
68 
74  virtual std::shared_ptr<const Alphabet> getAlphabet() const = 0;
75 
79 };
80 
81 
84  public virtual AbstractAlignedPhyloLikelihood
85 {
86 protected:
87  size_t nbStates_;
88 
92  size_t nData_;
93 
94 public:
95  AbstractSingleDataPhyloLikelihood(Context& context, size_t nbSites, size_t nbStates, size_t nData = 0) :
98  nbStates_(nbStates),
99  nData_(nData)
100  {}
101 
105  nbStates_(asdpl.nbStates_),
106  nData_(asdpl.nData_)
107  {}
108 
110  {
112  nbStates_ = asdpl.nbStates_;
113  nData_ = asdpl.nData_;
114  return *this;
115  }
116 
118 
119  virtual void setData(std::shared_ptr<const AlignmentDataInterface> sites, size_t nData = 0)
120  {
121  setNumberOfSites(sites->getNumberOfSites());
122  nbStates_ = sites->alphabet().getSize();
123  nData_ = nData;
124  }
125 
126  size_t getNData() const
127  {
128  return nData_;
129  }
130 
131  void setNData(size_t nData)
132  {
133  nData_ = nData;
134  }
135 
136  size_t getNumberOfStates() const { return nbStates_; }
137 };
138 } // end of namespace bpp.
139 #endif // BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_SINGLEDATAPHYLOLIKELIHOOD_H
AbstractAlignedPhyloLikelihood & operator=(const AbstractAlignedPhyloLikelihood &aasd)
const Context & context() const override
AbstractSingleDataPhyloLikelihood & operator=(const AbstractSingleDataPhyloLikelihood &asdpl)
virtual void setData(std::shared_ptr< const AlignmentDataInterface > sites, size_t nData=0)
Set the dataset for which the likelihood must be evaluated.
AbstractSingleDataPhyloLikelihood(const AbstractSingleDataPhyloLikelihood &asdpl)
size_t getNumberOfStates() const
Get the number the states.
size_t getNData() const
Get the number of dataset concerned.
size_t nData_
Number of the concerned data.
AbstractSingleDataPhyloLikelihood(Context &context, size_t nbSites, size_t nbStates, size_t nData=0)
The AlignedPhyloLikelihood interface, for phylogenetic likelihood.
Context for dataflow node construction.
Definition: DataFlow.h:527
The SingleDataPhyloLikelihood interface, for phylogenetic likelihood.
virtual std::shared_ptr< const AlignmentDataInterface > getData() const =0
Get the dataset for which the likelihood must be evaluated.
virtual size_t getNData() const =0
Get the number of dataset concerned.
virtual size_t getNumberOfStates() const =0
Get the number the states.
virtual SingleDataPhyloLikelihoodInterface * clone() const =0
virtual void setData(std::shared_ptr< const AlignmentDataInterface > sites, size_t nData=0)=0
Set the dataset for which the likelihood must be evaluated.
virtual std::shared_ptr< const Alphabet > getAlphabet() const =0
Get the alphabet associated to the dataset.
Defines the basic types of data flow nodes.