bpp-seq3  3.0.0
Transliterator.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_TRANSLITERATOR_H
6 #define BPP_SEQ_TRANSLITERATOR_H
7 
8 
9 #include "Alphabet/Alphabet.h"
10 #include "Sequence.h"
11 
12 namespace bpp
13 {
18 {
19 public:
22 
23 public:
29  virtual std::shared_ptr<const Alphabet> getSourceAlphabet() const = 0;
30 
36  virtual const Alphabet& sourceAlphabet() const = 0;
37 
43  virtual std::shared_ptr<const Alphabet> getTargetAlphabet() const = 0;
44 
50  virtual const Alphabet& targetAlphabet() const = 0;
51 
58  virtual int translate(int state) const = 0;
59 
66  virtual std::string translate(const std::string& state) const = 0;
67 
74  virtual std::unique_ptr<Sequence> translate(const SequenceInterface& sequence) const = 0;
75 };
76 
81  public virtual TransliteratorInterface
82 {
83 public:
86 
87 public:
94  virtual int reverse(int state) const = 0;
95 
102  virtual std::string reverse(const std::string& state) const = 0;
103 
110  virtual std::unique_ptr<Sequence> reverse(const SequenceInterface& sequence) const = 0;
111 };
112 
117  public virtual TransliteratorInterface
118 {
119 public:
122 
123 public:
124  int translate(int state) const override = 0;
125  std::string translate(const std::string& state) const override = 0;
126 
127  std::unique_ptr<Sequence> translate(const SequenceInterface& sequence) const override;
128 };
129 
134  public virtual ReverseTransliteratorInterface,
136 {
137 public:
140 
141 public:
142  int reverse(int state) const override = 0;
143  std::string reverse(const std::string& state) const override = 0;
144 
145  std::unique_ptr<Sequence> reverse(const SequenceInterface& sequence) const override;
146 };
147 } // end of namespace bpp.
148 #endif // BPP_SEQ_TRANSLITERATOR_H
Partial implementation of the ReverseTransliterator interface.
std::string reverse(const std::string &state) const override=0
Translate a given state coded as a string from target alphabet to source alphabet.
int reverse(int state) const override=0
Translate a given state coded as a int from target alphabet to source alphabet.
Partial implementation of the Transliterator interface.
std::string translate(const std::string &state) const override=0
Translate a given state coded as a string from source alphabet to target alphabet.
int translate(int state) const override=0
Translate a given state coded as a int from source alphabet to target alphabet.
The Alphabet interface.
Definition: Alphabet.h:99
The same as previous, but can perform the reverse translation, eg: RNA -> DNA and DNA -> RNA;.
virtual int reverse(int state) const =0
Translate a given state coded as a int from target alphabet to source alphabet.
virtual std::unique_ptr< Sequence > reverse(const SequenceInterface &sequence) const =0
Translate a whole sequence from target alphabet to source alphabet.
virtual std::string reverse(const std::string &state) const =0
Translate a given state coded as a string from target alphabet to source alphabet.
The sequence interface.
Definition: Sequence.h:34
This interface is used when translating a sequence from an alphabet to another: it gives the translat...
virtual std::shared_ptr< const Alphabet > getTargetAlphabet() const =0
Get the target alphabet.
virtual std::shared_ptr< const Alphabet > getSourceAlphabet() const =0
Get the source alphabet.
virtual std::unique_ptr< Sequence > translate(const SequenceInterface &sequence) const =0
Translate a whole sequence from source alphabet to target alphabet.
virtual const Alphabet & sourceAlphabet() const =0
Get the source alphabet.
virtual std::string translate(const std::string &state) const =0
Translate a given state coded as a string from source alphabet to target alphabet.
virtual const Alphabet & targetAlphabet() const =0
Get the target alphabet.
virtual int translate(int state) const =0
Translate a given state coded as a int from source alphabet to target alphabet.
This alphabet is used to deal NumericAlphabet.