|
bpp-phyl
2.1.0
|
00001 // 00002 // File: AbstractTreeLikelihoodData.h 00003 // Created by: Julien Dutheil 00004 // Created on: Sat Dec 30 12:48 2006 00005 // From file AbstractTreeLikelihood.h 00006 // 00007 00008 /* 00009 Copyright or © or Copr. CNRS, (November 16, 2004) 00010 00011 This software is a computer program whose purpose is to provide classes 00012 for phylogenetic data analysis. 00013 00014 This software is governed by the CeCILL license under French law and 00015 abiding by the rules of distribution of free software. You can use, 00016 modify and/ or redistribute the software under the terms of the CeCILL 00017 license as circulated by CEA, CNRS and INRIA at the following URL 00018 "http://www.cecill.info". 00019 00020 As a counterpart to the access to the source code and rights to copy, 00021 modify and redistribute granted by the license, users are provided only 00022 with a limited warranty and the software's author, the holder of the 00023 economic rights, and the successive licensors have only limited 00024 liability. 00025 00026 In this respect, the user's attention is drawn to the risks associated 00027 with loading, using, modifying and/or developing or reproducing the 00028 software by the user in light of its specific status of free software, 00029 that may mean that it is complicated to manipulate, and that also 00030 therefore means that it is reserved for developers and experienced 00031 professionals having in-depth computer knowledge. Users are therefore 00032 encouraged to load and test the software's suitability as regards their 00033 requirements in conditions enabling the security of their systems and/or 00034 data to be ensured and, more generally, to use and operate it in the 00035 same conditions as regards security. 00036 00037 The fact that you are presently reading this means that you have had 00038 knowledge of the CeCILL license and that you accept its terms. 00039 */ 00040 00041 #ifndef _ABSTRACTTREELIKELIHOODDATA_H_ 00042 #define _ABSTRACTTREELIKELIHOODDATA_H_ 00043 00044 #include "TreeLikelihoodData.h" 00045 00046 //From the STL: 00047 #include <vector> 00048 #include <map> 00049 00050 namespace bpp 00051 { 00052 00071 class AbstractTreeLikelihoodData : 00072 public TreeLikelihoodData 00073 { 00074 protected: 00086 std::vector<size_t> rootPatternLinks_; 00087 00091 std::vector<unsigned int> rootWeights_; 00092 00093 const TreeTemplate<Node>* tree_; 00094 00095 const Alphabet* alphabet_; 00096 00097 public: 00098 AbstractTreeLikelihoodData(const TreeTemplate<Node>* tree): 00099 rootPatternLinks_(), rootWeights_(), tree_(tree), alphabet_(0) {} 00100 00101 AbstractTreeLikelihoodData(const AbstractTreeLikelihoodData& atd) : 00102 rootPatternLinks_(atd.rootPatternLinks_), 00103 rootWeights_(atd.rootWeights_), 00104 tree_(atd.tree_), 00105 alphabet_(atd.alphabet_) 00106 {} 00107 00108 AbstractTreeLikelihoodData& operator=(const AbstractTreeLikelihoodData& atd) 00109 { 00110 rootPatternLinks_ = atd.rootPatternLinks_; 00111 rootWeights_ = atd.rootWeights_; 00112 tree_ = atd.tree_; 00113 alphabet_ = atd.alphabet_; 00114 return *this; 00115 } 00116 00117 00118 virtual ~AbstractTreeLikelihoodData() {} 00119 00120 public: 00121 std::vector<size_t>& getRootArrayPositions() { return rootPatternLinks_; } 00122 const std::vector<size_t>& getRootArrayPositions() const { return rootPatternLinks_; } 00123 size_t getRootArrayPosition(const size_t site) const 00124 { 00125 return rootPatternLinks_[site]; 00126 } 00127 unsigned int getWeight(size_t pos) const 00128 { 00129 return rootWeights_[pos]; 00130 } 00131 const std::vector<unsigned int>& getWeights() const 00132 { 00133 return rootWeights_; 00134 } 00135 00136 const Alphabet* getAlphabet() const { return alphabet_; } 00137 00138 const TreeTemplate<Node>* getTree() const { return tree_; } 00139 00140 }; 00141 00142 } //end of namespace bpp. 00143 00144 #endif //_ABSTRACTTREELIKELIHOODDATA_H_ 00145