Class: Maximum

Inherits:
Base
  • Object
show all
Defined in:
lib/functions/max.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

#op1Object

Returns the value of attribute op1.



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

def op1
  @op1
end

#op2Object

Returns the value of attribute op2.



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

def op2
  @op2
end

Instance Method Details

#arduino_codeObject



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

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

#cycle_level_arduino_codeObject



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

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

#param_keysObject



15
16
17
# File 'lib/functions/max.rb', line 15

def param_keys
  [:op1, :op2]
end

#top_level_scope_codeObject



39
40
41
42
43
# File 'lib/functions/max.rb', line 39

def top_level_scope_code
  [
    "long #{@name}[3];"
  ]
end