gr-baz Package

baz_sweep.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2004 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23/*
24 * gr-baz by Balint Seeber (http://spench.net/contact)
25 * Information, documentation & samples: http://wiki.spench.net/wiki/gr-baz
26 */
27
28#ifndef INCLUDED_BAZ_SWEEP_H
29#define INCLUDED_BAZ_SWEEP_H
30
31#include <gnuradio/sync_block.h>
32
33#include <boost/thread/mutex.hpp>
34#include <boost/thread/condition_variable.hpp>
35
36 class BAZ_API baz_sweep;
37
38/*
39 * We use boost::shared_ptr's instead of raw pointers for all access
40 * to gr::blocks (and many other data structures). The shared_ptr gets
41 * us transparent reference counting, which greatly simplifies storage
42 * management issues. This is especially helpful in our hybrid
43 * C++ / Python system.
44 *
45 * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
46 *
47 * As a convention, the _sptr suffix indicates a boost::shared_ptr
48 */
49 typedef boost::shared_ptr<baz_sweep> baz_sweep_sptr;
50
51/*!
52 * \brief Return a shared_ptr to a new instance of baz_sweep.
53 *
54 * To avoid accidental use of raw pointers, baz_sweep's
55 * constructor is private. howto_make_square2_ff is the public
56 * interface for creating new instances.
57 */
58 BAZ_API baz_sweep_sptr baz_make_sweep (float samp_rate, float sweep_rate = 0.0, bool is_duration = false);
59
60/*!
61 * \brief square2 a stream of floats.
62 * \ingroup block
63 *
64 * This uses the preferred technique: subclassing gr::sync_block.
65 */
66 class BAZ_API baz_sweep : public gr::sync_block
67{
68 private:
69 // The friend declaration allows howto_make_square2_ff to
70 // access the private constructor.
71
72 friend BAZ_API baz_sweep_sptr baz_make_sweep (float samp_rate, float sweep_rate, bool is_duration);
73
74 baz_sweep (float samp_rate, float sweep_rate, bool is_duration); // private constructor
75
76 float d_samp_rate;
77 float d_default_sweep_rate;
78 float d_default_is_duration;
79 float d_last_output, d_target, d_sweep_rate, d_start_freq;
80 boost::mutex d_mutex;
81 boost::condition_variable d_sweep_done;
82 uint64_t d_start_sample;
83
84 public:
85 ~baz_sweep (); // public destructor
86
87 void sweep(float freq, float rate = -1.0f, bool is_duration = false, bool block = false);
88
89 //inline float exponent() const
90 //{ return d_exponent; }
91
92 int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
93};
94
95#endif /* INCLUDED_BAZ_SWEEP_H */
BAZ_API
#define BAZ_API
Definition api.h:19
baz_make_sweep
BAZ_API baz_sweep_sptr baz_make_sweep(float samp_rate, float sweep_rate=0.0, bool is_duration=false)
Return a shared_ptr to a new instance of baz_sweep.
baz_sweep
class BAZ_API baz_sweep
Definition baz_sweep.h:36
baz_sweep
square2 a stream of floats.
Definition baz_sweep.h:67
baz_sweep::baz_make_sweep
friend BAZ_API baz_sweep_sptr baz_make_sweep(float samp_rate, float sweep_rate, bool is_duration)
Return a shared_ptr to a new instance of baz_sweep.
baz_sweep::~baz_sweep
~baz_sweep()
baz_sweep::work
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
baz_sweep::sweep
void sweep(float freq, float rate=-1.0f, bool is_duration=false, bool block=false)