bpp-phyl3 3.0.0
NexusIoTree.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_IO_NEXUSIOTREE_H
6#define BPP_PHYL_IO_NEXUSIOTREE_H
7
8
9#include "../Tree/PhyloTree.h"
10#include "../Tree/TreeTemplate.h"
11#include "IoTree.h"
12
13namespace bpp
14{
28 public virtual AbstractITree,
29 public virtual AbstractOTree,
30 public virtual AbstractIMultiTree,
31 public virtual AbstractOMultiTree,
32 public AbstractIPhyloTree,
33 public AbstractOPhyloTree,
36{
37public:
42
43 virtual ~NexusIOTree() {}
44
45public:
51 const std::string getFormatName() const override;
52 const std::string getFormatDescription() const override;
53 /* @} */
54
61
62 std::unique_ptr<TreeTemplate<Node>> readTreeTemplate(std::istream& in) const override;
63
65
66 std::unique_ptr<PhyloTree> readPhyloTree(std::istream& in) const override;
67
76
77 void writeTree(const Tree& tree, std::ostream& out) const override
78 {
79 write_(tree, out);
80 }
81
83
84 void writePhyloTree(const PhyloTree& tree, std::ostream& out) const override
85 {
86 write_(tree, out);
87 }
96
97 void readTrees(std::istream& in, std::vector<std::unique_ptr<Tree>>& trees) const override;
98
100
101 void readPhyloTrees(std::istream& in, std::vector<std::unique_ptr<PhyloTree>>& trees) const override;
110
111 void writeTrees(const std::vector<const Tree*>& trees, std::ostream& out) const override
112 {
113 write_(trees, out);
114 }
115
117
118 void writePhyloTrees(const std::vector<const PhyloTree*>& trees, std::ostream& out) const override
119 {
120 write_(trees, out);
121 }
124protected:
125 void write_(const Tree& tree, std::ostream& out) const;
126
127 void write_(const PhyloTree& tree, std::ostream& out) const;
128
129 template<class N>
130 void write_(const TreeTemplate<N>& tree, std::ostream& out) const;
131
132 void write_(const std::vector<const Tree*>& trees, std::ostream& out) const;
133
134 void write_(const std::vector<const PhyloTree*>& trees, std::ostream& out) const;
135
136 template<class N>
137 void write_(const std::vector<TreeTemplate<N>*>& trees, std::ostream& out) const;
138};
139} // end of namespace bpp.
140#endif // BPP_PHYL_IO_NEXUSIOTREE_H
Partial implementation of the IMultiTree interface.
Definition: IoTree.h:477
virtual void readPhyloTrees(std::istream &in, std::vector< std::unique_ptr< PhyloTree > > &trees) const override=0
Read trees from a stream.
Partial implementation of the IMultiTree interface.
Definition: IoTree.h:456
virtual void readTrees(std::istream &in, std::vector< std::unique_ptr< Tree > > &trees) const override=0
Read trees from a stream.
std::unique_ptr< PhyloTree > readPhyloTree(std::istream &in) const override=0
Read a tree from a stream.
Partial implementation of the ITree interface.
Definition: IoTree.h:189
virtual std::unique_ptr< TreeTemplate< Node > > readTreeTemplate(std::istream &in) const =0
Partial implementation of the OTree interface.
Definition: IoTree.h:520
virtual void writePhyloTrees(const std::vector< const PhyloTree * > &trees, std::ostream &out) const =0
Write trees to a stream.
Partial implementation of the OTree interface.
Definition: IoTree.h:498
virtual void writeTrees(const std::vector< const Tree * > &trees, std::ostream &out) const =0
Write trees to a stream.
Partial implementation of the OTree interface.
Definition: IoTree.h:290
virtual void writePhyloTree(const PhyloTree &tree, std::ostream &out) const =0
Write a tree to a stream.
Partial implementation of the OTree interface.
Definition: IoTree.h:256
virtual void writeTree(const Tree &tree, std::ostream &out) const =0
Write a tree to a stream.
a simple parser for reading trees from a Nexus file.
Definition: NexusIoTree.h:36
void writePhyloTree(const PhyloTree &tree, std::ostream &out) const override
Write a tree to a stream.
Definition: NexusIoTree.h:84
void writeTrees(const std::vector< const Tree * > &trees, std::ostream &out) const override
Write trees to a stream.
Definition: NexusIoTree.h:111
std::unique_ptr< PhyloTree > readPhyloTree(std::istream &in) const override
Read a tree from a stream.
const std::string getFormatDescription() const override
Definition: NexusIoTree.cpp:36
virtual ~NexusIOTree()
Definition: NexusIoTree.h:43
void readPhyloTrees(std::istream &in, std::vector< std::unique_ptr< PhyloTree > > &trees) const override
Read trees from a stream.
void readTrees(std::istream &in, std::vector< std::unique_ptr< Tree > > &trees) const override
Read trees from a stream.
Definition: NexusIoTree.cpp:57
void writeTree(const Tree &tree, std::ostream &out) const override
Write a tree to a stream.
Definition: NexusIoTree.h:77
void writePhyloTrees(const std::vector< const PhyloTree * > &trees, std::ostream &out) const override
Write trees to a stream.
Definition: NexusIoTree.h:118
void write_(const Tree &tree, std::ostream &out) const
NexusIOTree()
Build a new Nexus tree parser.
Definition: NexusIoTree.h:41
std::unique_ptr< TreeTemplate< Node > > readTreeTemplate(std::istream &in) const override
Definition: NexusIoTree.cpp:45
const std::string getFormatName() const override
Definition: NexusIoTree.cpp:32
The phylogenetic tree class.
Definition: TreeTemplate.h:59
Interface for phylogenetic tree objects.
Definition: Tree.h:115
Defines the basic types of data flow nodes.