summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/gras/CMakeLists.txt12
-rw-r--r--python/gras/GRAS_PyBlock.i (renamed from python/gras/GRAS_Block.i)17
-rw-r--r--python/gras/GRAS_PyHierBlocks.i (renamed from python/gras/GRAS_HierBlock.i)12
-rw-r--r--python/gras/__init__.py9
4 files changed, 33 insertions, 17 deletions
diff --git a/python/gras/CMakeLists.txt b/python/gras/CMakeLists.txt
index a7fc8f3..221950d 100644
--- a/python/gras/CMakeLists.txt
+++ b/python/gras/CMakeLists.txt
@@ -20,16 +20,24 @@ file(GLOB GR_SWIG_SOURCE_DEPS "${GRAS_SOURCE_DIR}/include/gras/*.i")
GR_SWIG_MAKE(GRAS_Tags GRAS_Tags.i)
GR_SWIG_MAKE(GRAS_TimeTag GRAS_TimeTag.i)
-GR_SWIG_MAKE(GRAS_Block GRAS_Block.i)
-GR_SWIG_MAKE(GRAS_HierBlock GRAS_HierBlock.i)
+GR_SWIG_MAKE(GRAS_Element ../../include/gras/element.i)
+GR_SWIG_MAKE(GRAS_Block ../../include/gras/block.i)
+GR_SWIG_MAKE(GRAS_HierBlock ../../include/gras/hier_block.i)
+GR_SWIG_MAKE(GRAS_TopBlock ../../include/gras/top_block.i)
+GR_SWIG_MAKE(GRAS_PyBlock GRAS_PyBlock.i)
+GR_SWIG_MAKE(GRAS_PyHierBlocks GRAS_PyHierBlocks.i)
GR_SWIG_MAKE(GRAS_ThreadPool GRAS_ThreadPool.i)
GR_SWIG_MAKE(GRAS_SBuffer GRAS_SBuffer.i)
GR_SWIG_INSTALL(
TARGETS
GRAS_Tags
GRAS_TimeTag
+ GRAS_Element
GRAS_Block
GRAS_HierBlock
+ GRAS_PyBlock
+ GRAS_PyHierBlocks
+ GRAS_TopBlock
GRAS_ThreadPool
GRAS_SBuffer
DESTINATION ${GR_PYTHON_DIR}/gras
diff --git a/python/gras/GRAS_Block.i b/python/gras/GRAS_PyBlock.i
index bedeb85..a588a88 100644
--- a/python/gras/GRAS_Block.i
+++ b/python/gras/GRAS_PyBlock.i
@@ -43,6 +43,10 @@
}
}
+%{
+#include <gras/block.hpp>
+%}
+
////////////////////////////////////////////////////////////////////////
// SWIG up the representation for IO work arrays
////////////////////////////////////////////////////////////////////////
@@ -53,13 +57,10 @@
////////////////////////////////////////////////////////////////////////
// Pull in the implementation goodies
////////////////////////////////////////////////////////////////////////
-%{
-#include <gras/block.hpp>
-#include <iostream>
-%}
-
-%include <gras/element.i>
-%include <gras/block.i>
+%import <gras/element.i>
+%import <gras/tags.i>
+%include <gras/tag_iter.i>
+%import <gras/block.i>
%include "GRAS_Utils.i"
@@ -216,7 +217,7 @@ def sig_to_dtype_sig(sig):
if sig is None: sig = ()
return map(numpy.dtype, sig)
-class Block(BlockPython):
+class PyBlock(BlockPython):
def __init__(self, name='Block', in_sig=None, out_sig=None):
BlockPython.__init__(self, name)
self.set_input_signature(in_sig)
diff --git a/python/gras/GRAS_HierBlock.i b/python/gras/GRAS_PyHierBlocks.i
index 563dadd..a769e2b 100644
--- a/python/gras/GRAS_HierBlock.i
+++ b/python/gras/GRAS_PyHierBlocks.i
@@ -26,9 +26,9 @@
////////////////////////////////////////////////////////////////////////
// pull in hier and top interface
////////////////////////////////////////////////////////////////////////
-%include <gras/element.i>
-%include <gras/hier_block.i>
-%include <gras/top_block.hpp>
+%import <gras/element.i>
+%import <gras/hier_block.i>
+%import <gras/top_block.i>
%include "GRAS_Utils.i"
@@ -137,6 +137,8 @@ struct HierBlockPython : HierBlock
////////////////////////////////////////////////////////////////////////
%pythoncode %{
+from GRAS_Element import Element
+
def to_element(obj):
if isinstance(obj, Element): return obj
try:
@@ -164,7 +166,7 @@ def internal_connect__(fcn, obj, *args):
fcn(obj, src, src_index, sink, sink_index)
-class TopBlock(TopBlockPython):
+class PyTopBlock(TopBlockPython):
def __init__(self, name="Top"):
TopBlockPython.__init__(self, name)
@@ -182,7 +184,7 @@ class TopBlock(TopBlockPython):
result_str = TopBlockPython.query(self, query_str)
return json.loads(result_str)
-class HierBlock(HierBlockPython):
+class PyHierBlock(HierBlockPython):
def __init__(self, name="Hier"):
HierBlockPython.__init__(self, name)
diff --git a/python/gras/__init__.py b/python/gras/__init__.py
index cf2c7f5..5d81709 100644
--- a/python/gras/__init__.py
+++ b/python/gras/__init__.py
@@ -4,6 +4,11 @@ from PMC import *
from GRAS_SBuffer import SBufferConfig, SBuffer
from GRAS_Tags import Tag, StreamTag, PacketMsg
from GRAS_TimeTag import TimeTag
-from GRAS_Block import Block
-from GRAS_HierBlock import HierBlock, TopBlock
+from GRAS_Element import Element
+import GRAS_Block
+import GRAS_HierBlock
+import GRAS_TopBlock
+from GRAS_PyBlock import PyBlock as Block
+from GRAS_PyHierBlocks import PyHierBlock as HierBlock
+from GRAS_PyHierBlocks import PyTopBlock as TopBlock
from GRAS_ThreadPool import ThreadPoolConfig, ThreadPool