GNU Radio C++ API Reference: file_descriptor_source.h Source File

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
file_descriptor_source.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2004,2013 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 *
9 */
10
11#ifndef INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H
12#define INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H
13
14#include <gnuradio/blocks/api.h>
15#include <gnuradio/sync_block.h>
16
17
18namespace gr {
19namespace blocks {
20
21/*!
22 * \brief Read stream from file descriptor.
23 * \ingroup file_operators_blk
24 */
25 class BLOCKS_API file_descriptor_source : virtual public sync_block
26{
27protected:
28 virtual int read_items(char* buf, int nitems) = 0;
29 virtual int handle_residue(char* buf, int nbytes_read) = 0;
30 virtual void flush_residue() = 0;
31
32public:
33 // gr::blocks::file_descriptor_source::sptr
34 typedef std::shared_ptr<file_descriptor_source> sptr;
35
36 /*!
37 * Build a file descriptor source block. The provided file descriptor will
38 * be closed when the sink is destroyed.
39 *
40 * \param itemsize item size of the incoming data stream.
41 * \param fd file descriptor (as an integer).
42 * \param repeat repeat the data stream continuously.
43 */
44 static sptr make(size_t itemsize, int fd, bool repeat = false);
45};
46
47} /* namespace blocks */
48} /* namespace gr */
49
50#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H */
gr::blocks::file_descriptor_source
Read stream from file descriptor.
Definition file_descriptor_source.h:26
gr::blocks::file_descriptor_source::flush_residue
virtual void flush_residue()=0
gr::blocks::file_descriptor_source::read_items
virtual int read_items(char *buf, int nitems)=0
gr::blocks::file_descriptor_source::handle_residue
virtual int handle_residue(char *buf, int nbytes_read)=0
gr::blocks::file_descriptor_source::sptr
std::shared_ptr< file_descriptor_source > sptr
Definition file_descriptor_source.h:34
gr::blocks::file_descriptor_source::make
static sptr make(size_t itemsize, int fd, bool repeat=false)
gr::blocks::repeat
repeat each input repeat times
Definition repeat.h:30
gr::sync_block::sync_block
sync_block(void)
Definition sync_block.h:28
api.h
BLOCKS_API
#define BLOCKS_API
Definition gr-blocks/include/gnuradio/blocks/api.h:18
gr::blocks
Definition abs_blk.h:20
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
sync_block.h