Class: Rbind::GeneratorC::OperationsHelper

Inherits:
HelperBase
  • Object
show all
Defined in:
lib/rbind/generator_c.rb

Defined Under Namespace

Classes: OperationHelper

Instance Attribute Summary

Attributes inherited from HelperBase

#includes, #name

Instance Method Summary collapse

Methods inherited from HelperBase

#binding, #wrap_includes

Constructor Details

#initialize(name, root) ⇒ OperationsHelper

Returns a new instance of OperationsHelper.



242
243
244
245
# File 'lib/rbind/generator_c.rb', line 242

def initialize(name,root)
    super
    @operation_wrapper = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","operation_wrapper.cc")).read,nil,"-")
end

Instance Method Details

#operation_wrapper(op) ⇒ Object



247
248
249
250
251
# File 'lib/rbind/generator_c.rb', line 247

def operation_wrapper(op)
    raise unless op
    op2 = OperationHelper.new(op)
    @operation_wrapper.result(op2.binding)
end

#wrap_operationsObject



253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/rbind/generator_c.rb', line 253

def wrap_operations
    str = ""
    @root.each_type do |type|
        next unless type.respond_to? :operations
        str += type.operations.map do |ops|
            ops.map do |op|
                operation_wrapper(op)
            end.join("\n")
        end.join("\n")
    end
    str
end