Loading...
Searching...
No Matches
file_sink_base.h
Go to the documentation of this file.
/* -*- c++ -*- */
/*
* Copyright 2004,2007,2008,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#ifndef INCLUDED_GR_FILE_SINK_BASE_H
#define INCLUDED_GR_FILE_SINK_BASE_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/logger.h>
#include <gnuradio/thread/thread.h>
#include <cstdio>
namespace gr {
namespace blocks {
/*!
* \brief Common base class for file sinks
*/
class BLOCKS_API file_sink_base
{
protected:
FILE* d_fp; // current FILE pointer
FILE* d_new_fp; // new FILE pointer
bool d_updated; // is there a new FILE pointer?
bool d_is_binary;
gr::thread::mutex d_mutex;
bool d_unbuffered;
bool d_append;
gr::logger_ptr d_base_logger;
gr::logger_ptr d_base_debug_logger;
protected:
file_sink_base(const char* filename, bool is_binary, bool append);
public:
file_sink_base() {}
~file_sink_base();
/*!
* \brief Open filename and begin output to it.
*/
bool open(const char* filename);
/*!
* \brief Close current output file.
*
* Closes current output file and ignores any output until
* open is called to connect to another file.
*/
void close();
/*!
* \brief if we've had an update, do it now.
*/
void do_update();
/*!
* \brief turn on unbuffered writes for slower outputs
*/
void set_unbuffered(bool unbuffered);
};
} /* namespace blocks */
} /* namespace gr */
#endif /* INCLUDED_GR_FILE_SINK_BASE_H */
gr::blocks::file_sink_base
Common base class for file sinks.
Definition file_sink_base.h:26
gr::blocks::file_sink_base::d_updated
bool d_updated
Definition file_sink_base.h:30
gr::blocks::file_sink_base::open
bool open(const char *filename)
Open filename and begin output to it.
gr::blocks::file_sink_base::d_base_debug_logger
gr::logger_ptr d_base_debug_logger
Definition file_sink_base.h:36
gr::blocks::file_sink_base::close
void close()
Close current output file.
gr::blocks::file_sink_base::set_unbuffered
void set_unbuffered(bool unbuffered)
turn on unbuffered writes for slower outputs
gr::blocks::file_sink_base::d_fp
FILE * d_fp
Definition file_sink_base.h:28
gr::blocks::file_sink_base::d_unbuffered
bool d_unbuffered
Definition file_sink_base.h:33
gr::blocks::file_sink_base::d_is_binary
bool d_is_binary
Definition file_sink_base.h:31
gr::blocks::file_sink_base::d_mutex
gr::thread::mutex d_mutex
Definition file_sink_base.h:32
gr::blocks::file_sink_base::d_base_logger
gr::logger_ptr d_base_logger
Definition file_sink_base.h:35
gr::blocks::file_sink_base::file_sink_base
file_sink_base()
Definition file_sink_base.h:42
gr::blocks::file_sink_base::~file_sink_base
~file_sink_base()
gr::blocks::file_sink_base::file_sink_base
file_sink_base(const char *filename, bool is_binary, bool append)
gr::blocks::file_sink_base::d_new_fp
FILE * d_new_fp
Definition file_sink_base.h:29
gr::blocks::file_sink_base::d_append
bool d_append
Definition file_sink_base.h:34
gr::blocks::file_sink_base::do_update
void do_update()
if we've had an update, do it now.
api.h
BLOCKS_API
#define BLOCKS_API
Definition gr-blocks/include/gnuradio/blocks/api.h:18
logger.h
gr::thread::mutex
boost::mutex mutex
Definition thread.h:37
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
gr::logger_ptr
std::shared_ptr< logger > logger_ptr
Definition logger.h:250
thread.h