bpp-phyl3  3.0.0
SubstitutionMapping.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_SUBSTITUTIONMAPPING_H
6 #define BPP_PHYL_MAPPING_SUBSTITUTIONMAPPING_H
7 
8 #include <Bpp/Clonable.h>
9 
10 #include "Mapping.h"
11 
12 // From the STL:
13 #include <vector>
14 #include <memory>
15 
16 namespace bpp
17 {
30  public virtual MappingInterface
31 {
32 public:
34  virtual ~SubstitutionMapping() {}
35 
36  SubstitutionMapping* clone() const override = 0;
37 
38 public:
42  virtual size_t getNumberOfSubstitutionTypes() const = 0;
43  virtual void setNumberOfSubstitutionTypes(size_t numberOfTypes) = 0;
44 
45  virtual double& operator()(unsigned int branchId, size_t siteIndex, size_t type) = 0;
46  virtual const double& operator()(unsigned int branchId, size_t siteIndex, size_t type) const = 0;
47 };
48 
49 
56  virtual public SubstitutionMapping,
57  virtual public AbstractMapping
58 {
59 private:
61 
62 public:
64 
67 
69 
71  {
74 
75  return *this;
76  }
77 
79 
81  {
82  return numberOfTypes_;
83  }
84 
85  virtual void setNumberOfSubstitutionTypes(size_t numberOfTypes)
86  {
87  numberOfTypes_ = numberOfTypes;
88  }
89 };
90 } // end of namespace bpp.
91 #endif // BPP_PHYL_MAPPING_SUBSTITUTIONMAPPING_H
Partial implementation of the mapping interface.
Definition: Mapping.h:79
AbstractMapping & operator=(const AbstractMapping &absm)=default
Partial implementation of the substitution mapping interface.
AbstractSubstitutionMapping(const AbstractSubstitutionMapping &absm)
AbstractSubstitutionMapping & operator=(const AbstractSubstitutionMapping &absm)
AbstractSubstitutionMapping * clone() const =0
virtual void setNumberOfSubstitutionTypes(size_t numberOfTypes)
General interface for storing mapping data.
Definition: Mapping.h:26
General interface for storing mapping data.
virtual void setNumberOfSubstitutionTypes(size_t numberOfTypes)=0
virtual size_t getNumberOfSubstitutionTypes() const =0
SubstitutionMapping * clone() const override=0
virtual const double & operator()(unsigned int branchId, size_t siteIndex, size_t type) const =0
virtual double & operator()(unsigned int branchId, size_t siteIndex, size_t type)=0
Defines the basic types of data flow nodes.