summaryrefslogtreecommitdiff
path: root/grc/python
diff options
context:
space:
mode:
authorJosh Blum2009-08-28 20:57:40 -0700
committerJosh Blum2009-08-28 20:57:40 -0700
commit9ae19105d745ef2c7be8fbe3c2206a0a6ca6632b (patch)
tree0ffed76c3e439c064f743aa572b7d0ed5f5ceec1 /grc/python
parent5f7bd3f80387ea699649f76bd22d0be5ba08732d (diff)
downloadgnuradio-9ae19105d745ef2c7be8fbe3c2206a0a6ca6632b.tar.gz
gnuradio-9ae19105d745ef2c7be8fbe3c2206a0a6ca6632b.tar.bz2
gnuradio-9ae19105d745ef2c7be8fbe3c2206a0a6ca6632b.zip
added stream id type and checking in evaluate
Diffstat (limited to 'grc/python')
-rw-r--r--grc/python/Param.py25
1 files changed, 21 insertions, 4 deletions
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':