bpp-seq3  3.0.0
IoDistanceMatrixFactory.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
7 
8 using namespace bpp;
9 using namespace std;
10 
11 const std::string IODistanceMatrixFactory::PHYLIP_FORMAT = "Phylip";
12 
13 unique_ptr<IDistanceMatrix> IODistanceMatrixFactory::createReader(const std::string& format, bool extended)
14 {
15  if (format == PHYLIP_FORMAT)
16  return make_unique<PhylipDistanceMatrixFormat>(extended);
17  else
18  throw Exception("Format " + format + " is not supported for input.");
19 }
20 
21 unique_ptr<ODistanceMatrix> IODistanceMatrixFactory::createWriter(const std::string& format, bool extended)
22 {
23  if (format == PHYLIP_FORMAT)
24  {
25  return make_unique<PhylipDistanceMatrixFormat>(extended);
26  }
27  else
28  throw Exception("Format " + format + " is not supported for output.");
29 }
virtual std::unique_ptr< ODistanceMatrix > createWriter(const std::string &format, bool extended=false)
Get a new dynamically created ODistanceMatrix object.
virtual std::unique_ptr< IDistanceMatrix > createReader(const std::string &format, bool extended=false)
Get a new dynamically created IDistanceMatrix object.
static const std::string PHYLIP_FORMAT
This alphabet is used to deal NumericAlphabet.