Statistics
| Branch: | Tag: | Revision:

root / gnuradio-core / src / lib / general / gr_skiphead.h @ 47c39028

History | View | Annotate | Download (1.8 kB)

1 5d69a524 jcorgan
/* -*- c++ -*- */
2 5d69a524 jcorgan
/*
3 5d69a524 jcorgan
 * Copyright 2005 Free Software Foundation, Inc.
4 5d69a524 jcorgan
 * 
5 5d69a524 jcorgan
 * This file is part of GNU Radio
6 5d69a524 jcorgan
 * 
7 5d69a524 jcorgan
 * GNU Radio is free software; you can redistribute it and/or modify
8 5d69a524 jcorgan
 * it under the terms of the GNU General Public License as published by
9 937b719d eb
 * the Free Software Foundation; either version 3, or (at your option)
10 5d69a524 jcorgan
 * any later version.
11 5d69a524 jcorgan
 * 
12 5d69a524 jcorgan
 * GNU Radio is distributed in the hope that it will be useful,
13 5d69a524 jcorgan
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 5d69a524 jcorgan
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 5d69a524 jcorgan
 * GNU General Public License for more details.
16 5d69a524 jcorgan
 * 
17 5d69a524 jcorgan
 * You should have received a copy of the GNU General Public License
18 5d69a524 jcorgan
 * along with GNU Radio; see the file COPYING.  If not, write to
19 86f5c924 eb
 * the Free Software Foundation, Inc., 51 Franklin Street,
20 86f5c924 eb
 * Boston, MA 02110-1301, USA.
21 5d69a524 jcorgan
 */
22 5d69a524 jcorgan
23 5d69a524 jcorgan
#ifndef INCLUDED_GR_SKIPHEAD_H
24 5d69a524 jcorgan
#define INCLUDED_GR_SKIPHEAD_H
25 5d69a524 jcorgan
26 f914499f Josh Blum
#include <gr_core_api.h>
27 5d69a524 jcorgan
#include <gr_sync_block.h>
28 5d69a524 jcorgan
#include <stddef.h>      // size_t
29 5d69a524 jcorgan
30 c7dbfcc7 trondeau
class gr_skiphead;
31 c7dbfcc7 trondeau
typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr;
32 c7dbfcc7 trondeau
33 f914499f Josh Blum
GR_CORE_API gr_skiphead_sptr
34 f914499f Josh Blum
gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
35 f914499f Josh Blum
36 c7dbfcc7 trondeau
37 5d69a524 jcorgan
/*!
38 5d69a524 jcorgan
 * \brief skips the first N items, from then on copies items to the output
39 ed236703 eb
 * \ingroup slicedice_blk
40 5d69a524 jcorgan
 *
41 5d69a524 jcorgan
 * Useful for building test cases and sources which have metadata or junk at the start
42 5d69a524 jcorgan
 */
43 5d69a524 jcorgan
44 f914499f Josh Blum
class GR_CORE_API gr_skiphead : public gr_block
45 5d69a524 jcorgan
{
46 f914499f Josh Blum
  friend GR_CORE_API gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
47 dd656e9d Tom Rondeau
  gr_skiphead (size_t itemsize, uint64_t nitems_to_skip);
48 5d69a524 jcorgan
49 dd656e9d Tom Rondeau
  uint64_t                  d_nitems_to_skip;
50 dd656e9d Tom Rondeau
  uint64_t                d_nitems;                // total items seen
51 5d69a524 jcorgan
52 5d69a524 jcorgan
 public:
53 c7dbfcc7 trondeau
54 c7dbfcc7 trondeau
  int general_work(int noutput_items,
55 c7dbfcc7 trondeau
                   gr_vector_int &ninput_items,
56 c7dbfcc7 trondeau
                   gr_vector_const_void_star &input_items,
57 c7dbfcc7 trondeau
                   gr_vector_void_star &output_items);
58 5d69a524 jcorgan
};
59 5d69a524 jcorgan
60 5d69a524 jcorgan
#endif /* INCLUDED_GR_SKIPHEAD_H */