- refactored
git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@500 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -34,7 +34,8 @@ list(APPEND jay_sources
|
||||
bit_packer_impl.cc
|
||||
add_impl.cc
|
||||
peak_detect_impl.cc
|
||||
message_debug_impl.cc )
|
||||
message_debug_impl.cc
|
||||
squelch_impl.cc )
|
||||
|
||||
set(jay_sources "${jay_sources}" PARENT_SCOPE)
|
||||
if(NOT jay_sources)
|
||||
|
||||
@@ -55,7 +55,47 @@ namespace gr {
|
||||
*/
|
||||
message_debug_impl::~message_debug_impl()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void message_debug_impl::print_pair(pmt::pmt_t pair)
|
||||
{
|
||||
pmt::pmt_t key = pmt::car(pair);
|
||||
pmt::pmt_t val = pmt::cdr(pair);
|
||||
if (pmt::is_integer(val))
|
||||
{
|
||||
fprintf(stderr, "[%s=%d]", pmt::symbol_to_string(key).c_str(), (int) pmt::to_long(val));
|
||||
}
|
||||
else if (pmt::is_real(val))
|
||||
{
|
||||
fprintf(stderr, "[%s=%f]", pmt::symbol_to_string(key).c_str(), pmt::to_float(val));
|
||||
}
|
||||
else if (pmt::is_bool(val))
|
||||
{
|
||||
fprintf(stderr, "[%s=%d]", pmt::symbol_to_string(key).c_str(), pmt::to_bool(val));
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
void message_debug_impl::set_msg(pmt::pmt_t msg)
|
||||
{
|
||||
if (pmt::is_pair(msg))
|
||||
{
|
||||
print_pair(msg);
|
||||
}
|
||||
else if (pmt::is_dict(msg))
|
||||
{
|
||||
pmt::pmt_t items = pmt::dict_items(msg);
|
||||
for (int i = 0; i < pmt::length(items); i++)
|
||||
{
|
||||
pmt::pmt_t pair = pmt::nth(i, items);
|
||||
print_pair(pair);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s\n", pmt::symbol_to_string(msg).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
message_debug_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required)
|
||||
|
||||
@@ -33,40 +33,8 @@ namespace gr {
|
||||
pmt::pmt_t m_msg_port_in;
|
||||
pmt::pmt_t m_msg_port_out;
|
||||
|
||||
void set_msg(pmt::pmt_t msg)
|
||||
{
|
||||
if (pmt::is_dict(msg))
|
||||
{
|
||||
pmt::pmt_t items = pmt::dict_items(msg);
|
||||
for (int i=0; i < pmt::length(items); i++)
|
||||
{
|
||||
pmt::pmt_t pair = pmt::nth(i, items);
|
||||
|
||||
pmt::pmt_t key = pmt::car(pair);
|
||||
pmt::pmt_t val = pmt::cdr(pair);
|
||||
if (pmt::is_integer(val))
|
||||
{
|
||||
fprintf(stderr, "[%s=%d]", pmt::symbol_to_string(key).c_str(), (int)pmt::to_long(val));
|
||||
}
|
||||
else if (pmt::is_real(val))
|
||||
{
|
||||
fprintf(stderr, "[%s=%f]", pmt::symbol_to_string(key).c_str(), pmt::to_float(val));
|
||||
}
|
||||
else if (pmt::is_bool(val))
|
||||
{
|
||||
fprintf(stderr, "[%s=%d]", pmt::symbol_to_string(key).c_str(), pmt::to_bool(val));
|
||||
}
|
||||
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s\n", pmt::symbol_to_string(msg).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void print_pair(pmt::pmt_t pair);
|
||||
|
||||
public:
|
||||
message_debug_impl();
|
||||
~message_debug_impl();
|
||||
@@ -78,6 +46,8 @@ namespace gr {
|
||||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
|
||||
void set_msg(pmt::pmt_t msg);
|
||||
};
|
||||
|
||||
} // namespace jay
|
||||
|
||||
Reference in New Issue
Block a user