-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaxonSet.h
48 lines (33 loc) · 1.17 KB
/
TaxonSet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef TAXONSET_H
#define TAXONSET_H
#include <map>
#include <string>
#include <iostream>
using namespace std;
class Tree;
class Link;
class TaxonSet {
public:
TaxonSet(const string* names, int ntaxa);
TaxonSet(const Tree* tree, const Link* subgroup = 0);
~TaxonSet();
int GetNtaxa() const;
string GetTaxon(int index) const;
int GetTaxonIndex(string intaxon) const;
int GetTaxonIndexWithIncompleteName(string intaxon) const;
void ToStream(ostream& os);
private:
void RecursiveGetSubSet(const Link* from, int& index);
int Ntaxa;
mutable map<string,int> taxmap;
string* taxlist;
};
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// * Inline definitions
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
inline int TaxonSet::GetNtaxa() const {return Ntaxa;}
inline string TaxonSet::GetTaxon(int index) const {return taxlist[index];}
inline int TaxonSet::GetTaxonIndex(string intaxon) const {return taxmap[intaxon]-1;}
#endif // TAXONSET_H