Module: OroGen::TypekitMarshallers::Corba::ArrayType

Defined in:
lib/orogen/marshallers/corba.rb

Instance Method Summary collapse

Instance Method Details

#corba_arg_typeObject


384
# File 'lib/orogen/marshallers/corba.rb', line 384

def corba_arg_type; "#{deference.corba_name} const*" end

#corba_ref_typeObject


385
# File 'lib/orogen/marshallers/corba.rb', line 385

def corba_ref_type; "#{deference.corba_name}*" end

#from_corba(typekit, result, indent) ⇒ Object


401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/orogen/marshallers/corba.rb', line 401

def from_corba(typekit, result, indent)
    element_type = deference.name
    element_type = registry.build(element_type)

    # Special case for array of numerics, we can do a simple memcpy
    if  element_type < NumericType 
        result << "#{indent}const int array_size = length * sizeof(#{element_type.cxx_name});\n"
        result << "#{indent}memcpy(value, corba, array_size);"
    else
        code_copy(typekit, result, indent, "value", "corba", "fromCORBA") do |type, _|
            type.inlines_code?
        end
    end
end

#to_corba(typekit, result, indent) ⇒ Object


387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/orogen/marshallers/corba.rb', line 387

def to_corba(typekit, result, indent)
    element_type = deference.name
    element_type = registry.build(element_type)

    # Special case for array of numerics, we can do a simple memcpy
    if  element_type < NumericType 
        result << "#{indent}const int array_size = length * sizeof(#{element_type.cxx_name});\n"
        result << "#{indent}memcpy(corba, value, array_size);"
    else
        code_copy(typekit, result, indent, "corba", "value", "toCORBA") do |type, _|
            type.inlines_code?
        end
    end
end