GNU Radio C++ API Reference  3.10.10.0
The Free & Open Software Radio Ecosystem
float_to_uchar.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012 Free Software Foundation, Inc.
4  * Copyright 2024 Daniel Estevez <daniel@destevez.net>
5  *
6  * This file is part of GNU Radio
7  *
8  * SPDX-License-Identifier: GPL-3.0-or-later
9  *
10  */
11 
12 #ifndef INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H
13 #define INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H
14 
15 #include <gnuradio/blocks/api.h>
16 #include <gnuradio/sync_block.h>
17 
18 namespace gr {
19 namespace blocks {
20 
21 /*!
22  * \brief Convert stream of floats to a stream of unsigned chars
23  * \ingroup type_converters_blk
24  */
25 class BLOCKS_API float_to_uchar : virtual public sync_block
26 {
27 public:
28  // gr::blocks::float_to_uchar_ff::sptr
29  typedef std::shared_ptr<float_to_uchar> sptr;
30 
31  /*!
32  * Build a float to uchar block.
33  *
34  * \param vlen vector length of data streams.
35  * \param scale a scalar multiplier to change the output signal scale.
36  * \param bias a scalar additive value to change the output signal offset.
37  */
38  static sptr make(size_t vlen = 1, float scale = 1.0, float bias = 0.0);
39 
40  /*!
41  * Get the scalar multiplier value.
42  */
43  virtual float scale() const = 0;
44 
45  /*!
46  * Get the scalar bias value.
47  */
48  virtual float bias() const = 0;
49 
50  /*!
51  * Set the scalar multiplier value.
52  */
53  virtual void set_scale(float scale) = 0;
54 
55  /*!
56  * Set the scalar bias value.
57  */
58  virtual void set_bias(float scale) = 0;
59 };
60 
61 } /* namespace blocks */
62 } /* namespace gr */
63 
64 #endif /* INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H */
Convert stream of floats to a stream of unsigned chars.
Definition: float_to_uchar.h:26
virtual float scale() const =0
virtual void set_bias(float scale)=0
virtual void set_scale(float scale)=0
static sptr make(size_t vlen=1, float scale=1.0, float bias=0.0)
virtual float bias() const =0
std::shared_ptr< float_to_uchar > sptr
Definition: float_to_uchar.h:29
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29