id: pfb_decimator_ccf
label: Polyphase Decimator
flags: [ python, cpp ]

parameters:
-   id: decim
    label: Decimation
    dtype: int
-   id: taps
    label: Taps
    dtype: real_vector
-   id: channel
    label: Output Channel
    dtype: int
    default: '0'
-   id: atten
    label: Stop-band Attenuation
    dtype: real
    default: '100'
-   id: fft_rot
    label: Use FFT Rotator
    dtype: raw
    default: 'True'
    options: ['True', 'False']
    hide: part
-   id: fft_filts
    label: Use FFT Filters
    dtype: raw
    default: 'True'
    options: ['True', 'False']
    hide: part
-   id: samp_delay
    label: Sample Delay
    dtype: int
    default: '0'
    hide: part

inputs:
-   domain: stream
    dtype: complex

outputs:
-   domain: stream
    dtype: complex

templates:
    imports: |-
        from gnuradio.filter import pfb
        from gnuradio.filter import firdes
    make: |-
        pfb.decimator_ccf(
            ${decim},
            ${taps},
            ${channel},
            ${atten},
            ${fft_rot},
            ${fft_filts})
        self.${id}.declare_sample_delay(${samp_delay})
    callbacks:
    - set_taps(${taps})
    - set_channel(int(${channel}))

cpp_templates:
    includes: ['#include <gnuradio/filter/pfb_decimator_ccf.h>']
    declarations: 'pfb::decimator_ccf::sptr ${id};'
    make: |-
        std::vector<float> taps = {${str(taps)[1:-1]}};
        this->${id} = pfb::decimator_ccf::make(
            ${decim},
            taps,
            ${channel},
            ${atten},
            ${fft_rot},
            ${fft_filts});
        this->${id}.declare_sample_delay(${samp_delay});
    link: ['gnuradio::gnuradio-filter']
    callbacks:
    - set_taps(taps)
    - set_channel(int(${channel}))

file_format: 1
