bpp-core  2.2.0
HmmStateAlphabet.h
Go to the documentation of this file.
1 //
2 // File: HmmStateAlphabet.h
3 // Created by: Julien Dutheil
4 // Created on: Fri Oct 26 11:07 2007
5 //
6 
7 /*
8  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
9 
10  This software is a computer program whose purpose is to provide classes
11  for phylogenetic data analysis.
12 
13  This software is governed by the CeCILL license under French law and
14  abiding by the rules of distribution of free software. You can use,
15  modify and/ or redistribute the software under the terms of the CeCILL
16  license as circulated by CEA, CNRS and INRIA at the following URL
17  "http://www.cecill.info".
18 
19  As a counterpart to the access to the source code and rights to copy,
20  modify and redistribute granted by the license, users are provided only
21  with a limited warranty and the software's author, the holder of the
22  economic rights, and the successive licensors have only limited
23  liability.
24 
25  In this respect, the user's attention is drawn to the risks associated
26  with loading, using, modifying and/or developing or reproducing the
27  software by the user in light of its specific status of free software,
28  that may mean that it is complicated to manipulate, and that also
29  therefore means that it is reserved for developers and experienced
30  professionals having in-depth computer knowledge. Users are therefore
31  encouraged to load and test the software's suitability as regards their
32  requirements in conditions enabling the security of their systems and/or
33  data to be ensured and, more generally, to use and operate it in the
34  same conditions as regards security.
35 
36  The fact that you are presently reading this means that you have had
37  knowledge of the CeCILL license and that you accept its terms.
38 */
39 
40 #ifndef _HMMSTATEALPHABET_H_
41 #define _HMMSTATEALPHABET_H_
42 
43 #include "HmmExceptions.h"
44 #include "../Parametrizable.h"
45 #include "../../Exceptions.h"
46 
47 //From the STL:
48 #include <vector>
49 
50 //using namespace bpp;
51 
52 namespace bpp {
53 
54  class StateListener;
55  class StateChangedEvent;
56 
63  public virtual Parametrizable
64  {
65  public:
67  virtual ~HmmStateAlphabet() {}
68 
69  public:
75  virtual const Clonable& getState(size_t stateIndex) const throw (HmmBadStateException) = 0;
76 
77 
78  virtual size_t getNumberOfStates() const = 0;
79 
88  virtual bool worksWith(const HmmStateAlphabet* stateAlphabet) const = 0;
89 
90  };
91 
93  {
94  public:
96  virtual ~StateListener() {}
97 
98  public:
99  virtual void stateChanged(StateChangedEvent& event) = 0;
100  };
101 
103  {
104  protected:
105  std::vector<unsigned int> states_;
106 
107  public:
108  StateChangedEvent(unsigned int stateIndex): states_(1)
109  {
110  states_[0] = stateIndex;
111  }
112  StateChangedEvent(std::vector<unsigned int>& states): states_(states) {}
113 
114  public:
115  const std::vector<unsigned int>& getStates() const { return states_; }
116  std::vector<unsigned int>& getStates() { return states_; }
117 
118  };
119 
120 }
121 #endif //_HMMSTATEALPHABET_H_
122 
Hidden states alphabet.
virtual void stateChanged(StateChangedEvent &event)=0
This class allows to perform a correspondence analysis.
std::vector< unsigned int > & getStates()
virtual bool worksWith(const HmmStateAlphabet *stateAlphabet) const =0
Tell if this instance can work with the instance of alphabet given as input.
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 size_t getNumberOfStates() const =0
The Clonable interface (allow an object to be cloned).
Definition: Clonable.h:99
StateChangedEvent(unsigned int stateIndex)
Exception thrown when an unvalid state is requested.
Definition: HmmExceptions.h:55