Class: ArrowFormat::Org::Apache::Arrow::Flatbuf::Message

Inherits:
FlatBuffers::RootTable
  • Object
show all
Defined in:
lib/arrow-format/org/apache/arrow/flatbuf/message.rb

Constant Summary collapse

FIELDS =
{
  version: ::FlatBuffers::Field.new(:version, 0, 4, :short, 0),
  header_type: ::FlatBuffers::Field.new(:header_type, 1, 6, :utype, 0),
  header: ::FlatBuffers::Field.new(:header, 2, 8, "::ArrowFormat::Org::Apache::Arrow::Flatbuf::MessageHeader", 0),
  body_length: ::FlatBuffers::Field.new(:body_length, 3, 10, :long, 0),
  custom_metadata: ::FlatBuffers::Field.new(:custom_metadata, 4, 12, ["::ArrowFormat::Org::Apache::Arrow::Flatbuf::KeyValue"], 0),
}
Data =
define_data_class

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.file_extensionObject



23
24
25
# File 'lib/arrow-format/org/apache/arrow/flatbuf/message.rb', line 23

def file_extension
  ""
end

.file_identifierObject



19
20
21
# File 'lib/arrow-format/org/apache/arrow/flatbuf/message.rb', line 19

def file_identifier
  ""
end

Instance Method Details

#body_lengthObject



38
39
40
41
42
43
# File 'lib/arrow-format/org/apache/arrow/flatbuf/message.rb', line 38

def body_length
  field_offset = @view.unpack_virtual_offset(10)
  return 0 if field_offset.zero?

  @view.unpack_long(field_offset)
end

#custom_metadataObject



45
46
47
48
49
50
51
52
53
# File 'lib/arrow-format/org/apache/arrow/flatbuf/message.rb', line 45

def 
  field_offset = @view.unpack_virtual_offset(12)
  return nil if field_offset.zero?

  element_size = 4
  @view.unpack_vector(field_offset, element_size) do |element_offset|
    @view.unpack_table(::ArrowFormat::Org::Apache::Arrow::Flatbuf::KeyValue, element_offset)
  end
end

#headerObject



55
56
57
58
59
60
61
62
# File 'lib/arrow-format/org/apache/arrow/flatbuf/message.rb', line 55

def header
  type = header_type
  return nil if type.nil?

  field_offset = @view.unpack_virtual_offset(8)
  return nil if field_offset.zero?
  @view.unpack_union(type.table_class, field_offset)
end

#header_typeObject



64
65
66
67
68
69
70
71
72
# File 'lib/arrow-format/org/apache/arrow/flatbuf/message.rb', line 64

def header_type
  field_offset = @view.unpack_virtual_offset(6)
  if field_offset.zero?
    enum_value = 0
  else
    enum_value = @view.unpack_utype(field_offset)
  end
  ::ArrowFormat::Org::Apache::Arrow::Flatbuf::MessageHeader.try_convert(enum_value) || enum_value
end

#versionObject



74
75
76
77
78
79
80
81
82
# File 'lib/arrow-format/org/apache/arrow/flatbuf/message.rb', line 74

def version
  field_offset = @view.unpack_virtual_offset(4)
  if field_offset.zero?
    enum_value = 0
  else
    enum_value = @view.unpack_short(field_offset)
  end
  ::ArrowFormat::Org::Apache::Arrow::Flatbuf::MetadataVersion.try_convert(enum_value) || enum_value
end