Imported Upstream version 3.0
[debian/gnuradio] / gr-trellis / src / lib / fsm.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2002 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #ifndef INCLUDED_TRELLIS_FSM_H
24 #define INCLUDED_TRELLIS_FSM_H
25
26 #include <vector>
27
28 /*!
29  * \brief  FSM class
30  */
31 class fsm {
32 private:
33   int d_I;
34   int d_S;
35   int d_O;
36   std::vector<int> d_NS;
37   std::vector<int> d_OS;
38   std::vector<int> d_PS;
39   std::vector<int> d_PI;
40   std::vector<int> d_TMi;
41   std::vector<int> d_TMl;
42   void generate_PS_PI ();
43   void generate_TM ();
44   bool find_es(int es);
45 public:
46   fsm();
47   fsm(const fsm &FSM);
48   fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS);
49   fsm(const char *name);
50   fsm(int k, int n, const std::vector<int> &G);
51   fsm(int mod_size, int ch_length);
52   int I () const { return d_I; }
53   int S () const { return d_S; }
54   int O () const { return d_O; }
55   const std::vector<int> & NS () const { return d_NS; }
56   const std::vector<int> & OS () const { return d_OS; }
57   const std::vector<int> & PS () const { return d_PS; }
58   const std::vector<int> & PI () const { return d_PI; }
59   const std::vector<int> & TMi () const { return d_TMi; }
60   const std::vector<int> & TMl () const { return d_TMl; }
61 };
62
63 #endif