summaryrefslogtreecommitdiff
path: root/include/gras/block.i
blob: 2de2c9859a96325812d6f7d5bea62f3a4ca5791f (plain)
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
// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.

#ifndef INCLUDED_GRAS_BLOCK_I
#define INCLUDED_GRAS_BLOCK_I

%module (package="gras") GRAS_Block

%{
#include <gras/block.hpp>
%}

%import <gras/element.i>
%import <gras/tags.i>
%include <gras/tag_iter.i>
%import <gras/sbuffer.i>
%include <gras/buffer_queue.hpp>
%include <gras/thread_pool.hpp>
%include <gras/block_config.hpp>
%include <gras/block.hpp>

////////////////////////////////////////////////////////////////////////
// Create pythonic gateway to get and set
////////////////////////////////////////////////////////////////////////
%pythoncode %{
from PMC import *
%}
%extend gras::Block
{
    %insert("python")
    %{
        def set(self, key, value):
            self._set_property(key, PMC_M(value))

        def get(self, key):
            return self._get_property(key)()

        def post_output_msg(self, which_output, value):
            if not isinstance(value, PMCC): value = PMC_M(value)
            self._post_output_msg(which_output, value)

        def post_input_msg(self, which_input, value):
            if not isinstance(value, PMCC): value = PMC_M(value)
            self._post_input_msg(which_input, value)

    %}
}

#endif /*INCLUDED_GRAS_BLOCK_I*/