('Integer Vector', Constants.INT_VECTOR_COLOR_SPEC),
('Short Vector', Constants.SHORT_VECTOR_COLOR_SPEC),
('Byte Vector', Constants.BYTE_VECTOR_COLOR_SPEC),
- ('Wildcard Type', Constants.WILDCARD_COLOR_SPEC),
+ ('Wildcard', Constants.WILDCARD_COLOR_SPEC),
+ ('Message', Constants.MSG_COLOR_SPEC),
)
class Platform(_Platform):
class Port(_Port):
##possible port types
- TYPES = ['complex', 'float', 'int', 'short', 'byte']
+ TYPES = ['complex', 'float', 'int', 'short', 'byte', 'msg']
def __init__(self, block, n):
"""
Make a new port from nested data.
@param block the parent element
@param n the nested odict
- @return a new port
"""
- vlen = n.find('vlen') or '1'
- nports = n.find('nports') or ''
- optional = n.find('optional') or ''
#build the port
_Port.__init__(
self,
block=block,
n=n,
)
- self._nports = nports
- self._vlen = vlen
- self._optional = bool(optional)
+ self._nports = n.find('nports') or ''
+ self._vlen = n.find('vlen') or '1'
+ self._optional = bool(n.find('optional'))
def validate(self):
_Port.validate(self)
'int': Constants.INT_COLOR_SPEC,
'short': Constants.SHORT_COLOR_SPEC,
'byte': Constants.BYTE_COLOR_SPEC,
+ 'msg': Constants.MSG_COLOR_SPEC,
}[self.get_type()]
return {#vlen is non 1
'complex': Constants.COMPLEX_VECTOR_COLOR_SPEC,
def __init__(self, block, n):
self._n = n #save n
- #key is port index
- n['key'] = str(block._source_count)
- block._source_count = block._source_count + 1
- Port.__init__(self, block, n)
+ if n['type'] != 'msg': #key is port index
+ n['key'] = str(block._source_count)
+ block._source_count = block._source_count + 1
+ Port.__init__(self, block, n)
def __del__(self):
self.get_parent()._source_count = self.get_parent()._source_count - 1
def __init__(self, block, n):
self._n = n #save n
- #key is port index
- n['key'] = str(block._sink_count)
- block._sink_count = block._sink_count + 1
- Port.__init__(self, block, n)
+ if n['type'] != 'msg': #key is port index
+ n['key'] = str(block._sink_count)
+ block._sink_count = block._sink_count + 1
+ Port.__init__(self, block, n)
def __del__(self):
self.get_parent()._sink_count = self.get_parent()._sink_count - 1
+
+#TODO merge source and sink classes into port class
+#TODO check that key is only defined if and only if type is message
+#TODO check that nports is undefined when type is message
-->
<!ELEMENT param (name, key, value?, type, hide?, option*)>
<!ELEMENT option (name, key, opt*)>
-<!ELEMENT sink (name, type, vlen?, nports?, optional?)>
-<!ELEMENT source (name, type, vlen?, nports?, optional?)>
+<!ELEMENT sink (name, key?, type, vlen?, nports?, optional?)>
+<!ELEMENT source (name, key?, type, vlen?, nports?, optional?)>
<!--
Bottom level elements.
Character data only.