Class: OroGen::Spec::OpaqueDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/orogen/spec/opaque_definition.rb

Overview

Data structure that represents the definition for an opaque type

See Typekit#opaque_type

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, intermediate, options, code_generator) ⇒ OpaqueDefinition

Returns a new instance of OpaqueDefinition



22
23
24
25
26
27
28
29
# File 'lib/orogen/spec/opaque_definition.rb', line 22

def initialize(type, intermediate, options, code_generator)
    if !type || !intermediate
        raise ArgumentError, "trying to create an opaque definition with nil types"
    end

    @type, @intermediate, @options, @code_generator =
        type, intermediate, options, code_generator
end

Instance Attribute Details

#callerObject

Backtrace at the definition point



20
21
22
# File 'lib/orogen/spec/opaque_definition.rb', line 20

def caller
  @caller
end

#code_generatorObject (readonly)

If non-nil, this is a block which, when called, will return the C++ code needed to convert type into intermediate. If nil, it is assumed that the user will provide that code.



17
18
19
# File 'lib/orogen/spec/opaque_definition.rb', line 17

def code_generator
  @code_generator
end

#intermediateObject (readonly)

The Typelib::Type subclass that represents the intermediate type used to marshal this opaque



11
12
13
# File 'lib/orogen/spec/opaque_definition.rb', line 11

def intermediate
  @intermediate
end

#optionsObject (readonly)

Option hash



13
14
15
# File 'lib/orogen/spec/opaque_definition.rb', line 13

def options
  @options
end

#typeObject (readonly)

The Typelib::Type subclass that represents this opaque



8
9
10
# File 'lib/orogen/spec/opaque_definition.rb', line 8

def type
  @type
end

Instance Method Details

#generate_templates?Boolean

If true, the convertion function is provided by the user, and orogen should therefore generate the corresponding templates.

Returns:

  • (Boolean)


38
# File 'lib/orogen/spec/opaque_definition.rb', line 38

def generate_templates?; !code_generator end

#includesObject

The set of paths that should be added to -I to the generated type to intermediate convertion.



32
# File 'lib/orogen/spec/opaque_definition.rb', line 32

def includes; options[:include] end

#needs_copy?Boolean

If true, the opaque needs to be copied into the intermediate. If false, the convertion does not require a copy.

Returns:

  • (Boolean)


35
# File 'lib/orogen/spec/opaque_definition.rb', line 35

def needs_copy?; !!options[:needs_copy] end