summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2009-08-28 20:57:40 -0700
committerJosh Blum2009-08-28 20:57:40 -0700
commit9ae19105d745ef2c7be8fbe3c2206a0a6ca6632b (patch)
tree0ffed76c3e439c064f743aa572b7d0ed5f5ceec1
parent5f7bd3f80387ea699649f76bd22d0be5ba08732d (diff)
downloadgnuradio-9ae19105d745ef2c7be8fbe3c2206a0a6ca6632b.tar.gz
gnuradio-9ae19105d745ef2c7be8fbe3c2206a0a6ca6632b.tar.bz2
gnuradio-9ae19105d745ef2c7be8fbe3c2206a0a6ca6632b.zip
added stream id type and checking in evaluate
-rw-r--r--grc/blocks/virtual_sink.xml2
-rw-r--r--grc/blocks/virtual_source.xml2
-rw-r--r--grc/python/Param.py25
-rw-r--r--grc/todo.txt2
4 files changed, 23 insertions, 8 deletions
diff --git a/grc/blocks/virtual_sink.xml b/grc/blocks/virtual_sink.xml
index bd858522b..35fb27e67 100644
--- a/grc/blocks/virtual_sink.xml
+++ b/grc/blocks/virtual_sink.xml
@@ -12,7 +12,7 @@
<name>Stream ID</name>
<key>stream_id</key>
<value></value>
- <type>string</type>
+ <type>stream_id</type>
</param>
<sink>
<name>in</name>
diff --git a/grc/blocks/virtual_source.xml b/grc/blocks/virtual_source.xml
index 11eb0c0fb..e0c775449 100644
--- a/grc/blocks/virtual_source.xml
+++ b/grc/blocks/virtual_source.xml
@@ -12,7 +12,7 @@
<name>Stream ID</name>
<key>stream_id</key>
<value></value>
- <type>string</type>
+ <type>stream_id</type>
</param>
<source>
<name>out</name>
diff --git a/grc/python/Param.py b/grc/python/Param.py
index f971d0c3f..49601f168 100644
--- a/grc/python/Param.py
+++ b/grc/python/Param.py
@@ -94,7 +94,7 @@ class Param(_Param):
'complex_vector', 'real_vector', 'int_vector',
'hex', 'string', 'bool',
'file_open', 'file_save',
- 'id',
+ 'id', 'stream_id',
'grid_pos', 'notebook',
'import',
]
@@ -310,14 +310,31 @@ class Param(_Param):
#can python use this as a variable?
try: assert _check_id_matcher.match(v)
except AssertionError: raise Exception, 'ID "%s" must begin with a letter and may contain letters, numbers, and underscores.'%v
- params = self.get_all_params('id')
- keys = [param.get_value() for param in params]
- try: assert keys.count(v) <= 1 #id should only appear once, or zero times if block is disabled
+ ids = [param.get_value() for param in self.get_all_params(t)]
+ try: assert ids.count(v) <= 1 #id should only appear once, or zero times if block is disabled
except: raise Exception, 'ID "%s" is not unique.'%v
try: assert v not in ID_BLACKLIST
except: raise Exception, 'ID "%s" is blacklisted.'%v
return v
#########################
+ # Stream ID Type
+ #########################
+ elif t == 'stream_id':
+ #get a list of all stream ids used in the virtual sinks
+ ids = [param.get_value() for param in filter(
+ lambda p: p.get_parent().get_key() == 'virtual_sink',
+ self.get_all_params(t),
+ )]
+ #check that the virtual sink's stream id is unique
+ if self.get_parent().get_key() == 'virtual_sink':
+ try: assert ids.count(v) <= 1 #id should only appear once, or zero times if block is disabled
+ except: raise Exception, 'Stream ID "%s" is not unique.'%v
+ #check that the virtual source's steam id is found
+ if self.get_parent().get_key() == 'virtual_source':
+ try: assert v in ids
+ except: raise Exception, 'Stream ID "%s" is not found.'%v
+ return v
+ #########################
# Grid Position Type
#########################
elif t == 'grid_pos':
diff --git a/grc/todo.txt b/grc/todo.txt
index ad02bf790..ef94abfb5 100644
--- a/grc/todo.txt
+++ b/grc/todo.txt
@@ -58,8 +58,6 @@
##################################################
# Problems
##################################################
-* need a way to make an id param in the xml that will override the default
- * ex: display pad sink id in continuation mode using hide tag for id param
* hier block generation
* auto generate hier library on changes
* auto clean hier library when block removed