Class: CallStruct

Inherits:
Object
  • Object
show all
Defined in:
ext/generate_gvl_code.rb

Overview

the struct that holds the call args for zoo_fn_name

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(zoo_fn_name, typed_args) ⇒ CallStruct

Returns a new instance of CallStruct.



71
72
73
74
# File 'ext/generate_gvl_code.rb', line 71

def initialize(zoo_fn_name, typed_args)
  @zoo_fn_name, @typed_args = zoo_fn_name, typed_args
  @name = "zkrb_#{zoo_fn_name}_args_t"
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



69
70
71
# File 'ext/generate_gvl_code.rb', line 69

def name
  @name
end

#typed_argsObject (readonly)

Returns the value of attribute typed_args.



69
70
71
# File 'ext/generate_gvl_code.rb', line 69

def typed_args
  @typed_args
end

#zoo_fn_nameObject (readonly)

Returns the value of attribute zoo_fn_name.



69
70
71
# File 'ext/generate_gvl_code.rb', line 69

def zoo_fn_name
  @zoo_fn_name
end

Instance Method Details

#bodyObject



76
77
78
79
80
81
82
83
84
# File 'ext/generate_gvl_code.rb', line 76

def body
  @body ||= (
    lines = ["typedef struct {"]
    lines += typed_args.map{|n| "  #{n};"}
    lines << "  int rc;"
    lines << "} #{name};"
    lines.join("\n")
  )
end