module BitStream

Author

Natsuki Kawai (natsuki.kawai@gmail.com)

Copyright

Copyright © 2012 Natsuki Kawai

License

2-clause BSDL or Ruby’s

Author

Natsuki Kawai (natsuki.kawai@gmail.com)

Copyright

Copyright 2011 Natsuki Kawai

License

2-clause BSDL or Ruby’s

Constants

Properties

Attributes

bitstream_properties[RW]

def properties=(props)

Method to override.

end

Public Class Methods

included(obj) click to toggle source
# File lib/bitstream.rb, line 523
def self.included(obj)
  obj.extend ClassMethods
  obj.initialize_for_class_methods(ClassMethods.types)
end

Public Instance Methods

initialize_properties(s, offset = 0) click to toggle source
# File lib/bitstream.rb, line 533
def initialize_properties(s, offset = 0)
  props = Properties.new
  props.curr_offset = offset
  props.fields = {}
  props.raw_data = s
  props.initial_offset = offset
  props.eval_queue = Queue.new
  props.substreams = Hash.new do |hash, key|
    hash[key] = []
  end
  @bitstream_properties = props
end
initialize_with_fields() click to toggle source
# File lib/bitstream.rb, line 528
def initialize_with_fields
  # Nothing to do.
  # Override me if you want to do anything after all fields has been defined.
end
length() click to toggle source
# File lib/bitstream.rb, line 546
def length
  props = @bitstream_properties
  queue = props.eval_queue
  queue.peek_back.index unless queue.empty?
  props.curr_offset - props.initial_offset
end
substreams() click to toggle source
# File lib/bitstream.rb, line 553
def substreams
  @bitstream_properties.substreams.values
end