class XRBP::Overlay::Frame

Overlay Message Frame, prefixes Protobuf based message in with header describing size and type.

@private

Constants

TYPE_INFER

Attributes

data[RW]
size[R]
type[R]

Public Class Methods

from_msg(msg) click to toggle source
# File lib/xrbp/overlay/frame.rb, line 33
def self.from_msg(msg)
  # ...
end
header_size() click to toggle source
# File lib/xrbp/overlay/frame.rb, line 16
def self.header_size
  TYPE_INFER.size
end
new(type, size) click to toggle source
# File lib/xrbp/overlay/frame.rb, line 37
def initialize(type, size)
  @type = type
  @size = size

  @data = ""
end
type_name(t) click to toggle source
# File lib/xrbp/overlay/frame.rb, line 24
def self.type_name(t)
  Protocol::MessageType.lookup(t)
end

Public Instance Methods

<<(data) click to toggle source
# File lib/xrbp/overlay/frame.rb, line 52
def <<(data)
  remaining = size - @data.size
  @data += data[0..remaining-1]
  return @data, data[remaining..-1]
end
complete?() click to toggle source
# File lib/xrbp/overlay/frame.rb, line 58
def complete?
  @data.size == size
end
header_size() click to toggle source
# File lib/xrbp/overlay/frame.rb, line 20
def header_size
  self.class.header_size
end
message() click to toggle source
# File lib/xrbp/overlay/frame.rb, line 48
def message
  @message ||= MESSAGES[type_name].decode(data)
end
type_name() click to toggle source
# File lib/xrbp/overlay/frame.rb, line 44
def type_name
  @type_name ||= self.class.type_name(type)
end