GNU Radio's SATNOGS Package
morse_tree.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
4 *
5 * Copyright (C) 2016, 2019, Libre Space Foundation <http://libre.space>
6 *
7 * This program 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 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef INCLUDED_SATNOGS_MORSE_TREE_H
22#define INCLUDED_SATNOGS_MORSE_TREE_H
23
26#include <string>
27
28namespace gr {
29namespace satnogs {
30
31/*!
32 * \brief Binary tree node containing the corresponding character
33 */
35{
36private:
37 const char d_char;
38 tree_node* d_left;
39 tree_node* d_right;
40
41public:
42 tree_node(char c);
43
45
47
49
51
52 char get_char();
53};
54
55/*!
56 * \brief A Binary tree representation of the Morse coding scheme.
57 * Left transitions occur when a dot is received, whereas right transitions
58 * are performed during the reception of a dash.
59 *
60 * The tree follows the ITU International Morse code representation
61 * ITU-R M.1677-1
62 */
64{
65public:
66 morse_tree(size_t max_len = 128);
67 morse_tree(char unrecognized, size_t max_len = 128);
69 void reset();
71 std::string get_word();
72 size_t get_max_word_len() const;
73 size_t get_word_len();
74
75private:
76 const char d_unrecognized_symbol;
77 tree_node* d_root;
78 tree_node* d_current;
79 const size_t d_buff_len;
80 size_t d_word_len;
81 char* d_word_buffer;
82 gr::logger_ptr d_logger;
83
84 void construct_tree();
85 void delete_tree(tree_node* node);
86};
87
88} // namespace satnogs
89} // namespace gr
90
91#endif /* INCLUDED_SATNOGS_MORSE_TREE_H */
#define SATNOGS_API
Definition: api.h:19
A Binary tree representation of the Morse coding scheme. Left transitions occur when a dot is receive...
Definition: morse_tree.h:64
std::string get_word()
morse_tree(size_t max_len=128)
size_t get_max_word_len() const
bool received_symbol(morse_symbol_t s)
morse_tree(char unrecognized, size_t max_len=128)
Binary tree node containing the corresponding character.
Definition: morse_tree.h:35
tree_node * get_right_child()
tree_node * get_left_child()
void set_right_child(tree_node *child)
void set_left_child(tree_node *child)
data_t s[NROOTS]
Definition: decode_rs.h:75
morse_symbol_t
Definition: morse.h:28
Definition: amsat_duv_decoder.h:29