Class: Choose

Inherits:
Base
  • Object
show all
Defined in:
lib/functions/choose.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#frame_optimized, #name

Instance Method Summary collapse

Methods inherited from Base

#add_arduino_code, #add_cycle_level_scope, #add_top_level_scope, #append_tsortable, #buildit, #depends_on, #initialize, #resolve_frame_optimized, #top_level_scope_arduino_code

Constructor Details

This class inherits a constructor from Base

Instance Attribute Details

#choiceObject

Returns the value of attribute choice.



12
13
14
# File 'lib/functions/choose.rb', line 12

def choice
  @choice
end

#op1Object

Returns the value of attribute op1.



13
14
15
# File 'lib/functions/choose.rb', line 13

def op1
  @op1
end

#op2Object

Returns the value of attribute op2.



14
15
16
# File 'lib/functions/choose.rb', line 14

def op2
  @op2
end

Instance Method Details

#arduino_codeObject



20
21
22
23
24
25
26
27
28
# File 'lib/functions/choose.rb', line 20

def arduino_code
  unless @frame_optimized 
    [
      "choose(#{@choice.name}, #{@op1.name}, #{@op2.name}, #{@name}, choose_half_phase);"
    ]
  else
    []
  end
end

#cycle_level_arduino_codeObject



30
31
32
33
34
35
36
37
38
# File 'lib/functions/choose.rb', line 30

def cycle_level_arduino_code
  if @frame_optimized
    [
      "choose(#{@choice.name}, #{@op1.name}, #{@op2.name}, #{@name}, choose_half_phase);"
    ]
  else
    []
  end
end

#param_keysObject



16
17
18
# File 'lib/functions/choose.rb', line 16

def param_keys
  [:choice, :op1, :op2]
end

#top_level_scope_codeObject



40
41
42
43
44
45
# File 'lib/functions/choose.rb', line 40

def top_level_scope_code
  [
    "long choose_half_phase = INTEGER_SCALE / 2 - 1;",
    "long #{@name}[3];"
  ]
end