gr-baz Package
baz_native_mux.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 * 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_NATIVE_MUX_H
29#define INCLUDED_BAZ_NATIVE_MUX_H
30
31#include <gnuradio/sync_block.h>
32#include <baz_native_callback.h>
33
35
36/*
37 * We use boost::shared_ptr's instead of raw pointers for all access
38 * to gr::blocks (and many other data structures). The shared_ptr gets
39 * us transparent reference counting, which greatly simplifies storage
40 * management issues. This is especially helpful in our hybrid
41 * C++ / Python system.
42 *
43 * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
44 *
45 * As a convention, the _sptr suffix indicates a boost::shared_ptr
46 */
47typedef boost::shared_ptr<baz_native_mux> baz_native_mux_sptr;
48
49/*!
50 * \brief Return a shared_ptr to a new instance of baz_native_mux.
51 *
52 * To avoid accidental use of raw pointers, baz_native_mux's
53 * constructor is private. howto_make_square2_ff is the public
54 * interface for creating new instances.
55 */
56BAZ_API baz_native_mux_sptr baz_make_native_mux (int item_size, int input_count, int trigger_count = -1);
57
58/*!
59 * \brief square2 a stream of floats.
60 * \ingroup block
61 *
62 * This uses the preferred technique: subclassing gr::sync_block.
63 */
64class BAZ_API baz_native_mux : public /*gr::sync_block*/gr::block, public baz_native_callback_target
65{
66private:
67 // The friend declaration allows howto_make_square2_ff to
68 // access the private constructor.
69
70 friend BAZ_API baz_native_mux_sptr baz_make_native_mux (int item_size, int input_count, int trigger_count);
71
72 baz_native_mux (int item_size, int input_count, int trigger_count); // private constructor
73
74 int d_item_size;
75 int d_input_count;
76 int d_selected_input;
77 int d_trigger_count;
78 int d_trigger_countdown;
79 std::vector<float> d_values;
80 int d_value_index;
81 int d_last_noutput_items;
82
83 unsigned long d_samples_processed;
84 std::vector<unsigned long> d_switch_time;
85
86 public:
87 ~baz_native_mux (); // public destructor
88
89 int general_work (int noutput_items, gr_vector_int &ninput_items,
90 gr_vector_const_void_star &input_items,
91 gr_vector_void_star &output_items);
92
93public:
94 void callback(float f, unsigned long samples_processed);
95};
96
97#endif /* INCLUDED_BAZ_NATIVE_MUX_H */
#define BAZ_API
Definition: api.h:19
BAZ_API baz_native_mux_sptr baz_make_native_mux(int item_size, int input_count, int trigger_count=-1)
Return a shared_ptr to a new instance of baz_native_mux.
class BAZ_API baz_native_mux
Definition: baz_native_mux.h:34
Definition: baz_native_callback.h:49
square2 a stream of floats.
Definition: baz_native_mux.h:65
friend BAZ_API baz_native_mux_sptr baz_make_native_mux(int item_size, int input_count, int trigger_count)
Return a shared_ptr to a new instance of baz_native_mux.
void callback(float f, unsigned long samples_processed)
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)