Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing boost format header #14

Open
wants to merge 4 commits into
base: maint-3.10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion grc/sandia_utils_rftap_encap.block.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# auto-generated by grc.converter

id: rftap_rftap_encap
id: sandia_rftap_rftap_encap
label: RFtap Encapsulation
category: '[Sandia]/Sandia Utilities'

Expand Down
24 changes: 8 additions & 16 deletions lib/block_buffer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <gnuradio/block_detail.h>
#include <gnuradio/buffer.h>
#include <gnuradio/io_signature.h>

#include <boost/format.hpp>
namespace gr {
namespace sandia_utils {

Expand Down Expand Up @@ -232,25 +232,17 @@ int block_buffer_impl::general_work(int noutput_items,
// reset to pont of last tag
d_read_idx = 0;
in_idx = tags.back().offset - nitems_read(0);
GR_LOG_DEBUG(d_logger,
boost::format("bad tags... starting buffer %d over at %d") %
d_reading % in_idx);
GR_LOG_DEBUG(d_logger,
boost::format("the size of overflow_tags is %ld") %
d_logger->debug("bad tags... starting buffer {} over at {}",
d_reading, in_idx);
d_logger->debug("the size of overflow_tags is {}",
overflow_tags.size());
if (overflow_tags.size()) {
GR_LOG_DEBUG(d_logger,
boost::format("the overflow tags value is %d") %
pmt::to_bool(overflow_tags[0].value));
d_logger->debug("the overflow tags value is {}",pmt::to_bool(overflow_tags[0].value));
}
GR_LOG_DEBUG(d_logger,
boost::format("the size of tags is %ld") % tags.size());
GR_LOG_DEBUG(d_logger,
boost::format("the abs_read index is %ld") %
d_buf[d_reading].abs_read_idx);
d_logger->debug("the size of tags is {}",tags.size());
d_logger->debug("the abs_read index is {}",d_buf[d_reading].abs_read_idx);
if (tags.size()) {
GR_LOG_DEBUG(d_logger,
boost::format("the tags[0] offset is %ld") %
d_logger->debug("the tags[0] offset is {}",
tags[0].offset);
}
continue;
Expand Down
1 change: 1 addition & 0 deletions lib/epoch_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <sys/time.h> /* struct timeval, gettimeofday */
#include <cmath> /* modf */
#include <iostream>
#include <cstdint>

namespace gr {
namespace sandia_utils {
Expand Down
1 change: 0 additions & 1 deletion lib/file_sink/file_writer_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "pmt/pmt.h"
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
#include <iostream>
#include <stdio.h>
#include <math.h> // pow
Expand Down
7 changes: 3 additions & 4 deletions lib/file_sink/file_writer_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/format.hpp>
#include <string>

namespace gr
Expand Down Expand Up @@ -145,10 +146,8 @@ namespace gr
d_rate = rate;
d_T = (double)d_nsamples / (double)d_rate;
} else {
GR_LOG_DEBUG(
d_logger,
boost::format(
"Invalid sampling rate %d. Rate must be greater than zero") %
d_logger->debug(
"Invalid sampling rate {}. Rate must be greater than zero",
rate);
}
}
Expand Down
12 changes: 6 additions & 6 deletions lib/file_sink/file_writer_bluefile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace gr {
void
file_writer_bluefile::open(std::string fname){
if (not d_initialized) {
GR_LOG_DEBUG(d_logger,boost::format("Opening bluefile %s") % d_filename);
d_logger->debug("Opening bluefile {}", d_filename);

// generate new object
try
Expand All @@ -50,7 +50,7 @@ namespace gr {
}
catch (const std::runtime_error& error)
{
GR_LOG_WARN(d_logger,boost::format("file sink bluefile runtime error on 'open': %s") % error.what());
d_logger->warn("file sink bluefile runtime error on 'open': {}",error.what());
return;
}

Expand Down Expand Up @@ -111,7 +111,7 @@ namespace gr {
{
if( d_initialized )
{
GR_LOG_DEBUG(d_logger,boost::format("Closing bluefile %s") % d_filename);
d_logger->debug("Closing bluefile {}",d_filename);

// close the file
try
Expand All @@ -124,7 +124,7 @@ namespace gr {
}
catch (const std::runtime_error& error)
{
GR_LOG_WARN(d_logger, boost::format("file sink bluefile flush and close runtime error: %s") % error.what());
d_logger->debug("file sink bluefile flush and close runtime error: {}", error.what());
}

d_initialized = false;
Expand All @@ -135,7 +135,7 @@ namespace gr {
{
if( !d_initialized )
{
GR_LOG_WARN(d_logger, "file sink bluefile: uninitialized writer, dropping data");
d_logger->warn("file sink bluefile: uninitialized writer, dropping data");
return nitems;
}

Expand All @@ -146,7 +146,7 @@ namespace gr {
}
catch (const std::runtime_error& error)
{
GR_LOG_WARN(d_logger, boost::format("file sink bluefile write error: %s") % error.what());
d_logger->warn("file sink bluefile write error: {}",error.what());
nwritten = nitems;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/file_sink/file_writer_raw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ namespace gr

void file_writer_raw::open( std::string fname )
{
GR_LOG_DEBUG(d_logger,boost::format("Opening file %s") % fname.c_str());
d_logger->debug("Opening file {}", fname.c_str());
d_outfile.open( fname.c_str(), std::ofstream::binary );
}

void file_writer_raw::close()
{
if( d_outfile.is_open() )
{
GR_LOG_DEBUG(d_logger,boost::format("Closing file %s") % d_filename);
d_logger->debug("Closing file {}", d_filename);
d_outfile.flush();
d_outfile.close();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/file_sink/file_writer_raw_header.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace gr

void file_writer_raw_header::open( std::string fname )
{
GR_LOG_DEBUG(d_logger,boost::format("Opening file %s") % fname.c_str());
d_logger->debug("Opening file {}",fname.c_str());
d_outfile.open( fname.c_str(), std::ofstream::binary );

// write header
Expand All @@ -52,7 +52,7 @@ namespace gr
{
if( d_outfile.is_open() )
{
GR_LOG_DEBUG(d_logger,boost::format("Closing file %s") % d_filename);
d_logger->debug("Closing file {}",d_filename);
d_outfile.flush();
d_outfile.close();
}
Expand Down
85 changes: 46 additions & 39 deletions lib/file_sink_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,10 @@ int file_sink_impl::work(int noutput_items,
d_ndiscard = (int)std::ceil((double)d_file_writer->get_rate() *
(1.0 - d_samp_time.epoch_frac()));
if (d_debug) {
GR_LOG_DEBUG(
d_logger,
boost::format(
"epoch_sec = %ld, epoch_frac = %0.6e, ndiscard = %d") %
d_samp_time.epoch_sec() % d_samp_time.epoch_frac() %
d_ndiscard);
std::ostringstream msg;
msg << boost::format("epoch_sec = %ld, epoch_frac = %0.6e, ndiscard = %d") %
d_samp_time.epoch_sec() % d_samp_time.epoch_frac() % d_ndiscard;
d_logger->debug(msg.str());
}
}

Expand All @@ -305,10 +303,11 @@ int file_sink_impl::work(int noutput_items,
if (d_issue_start) {
// start file writer if it has been closed
if (d_debug) {
GR_LOG_DEBUG(
d_logger,
boost::format("starting writer: sec = %ld, frac = %0.6e") %
d_samp_time.epoch_sec() % d_samp_time.epoch_frac());
std::ostringstream msg;
msg << boost::format("starting writer: sec = %ld, frac = %0.6e") %
d_samp_time.epoch_sec() % d_samp_time.epoch_frac();
d_logger->debug(msg.str());

}
d_file_writer->start(d_samp_time);
d_issue_start = false;
Expand Down Expand Up @@ -344,19 +343,19 @@ int file_sink_impl::work(int noutput_items,
// issue start if necessary
if (d_issue_start) {
if (d_debug) {
GR_LOG_DEBUG(d_logger,
boost::format(
std::ostringstream msg;
msg << boost::format(
"starting burst writer: sec = %ld, frac = %0.6e\n") %
d_samp_time.epoch_sec() % d_samp_time.epoch_frac());
d_samp_time.epoch_sec() % d_samp_time.epoch_frac();
d_logger->debug(msg.str());
}
d_file_writer->start(d_samp_time);
d_issue_start = false;
}

get_tags_in_range(burst_tags, 0, start, end, PMTCONSTSTR__eob());
if (burst_tags.size() or do_stop) {
GR_LOG_DEBUG(d_logger,
"Burst stop tag received. Stopping burst writer...\n");
d_logger->debug("Burst stop tag received. Stopping burst writer...\n");

// process all samples up to and including tag
nprocessed = burst_tags[0].offset - start + 1;
Expand Down Expand Up @@ -412,7 +411,7 @@ bool file_sink_impl::stop()
d_file_writer->stop();
} else {
if (d_msg_file.bad()) {
GR_LOG_DEBUG(d_logger, "d_msg_file had badbit set");
d_logger->debug("d_msg_file had badbit set");
}
d_msg_file.flush();
d_msg_file.close();
Expand Down Expand Up @@ -466,14 +465,16 @@ int file_sink_impl::do_handle_tags(std::vector<tag_t>& tags,
bool config_changed = false;

if (d_debug) {
GR_LOG_DEBUG(d_logger,
boost::format("Starting tag offset: %ld") % (starting_offset));
std::ostringstream msg;
msg << boost::format("Starting tag offset: %ld") % (starting_offset);
d_logger->debug(msg.str());
}
for (size_t tag_num = 0; tag_num < tags.size(); ++tag_num) {
if (d_debug) {
GR_LOG_DEBUG(d_logger,
boost::format("File Sink Tag %ld: key %s, offset %ld") %
tag_num % tags[tag_num].key % tags[tag_num].offset);
std::ostringstream msg;
msg << boost::format("File Sink Tag %ld: key %s, offset %ld") %
tag_num % tags[tag_num].key % tags[tag_num].offset;
d_logger->debug(msg.str());
}

// ensure tags that don't affect stream are processed first
Expand All @@ -483,17 +484,19 @@ int file_sink_impl::do_handle_tags(std::vector<tag_t>& tags,
// update delta
d_T = 1.0 / (double)d_file_writer->get_rate();
d_samp_time.set_T(d_T);
GR_LOG_DEBUG(d_logger,
boost::format("Sample rate set to %d Hz") %
d_file_writer->get_rate());
std::ostringstream msg;
msg << boost::format("Sample rate set to %d Hz") %
d_file_writer->get_rate();
d_logger->debug(msg.str());

config_changed = true;
change_offset = tags[tag_num].offset;
} else if (pmt::equal(tags[tag_num].key, PMTCONSTSTR__rx_freq())) {
d_file_writer->set_freq((uint64_t)pmt::to_double(tags[tag_num].value));
GR_LOG_DEBUG(d_logger,
boost::format("Frequency set to %d Hz") %
d_file_writer->get_freq());
std::ostringstream msg;
msg << boost::format("Frequency set to %d Hz") %
d_file_writer->get_freq();
d_logger->debug(msg.str());

config_changed = true;
change_offset = tags[tag_num].offset;
Expand All @@ -503,9 +506,10 @@ int file_sink_impl::do_handle_tags(std::vector<tag_t>& tags,
d_samp_time.set(pmt::to_uint64(pmt::tuple_ref(time_tuple, 0)),
pmt::to_double(pmt::tuple_ref(time_tuple, 1)),
1.0 / (double)d_file_writer->get_rate());
GR_LOG_DEBUG(d_logger,
boost::format("Updating time: (%ld, %0.6f)") %
(d_samp_time.epoch_sec()) % (d_samp_time.epoch_frac()));
std::ostringstream msg;
msg << boost::format("Updating time: (%ld, %0.6f)") %
(d_samp_time.epoch_sec()) % (d_samp_time.epoch_frac());
d_logger->debug(msg.str());

config_changed = true;
change_offset = tags[tag_num].offset;
Expand All @@ -519,14 +523,14 @@ int file_sink_impl::do_handle_tags(std::vector<tag_t>& tags,
// indicate a configuration change, and the last observed offset for a
// configuration change is the same as the starting offset
if (d_debug) {
GR_LOG_DEBUG(
d_logger,
boost::format("config changed %d, change offset %ld, writer started %d") %
config_changed % change_offset % d_file_writer->is_started());
std::ostringstream msg;
msg << boost::format("config changed %d, change offset %ld, writer started %d") %
config_changed % change_offset % d_file_writer->is_started();
d_logger->debug(msg.str());
}
if (config_changed) {
if ((change_offset == starting_offset) and not d_file_writer->is_started()) {
GR_LOG_DEBUG(d_logger, "issuing start command");
d_logger->debug("issuing start command");

// signal to begin recording when ready
d_check_start = true;
Expand All @@ -537,7 +541,7 @@ int file_sink_impl::do_handle_tags(std::vector<tag_t>& tags,
if (d_file_writer->is_started()) {
// The command to stop the writer is issued when any tags that require
// reconfiguration are observed while the writer is started
GR_LOG_DEBUG(d_logger, "issuing stop command");
d_logger->debug("issuing stop command");
do_stop = true;
}

Expand All @@ -554,8 +558,9 @@ int file_sink_impl::do_handle_tags(std::vector<tag_t>& tags,
// last configuration change tag, which defaults to the last sample so that
// all are consumed if no configuration changes are observed
if (d_debug) {
GR_LOG_DEBUG(d_logger,
boost::format("Number of samples to consume: %ld") % (ntoconsume));
std::ostringstream msg;
msg << boost::format("Number of samples to consume: %ld") % (ntoconsume);
d_logger->debug(msg.str());
}
return ntoconsume;
}
Expand Down Expand Up @@ -591,7 +596,9 @@ void file_sink_impl::set_mode(trigger_type_t mode)
}
void file_sink_impl::do_set_mode(trigger_type_t mode)
{
GR_LOG_DEBUG(d_logger, boost::format("Setting mode to %d") % mode);
std::ostringstream msg;
msg << boost::format("Setting mode to %d") % mode;
d_logger->debug(msg.str());

// make change only if changing mode
if (mode != d_mode) {
Expand Down
4 changes: 2 additions & 2 deletions lib/file_source/file_reader_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// #include "../file_source_impl.h"
#include <sys/stat.h>
#include <fcntl.h>

#include <boost/format.hpp>

namespace gr {
namespace sandia_utils {
Expand All @@ -42,7 +42,7 @@ namespace gr {
file_reader_base::open(const char *filename) {
if (d_is_open) { this->close(); }

GR_LOG_DEBUG(d_logger,boost::format("File Reader: Opening file %s") % filename);
d_logger->debug("File Reader: Opening file {}", filename);

// clear all tags
d_tags.clear();
Expand Down
Loading