class BOAST::CaseCondition
@!parse module Functors
; functorize CaseCondition
; end
Attributes
block[R]
constants[R]
Public Class Methods
new(constants = nil, &block)
click to toggle source
Calls superclass method
# File lib/BOAST/Language/Case.rb, line 8 def initialize(constants = nil, &block) super() @constants = constants @block = block end
Public Instance Methods
close()
click to toggle source
# File lib/BOAST/Language/Case.rb, line 54 def close if @constants and break_string then s = "" s << indent s << break_string output.puts s end decrement_indent_level return self end
open()
click to toggle source
# File lib/BOAST/Language/Case.rb, line 45 def open s = "" s << indent s << to_s output.puts s increment_indent_level return self end
pr(*args, &block)
click to toggle source
# File lib/BOAST/Language/Case.rb, line 65 def pr(*args, &block) args = @args if args.length == 0 and @args block = @block unless block open if block then block.call(*args) close end return self end
to_s()
click to toggle source
# File lib/BOAST/Language/Case.rb, line 35 def to_s s = "" if @constants then s << case_string(@constants) else s << default_string end return s end
Private Instance Methods
get_c_strings()
click to toggle source
# File lib/BOAST/Language/Case.rb, line 14 def get_c_strings return { :case => '"case #{constants.join(" : case ")} :"', :default => '"default :"', :break => '"break;"' } end
Also aliased as: get_cl_strings, get_cuda_strings
get_fortran_strings()
click to toggle source
# File lib/BOAST/Language/Case.rb, line 20 def get_fortran_strings return { :case => '"case (#{constants.join(", ")})"', :default => '"case default"', :break => 'nil' } end