Class: Capnp::Segment

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Buffer
Defined in:
lib/capnp/runtime/segment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, buffer) ⇒ Segment

Returns a new instance of Segment.



12
13
14
15
# File 'lib/capnp/runtime/segment.rb', line 12

def initialize(message, buffer)
  @message = message
  @buffer = buffer
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



18
19
20
# File 'lib/capnp/runtime/segment.rb', line 18

def message
  @message
end

Instance Method Details

#read_bytes(offset, length) ⇒ Object



26
27
28
# File 'lib/capnp/runtime/segment.rb', line 26

def read_bytes(offset, length)
  @buffer.read_bytes(offset, length)
end

#read_f32(offset) ⇒ Object



71
72
73
# File 'lib/capnp/runtime/segment.rb', line 71

def read_f32(offset)
  @buffer.read_f32(offset)
end

#read_f64(offset) ⇒ Object



76
77
78
# File 'lib/capnp/runtime/segment.rb', line 76

def read_f64(offset)
  @buffer.read_f64(offset)
end

#read_s16(offset) ⇒ Object



56
57
58
# File 'lib/capnp/runtime/segment.rb', line 56

def read_s16(offset)
  @buffer.read_s16(offset)
end

#read_s32(offset) ⇒ Object



61
62
63
# File 'lib/capnp/runtime/segment.rb', line 61

def read_s32(offset)
  @buffer.read_s32(offset)
end

#read_s64(offset) ⇒ Object



66
67
68
# File 'lib/capnp/runtime/segment.rb', line 66

def read_s64(offset)
  @buffer.read_s64(offset)
end

#read_s8(offset) ⇒ Object



51
52
53
# File 'lib/capnp/runtime/segment.rb', line 51

def read_s8(offset)
  @buffer.read_s8(offset)
end

#read_string(offset, length) ⇒ Object



21
22
23
# File 'lib/capnp/runtime/segment.rb', line 21

def read_string(offset, length)
  @buffer.read_string(offset, length)
end

#read_u16(offset) ⇒ Object



36
37
38
# File 'lib/capnp/runtime/segment.rb', line 36

def read_u16(offset)
  @buffer.read_u16(offset)
end

#read_u32(offset) ⇒ Object



41
42
43
# File 'lib/capnp/runtime/segment.rb', line 41

def read_u32(offset)
  @buffer.read_u32(offset)
end

#read_u64(offset) ⇒ Object



46
47
48
# File 'lib/capnp/runtime/segment.rb', line 46

def read_u64(offset)
  @buffer.read_u64(offset)
end

#read_u8(offset) ⇒ Object



31
32
33
# File 'lib/capnp/runtime/segment.rb', line 31

def read_u8(offset)
  @buffer.read_u8(offset)
end

#sizeObject



81
82
83
# File 'lib/capnp/runtime/segment.rb', line 81

def size
  @buffer.size
end

#to_referenceObject



86
87
88
# File 'lib/capnp/runtime/segment.rb', line 86

def to_reference
  Capnp::Reference.new(self, 0)
end