1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/* -*- c++ -*- */
/*
* Copyright 2013-2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gnuradio/fec/generic_encoder.h>
#include <gnuradio/prefs.h>
#include <stdio.h>
namespace gr {
namespace fec {
generic_encoder::generic_encoder(std::string name)
{
d_name = name;
my_id = base_unique_id++;
#ifdef ENABLE_GR_LOG
#ifdef HAVE_LOG4CPP
prefs *p = prefs::singleton();
std::string config_file = p->get_string("LOG", "log_config", "");
std::string log_level = p->get_string("LOG", "log_level", "off");
std::string log_file = p->get_string("LOG", "log_file", "");
GR_CONFIG_LOGGER(config_file);
GR_LOG_GETLOGGER(LOG, "gr_log." + alias());
GR_LOG_SET_LEVEL(LOG, log_level);
if(log_file.size() > 0) {
if(log_file == "stdout") {
GR_LOG_SET_CONSOLE_APPENDER(LOG, "cout","gr::log :%p: %c{1} - %m%n");
}
else if(log_file == "stderr") {
GR_LOG_SET_CONSOLE_APPENDER(LOG, "cerr","gr::log :%p: %c{1} - %m%n");
}
else {
GR_LOG_SET_FILE_APPENDER(LOG, log_file , true,"%r :%p: %c{1} - %m%n");
}
}
d_logger = LOG;
#endif /* HAVE_LOG4CPP */
#else /* ENABLE_GR_LOG */
d_logger = NULL;
#endif /* ENABLE_GR_LOG */
}
generic_encoder::~generic_encoder()
{
}
const char*
generic_encoder::get_input_conversion()
{
return "none";
}
const char*
generic_encoder::get_output_conversion()
{
return "none";
}
int generic_encoder::base_unique_id = 1;
int
generic_encoder::unique_id()
{
return my_id;
}
/*******************************************************
* Static functions
******************************************************/
int
get_encoder_output_size(generic_encoder::sptr my_encoder)
{
return my_encoder->get_output_size();
}
int
get_encoder_input_size(generic_encoder::sptr my_encoder)
{
return my_encoder->get_input_size();
}
const char*
get_encoder_input_conversion(generic_encoder::sptr my_encoder)
{
return my_encoder->get_input_conversion();
}
const char*
get_encoder_output_conversion(generic_encoder::sptr my_encoder)
{
return my_encoder->get_output_conversion();
}
} /* namespace fec */
} /* namespace gr */
|