GNU Radio's DAB Package
dab_sum_elements_vff.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#ifndef INCLUDED_DAB_SUM_ELEMENTS_VFF_H
23#define INCLUDED_DAB_SUM_ELEMENTS_VFF_H
24
25#include <gr_sync_block.h>
26
28
29/*
30 * We use std::shared_ptr's instead of raw pointers for all access
31 * to gr_blocks (and many other data structures). The shared_ptr gets
32 * us transparent reference counting, which greatly simplifies storage
33 * management issues. This is especially helpful in our hybrid
34 * C++ / Python system.
35 *
36 * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
37 *
38 * As a convention, the _sptr suffix indicates a std::shared_ptr
39 */
40typedef std::shared_ptr<dab_sum_elements_vff> dab_sum_elements_vff_sptr;
41
42/*!
43 * \brief Return a shared_ptr to a new instance of dab_sum_elements_vff.
44 *
45 * To avoid accidental use of raw pointers, dab_sum_elements_vff's
46 * constructor is private. dab_make_sum_elements_vff is the public
47 * interface for creating new instances.
48 */
49dab_sum_elements_vff_sptr
50dab_make_sum_elements_vff (unsigned int length);
51
52/*!
53 * \brief Sum up all elements of a vector
54 * \ingroup math
55 * \param length length of the vector
56 * \return \f[ y[k] = \sum_{i=1}^n x_i[k]\f]
57 *
58 * input: float vector
59 * output: float
60 */
61class dab_sum_elements_vff : public gr_sync_block
62{
63 private:
64 // The friend declaration allows dab_make_sum_elements_vff to
65 // access the private constructor.
66
67 friend dab_sum_elements_vff_sptr
68 dab_make_sum_elements_vff (unsigned int length);
69
70 dab_sum_elements_vff (unsigned int length); // private constructor
71
72 unsigned int d_length;
73
74 public:
75 int work (int noutput_items,
76 gr_vector_const_void_star &input_items,
77 gr_vector_void_star &output_items);
78};
79
80#endif /* INCLUDED_DAB_SUM_ELEMENTS_VFF_H */
Sum up all elements of a vector.
Definition dab_sum_elements_vff.h:62
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
friend dab_sum_elements_vff_sptr dab_make_sum_elements_vff(unsigned int length)
Return a shared_ptr to a new instance of dab_sum_elements_vff.
dab_sum_elements_vff_sptr dab_make_sum_elements_vff(unsigned int length)
Return a shared_ptr to a new instance of dab_sum_elements_vff.