Skip to content
Snippets Groups Projects
Commit ffd39b03 authored by Pepping's avatar Pepping
Browse files

- Added comments

parent ef28c9df
No related branches found
No related tags found
No related merge requests found
...@@ -55,6 +55,14 @@ class base_component(object): ...@@ -55,6 +55,14 @@ class base_component(object):
#'>' operator: Connect #'>' operator: Connect
def __gt__(self, other): def __gt__(self, other):
return self.__connect__(other) return self.__connect__(other)
# The __connect__ method fills the out_q attribute.
# out_q is a 3-dimensional list with pointers to the write-side of the
# communication pipes: out_q[x][y][z], where
# x iterates over the fanout (the number of connected snk's).
# y iterates over the number of outputs.
# z indexes the write-side of the pipe and is always [1]
#
def __connect__(self, other): def __connect__(self, other):
if hasattr(other, 'in_q'): if hasattr(other, 'in_q'):
# Create a list for all outputs. # Create a list for all outputs.
...@@ -68,9 +76,6 @@ class base_component(object): ...@@ -68,9 +76,6 @@ class base_component(object):
else: else:
print 'Error: downstream component', other.name, 'does not have snk' print 'Error: downstream component', other.name, 'does not have snk'
def run(self):
return None
# Components inheriting the base component class # Components inheriting the base component class
class blockGen(threading.Thread, base_component): class blockGen(threading.Thread, base_component):
...@@ -116,7 +121,7 @@ class dataBuffer(threading.Thread, base_component): ...@@ -116,7 +121,7 @@ class dataBuffer(threading.Thread, base_component):
for j in xrange(self.nof_packets): for j in xrange(self.nof_packets):
for i in xrange(self.nof_inputs): for i in xrange(self.nof_inputs):
data.append(self.in_q[i][0].recv()) data.append(self.in_q[i][0].recv())
time.sleep(self.index) time.sleep(self.index) # Added a sleep to avoid clashing of the print output.
print self.name print self.name
for i in data: for i in data:
print i print i
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment