gr-baz Package
baz_merge.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_MERGE_H
29#define INCLUDED_BAZ_MERGE_H
30
31#include <gnuradio/sync_block.h>
32
33#include <vector>
34
36
37/*
38 * We use boost::shared_ptr's instead of raw pointers for all access
39 * to gr::blocks (and many other data structures). The shared_ptr gets
40 * us transparent reference counting, which greatly simplifies storage
41 * management issues. This is especially helpful in our hybrid
42 * C++ / Python system.
43 *
44 * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
45 *
46 * As a convention, the _sptr suffix indicates a boost::shared_ptr
47 */
48typedef boost::shared_ptr<baz_merge> baz_merge_sptr;
49
50/*!
51 * \brief Return a shared_ptr to a new instance of baz_merge.
52 *
53 * To avoid accidental use of raw pointers, baz_merge's
54 * constructor is private. howto_make_square2_ff is the public
55 * interface for creating new instances.
56 */
57BAZ_API baz_merge_sptr baz_make_merge(int item_size, float samp_rate, int additional_streams = 1, bool drop_residual = true, const char* length_tag = "length", const char* ignore_tag = "ignore", bool verbose = false);
58
59/*!
60 * \brief square2 a stream of floats.
61 * \ingroup block
62 *
63 * This uses the preferred technique: subclassing gr::sync_block.
64 */
65class BAZ_API baz_merge : public gr::block
66{
67private:
68 // The friend declaration allows howto_make_square2_ff to
69 // access the private constructor.
70
71 friend BAZ_API baz_merge_sptr baz_make_merge (int item_size, float samp_rate, int additional_streams, bool drop_residual, const char* length_tag, const char* ignore_tag, bool verbose);
72
73 baz_merge (int item_size, float samp_rate, int additional_streams, bool drop_residual, const char* length_tag, const char* ignore_tag, bool verbose); // private constructor
74
75 float d_samp_rate;
76 bool d_drop_residual;
77 uint64_t d_start_time_whole;
78 double d_start_time_frac;
79 int d_selected_input;
80 int d_items_to_copy;
81 //int d_items_to_ignore;
82 bool d_ignore_current;
83 pmt::pmt_t d_length_name, d_ignore_name;
84 std::vector<pmt::pmt_t> msg_output_ids;
85 uint64_t d_total_burst_count;
86 bool d_verbose;
87
88public:
89 ~baz_merge (); // public destructor
90
91 void set_start_time(double time);
92 void set_start_time(uint64_t whole, double frac);
93
94 //inline float exponent() const
95 //{ return d_exponent; }
96
97 void forecast(int noutput_items, gr_vector_int &ninput_items_required);
98 int general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
99};
100
101#endif /* INCLUDED_BAZ_MERGE_H */
#define BAZ_API
Definition api.h:19
BAZ_API baz_merge_sptr baz_make_merge(int item_size, float samp_rate, int additional_streams=1, bool drop_residual=true, const char *length_tag="length", const char *ignore_tag="ignore", bool verbose=false)
Return a shared_ptr to a new instance of baz_merge.
square2 a stream of floats.
Definition baz_merge.h:66
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
void set_start_time(double time)
void set_start_time(uint64_t whole, double frac)
friend BAZ_API baz_merge_sptr baz_make_merge(int item_size, float samp_rate, int additional_streams, bool drop_residual, const char *length_tag, const char *ignore_tag, bool verbose)
Return a shared_ptr to a new instance of baz_merge.