bpp-core3  3.0.0
HmmStateAlphabet.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_NUMERIC_HMM_HMMSTATEALPHABET_H
6 #define BPP_NUMERIC_HMM_HMMSTATEALPHABET_H
7 
8 
9 #include "../../Exceptions.h"
10 #include "../Parametrizable.h"
11 #include "HmmExceptions.h"
12 
13 // From the STL:
14 #include <vector>
15 
16 // using namespace bpp;
17 
18 namespace bpp
19 {
20 class StateListener;
21 class StateChangedEvent;
22 
29  public virtual Parametrizable
30 {
31 public:
33  virtual ~HmmStateAlphabet() {}
34 
35  virtual HmmStateAlphabet* clone() const override = 0;
36 
37 public:
43  virtual const Clonable& getState(size_t stateIndex) const = 0;
44 
45 
46  virtual size_t getNumberOfStates() const = 0;
47 
56  virtual bool worksWith(const HmmStateAlphabet& stateAlphabet) const = 0;
57 };
58 
60 {
61 public:
63  virtual ~StateListener() {}
64 
65 public:
66  virtual void stateChanged(StateChangedEvent& event) = 0;
67 };
68 
70 {
71 protected:
72  std::vector<unsigned int> states_;
73 
74 public:
75  StateChangedEvent(unsigned int stateIndex) : states_(1)
76  {
77  states_[0] = stateIndex;
78  }
79  StateChangedEvent(std::vector<unsigned int>& states) : states_(states) {}
80 
81 public:
82  const std::vector<unsigned int>& getStates() const { return states_; }
83  std::vector<unsigned int>& getStates() { return states_; }
84 };
85 }
86 #endif // BPP_NUMERIC_HMM_HMMSTATEALPHABET_H
Hidden states alphabet.
virtual bool worksWith(const HmmStateAlphabet &stateAlphabet) const =0
Tell if this instance can work with the instance of alphabet given as input.
std::vector< unsigned int > & getStates()
const std::vector< unsigned int > & getStates() const
This is the interface for all objects that imply parameters.
std::vector< unsigned int > states_
StateChangedEvent(std::vector< unsigned int > &states)
virtual const Clonable & getState(size_t stateIndex) const =0
virtual HmmStateAlphabet * clone() const override=0
Create a copy of this object and send a pointer to it.
virtual size_t getNumberOfStates() const =0
The Clonable interface (allow an object to be cloned).
Definition: Clonable.h:63
StateChangedEvent(unsigned int stateIndex)