File: sync_block.h

package info (click to toggle)
soapyosmo 0.2.5-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,860 kB
  • sloc: cpp: 16,159; python: 11,343; xml: 263; makefile: 12; sh: 1
file content (50 lines) | stat: -rw-r--r-- 1,201 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <osmosdr/api.h>
#include <gnuradio/basic_block.h>

#define WORK_DONE -1

namespace gr
{
struct OSMOSDR_API sync_block
{
    sync_block(void){}
    sync_block(const std::string &name,
           gr::io_signature::sptr input_signature,
           gr::io_signature::sptr output_signature)
    {
        return;
    }

    virtual ~sync_block(void);

    //! may only be called during constructor
    void set_input_signature(gr::io_signature::sptr) {
    }

    //! may only be called during constructor
    void set_output_signature(gr::io_signature::sptr) {
    }

    void consume_each(int nitems)
    {
        //only care about one channel -- homogenous assumption
        _consumed_total += nitems;
    }

    void consume(int which_input, int nitems)
    {
        //only care about one channel -- homogenous assumption
        if (which_input == 0) _consumed_total += nitems;
    }

    virtual int work( int noutput_items,
                          gr_vector_const_void_star &input_items,
                          gr_vector_void_star &output_items ) = 0;

    virtual bool start(void){return true;}
    virtual bool stop(void){return true;}

    int _consumed_total;
};
}