Class: CreateRef

Inherits:
Base
  • Object
show all
Defined in:
lib/functions/create_ref.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, #cycle_level_arduino_code, #depends_on, #resolve_frame_optimized, #top_level_scope_arduino_code

Constructor Details

#initialize(params) ⇒ CreateRef

Returns a new instance of CreateRef.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/functions/create_ref.rb', line 9

def initialize(params)
  super(params)
  @identifier = params[:identifier]
  resolve_frame_optimized
  unless $refs.has_key?(@identifier)
    $refs[@identifier] = @name
    $refs_frame_optimized[@identifier] = @frame_optimized
  else
    raise "duplicate ref definition #{params[:name]}"
  end
end

Instance Attribute Details

#identifierObject

Returns the value of attribute identifier.



6
7
8
# File 'lib/functions/create_ref.rb', line 6

def identifier
  @identifier
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/functions/create_ref.rb', line 7

def value
  @value
end

Instance Method Details

#arduino_codeObject



25
26
27
# File 'lib/functions/create_ref.rb', line 25

def arduino_code
  []
end

#param_keysObject



21
22
23
# File 'lib/functions/create_ref.rb', line 21

def param_keys
  [:value]
end

#top_level_scope_codeObject



29
30
31
32
33
# File 'lib/functions/create_ref.rb', line 29

def top_level_scope_code
  [
    "long *#{@name} = #{@value.name};"
  ]
end