class BOAST::Affectation

@!parse module Functors; functorize Affectation; end

Attributes

options[R]
source[R]
target[R]

Public Class Methods

new(target, source, options = {}) click to toggle source
# File lib/BOAST/Language/Operators.rb, line 488
def initialize(target, source, options = {})
  @target = target
  @source = source
  @options = options
end

Public Instance Methods

pr() click to toggle source
# File lib/BOAST/Language/Operators.rb, line 518
def pr
  s=""
  s << indent
  s << to_s
  s << ";" if [C, CL, CUDA].include?( lang )
  output.puts s
  return self
end
to_s() click to toggle source
# File lib/BOAST/Language/Operators.rb, line 514
def to_s
  return to_var.to_s
end
to_var() click to toggle source
# File lib/BOAST/Language/Operators.rb, line 498
def to_var
  tar = @target
  tar = @target.to_var if @target.respond_to?(:to_var)
  src = @source
  src = @source.to_var if @source.respond_to?(:to_var)
  if tar.instance_of? Variable and tar.type.vector_length > 1 then
    return @target.copy("#{@target} = #{Load(@source, @target, @options)}", DISCARD_OPTIONS)
  elsif src.instance_of? Variable and src.type.vector_length > 1 then
    r_t, _ = transition(tar, src, Affectation)
    opts = @options.clone
    opts[:store_type] = r_t
    return @target.copy("#{Store(@target, @source, opts)}", DISCARD_OPTIONS)
  end
  return tar.copy("#{tar ? tar : @target} = #{src ? src : @source}", DISCARD_OPTIONS)
end
type() click to toggle source
# File lib/BOAST/Language/Operators.rb, line 494
def type
  return target.to_var.type
end