Class: PRuby::PipelineNode
Instance Attribute Summary collapse
-
#input_channel ⇒ Channel
Le canal d'entree.
-
#output_channel ⇒ Channel
Le canal de sortie.
Instance Method Summary collapse
-
#add_stage(other) ⇒ self
Ajoute other comme etage additionnel du pipeline courant.
-
#initialize(first_stage) ⇒ Pipeline
constructor
Cree un nouvel objet pour un pipeline.
-
#inner_nodes ⇒ Array<Pipeline>
Retourne les differents internes noeuds du pipeline.
- #to_s ⇒ String
-
#value ⇒ Array
Le tableau des valeurs produites par chacun des etages.
Methods inherited from Pipeline
#>>, create, #input_channel_connected?, #join, #output_channel_connected?, #run, sink, #sink?, source, #source?, #terminated?, #wrap_around!, #|
Constructor Details
#initialize(first_stage) ⇒ Pipeline
Cree un nouvel objet pour un pipeline
386 387 388 |
# File 'lib/pruby/pipeline.rb', line 386 def initialize( first_stage ) @stages = [ mk_node(first_stage) ] end |
Instance Attribute Details
#input_channel ⇒ Channel
Le canal d'entree.
394 395 396 |
# File 'lib/pruby/pipeline.rb', line 394 def input_channel @stages.first.input_channel end |
#output_channel ⇒ Channel
Le canal de sortie.
402 403 404 |
# File 'lib/pruby/pipeline.rb', line 402 def output_channel @stages.last.output_channel end |
Instance Method Details
#add_stage(other) ⇒ self
Ajoute other comme etage additionnel du pipeline courant
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/pruby/pipeline.rb', line 417 def add_stage( other ) other = mk_node( other ) DBC.require( !output_channel_connected?, "*** Le canal de sortie de la partie gauche du pipeline est deja connectee !?" ) DBC.require( !other.input_channel_connected?, "*** Le canal d\'entree de la partie droite du pipeline est deja connectee !?" ) chan = Channel.new self.output_channel = chan other.input_channel = chan @stages << other self end |
#inner_nodes ⇒ Array<Pipeline>
Retourne les differents internes noeuds du pipeline.
377 378 379 |
# File 'lib/pruby/pipeline.rb', line 377 def inner_nodes @stages end |
#to_s ⇒ String
442 443 444 |
# File 'lib/pruby/pipeline.rb', line 442 def to_s "PipelineNode( " + @stages.map(&:to_s).join(" | ") + " )" end |
#value ⇒ Array
Returns Le tableau des valeurs produites par chacun des etages
436 437 438 439 |
# File 'lib/pruby/pipeline.rb', line 436 def value join @stages.map( &:value ) end |