5 #ifndef BPP_PHYL_IO_IODAGRAPH_H
6 #define BPP_PHYL_IO_IODAGRAPH_H
48 virtual const std::string
getDataType()
const {
return "DAG"; }
69 virtual std::unique_ptr<PhyloDAG>
readPhyloDAG(
const std::string& path)
const = 0;
78 virtual std::unique_ptr<PhyloDAG>
readPhyloDAG(std::istream& in)
const = 0;
104 virtual void writePhyloDAG(
const PhyloDAG& dag,
const std::string& path,
bool overwrite)
const = 0;
113 virtual void writePhyloDAG(
const PhyloDAG& dag, std::ostream& out)
const = 0;
128 std::unique_ptr<PhyloDAG>
readPhyloDAG(std::istream& in)
const override = 0;
130 std::unique_ptr<PhyloDAG>
readPhyloDAG(
const std::string& path)
const override
132 std::ifstream input(path.c_str(), std::ios::in);
134 throw IOException (
"AbstractIPhyloDAG::readPhyloDAG(path): failed to read from path " + path);
157 virtual void writePhyloDAG(
const PhyloDAG& dag, std::ostream& out)
const = 0;
158 virtual void writePhyloDAG(
const PhyloDAG& dag,
const std::string& path,
bool overwrite)
const
164 std::ofstream output(path.c_str(), overwrite ? (std::ios::out) : (std::ios::out | std::ios::app));
166 throw Exception(
"Problem opening file " + path +
"in writePhyloDAG.");
172 std::stringstream ss;
173 ss << e.
what() <<
"\nProblem writing dag to file " << path <<
"\n Is the file path correct and do \
174 you have the proper authorizations? ";
199 virtual void readPhyloDAGs(
const std::string& path, std::vector<std::unique_ptr<PhyloDAG>>& dags)
const = 0;
208 virtual void readPhyloDAGs(std::istream& in, std::vector<std::unique_ptr<PhyloDAG>>& dags)
const = 0;
231 const std::vector<const PhyloDAG*>& dags,
232 const std::string& path,
233 bool overwrite)
const = 0;
243 const std::vector<const PhyloDAG*>& dags,
244 std::ostream& out)
const = 0;
258 virtual void readPhyloDAGs(std::istream& in, std::vector<std::unique_ptr<PhyloDAG>>& dags)
const override = 0;
260 virtual void readPhyloDAGs(
const std::string& path, std::vector<std::unique_ptr<PhyloDAG>>& dags)
const override
262 std::ifstream input(path.c_str(), std::ios::in);
279 virtual void writePhyloDAGs(
const std::vector<const PhyloDAG*>& dags, std::ostream& out)
const = 0;
281 virtual void writePhyloDAGs(
const std::vector<const PhyloDAG*>& dags,
const std::string& path,
bool overwrite)
const
285 std::ofstream output(path.c_str(), overwrite ? (std::ios::out) : (std::ios::out | std::ios::app));
Partial implementation of the IMultiDAG interface.
virtual void readPhyloDAGs(std::istream &in, std::vector< std::unique_ptr< PhyloDAG >> &dags) const override=0
Read dags from a stream.
virtual ~AbstractIMultiPhyloDAG()
virtual void readPhyloDAGs(const std::string &path, std::vector< std::unique_ptr< PhyloDAG >> &dags) const override
Read dags from a file.
Partial implementation of the IDAG interface.
std::unique_ptr< PhyloDAG > readPhyloDAG(std::istream &in) const override=0
Read a DAG from a stream.
virtual Element getElement(const std::string &elt) const
virtual ~AbstractIPhyloDAG()
std::unique_ptr< PhyloDAG > readPhyloDAG(const std::string &path) const override
Read a DAG from a file.
Partial implementation of the ODAG interface.
virtual void writePhyloDAGs(const std::vector< const PhyloDAG * > &dags, std::ostream &out) const =0
Write dags to a stream.
virtual ~AbstractOMultiPhyloDAG()
virtual void writePhyloDAGs(const std::vector< const PhyloDAG * > &dags, const std::string &path, bool overwrite) const
Write dags to a file.
Partial implementation of the ODAG interface.
virtual ~AbstractOPhyloDAG()
virtual void writePhyloDAG(const PhyloDAG &dag, const std::string &path, bool overwrite) const
Write a DAG to a file.
virtual void writePhyloDAG(const PhyloDAG &dag, std::ostream &out) const =0
Write a PhyloDAG to a stream.
const char * what() const noexcept override
General interface for multiple trees readers.
virtual void readPhyloDAGs(const std::string &path, std::vector< std::unique_ptr< PhyloDAG >> &dags) const =0
Read dags from a file.
virtual void readPhyloDAGs(std::istream &in, std::vector< std::unique_ptr< PhyloDAG >> &dags) const =0
Read dags from a stream.
virtual ~IMultiPhyloDAG()
General interface for DAG I/O.
virtual const std::string getDataType() const
General interface for DAG readers.
virtual std::unique_ptr< PhyloDAG > readPhyloDAG(std::istream &in) const =0
Read a DAG from a stream.
virtual std::unique_ptr< PhyloDAG > readPhyloDAG(const std::string &path) const =0
Read a DAG from a file.
General interface for tree writers.
virtual void writePhyloDAGs(const std::vector< const PhyloDAG * > &dags, const std::string &path, bool overwrite) const =0
Write dags to a file.
virtual void writePhyloDAGs(const std::vector< const PhyloDAG * > &dags, std::ostream &out) const =0
Write dags to a stream.
virtual ~OMultiPhyloDAG()
General interface for DAG writers.
virtual void writePhyloDAG(const PhyloDAG &dag, std::ostream &out) const =0
Write a PhyloDAG to a stream.
virtual void writePhyloDAG(const PhyloDAG &dag, const std::string &path, bool overwrite) const =0
Write a DAG to a file.
Defines the basic types of data flow nodes.