bpp-seq3  3.0.0
BppOAlphabetIndex2Format.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_SEQ_IO_BPPOALPHABETINDEX2FORMAT_H
6 #define BPP_SEQ_IO_BPPOALPHABETINDEX2FORMAT_H
7 
8 #include <Bpp/Io/IoFormat.h>
9 
10 #include "../AlphabetIndex/AlphabetIndex2.h"
11 #include "../GeneticCode/GeneticCode.h"
12 
13 // From the STL:
14 #include <string>
15 
16 namespace bpp
17 {
27  public virtual IOFormat
28 {
29 private:
30  std::shared_ptr<const Alphabet> alphabet_;
31  std::shared_ptr<const GeneticCode> gencode_;
32 
33  std::string message_;
34  bool verbose_;
35 
36 public:
44  std::shared_ptr<const Alphabet>& alphabet,
45  const std::string& message,
46  bool verbose = true) :
47  alphabet_(alphabet),
48  gencode_(0),
49  message_(message),
50  verbose_(verbose)
51  {}
52 
54  std::shared_ptr<const CodonAlphabet>& alphabet,
55  std::shared_ptr<const GeneticCode>& gencode,
56  const std::string& message,
57  bool verbose = true) :
58  alphabet_(alphabet),
59  gencode_(gencode),
60  message_(message),
61  verbose_(verbose)
62  {}
63 
65  alphabet_(format.alphabet_),
66  gencode_(format.gencode_),
67  message_(format.message_),
68  verbose_(format.verbose_) {}
69 
71  {
72  alphabet_ = format.alphabet_;
73  gencode_ = format.gencode_;
74  message_ = format.message_;
75  verbose_ = format.verbose_;
76  return *this;
77  }
78 
80 
81 public:
82  const std::string getFormatName() const { return "BppO"; }
83 
84  const std::string getFormatDescription() const { return "Bpp Options format."; }
85 
86  const std::string getDataType() const { return "AlphabetIndex2"; }
87 
95  std::unique_ptr<AlphabetIndex2> read(const std::string& description);
96 };
97 } // end of namespace bpp.
98 #endif // BPP_SEQ_IO_BPPOALPHABETINDEX2FORMAT_H
AlphabetIndex2 I/O in BppO format.
const std::string getFormatName() const
std::shared_ptr< const GeneticCode > gencode_
std::unique_ptr< AlphabetIndex2 > read(const std::string &description)
Read a AlphabetIndex2 object from a string.
BppOAlphabetIndex2Format(const BppOAlphabetIndex2Format &format)
const std::string getFormatDescription() const
BppOAlphabetIndex2Format(std::shared_ptr< const CodonAlphabet > &alphabet, std::shared_ptr< const GeneticCode > &gencode, const std::string &message, bool verbose=true)
BppOAlphabetIndex2Format(std::shared_ptr< const Alphabet > &alphabet, const std::string &message, bool verbose=true)
std::shared_ptr< const Alphabet > alphabet_
const std::string getDataType() const
BppOAlphabetIndex2Format & operator=(const BppOAlphabetIndex2Format &format)
This alphabet is used to deal NumericAlphabet.