Class: Ronin::Support::Binary::CTypes::AggregateType Private
- Defined in:
- lib/ronin/support/binary/ctypes/aggregate_type.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Base class for all aggregate types.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Type
Instance Method Summary collapse
-
#length ⇒ Integer, Float::INFINITY
abstract
private
The number of elements within the aggregate type.
-
#pack(value) ⇒ String
Packs the value into the aggregate type's binary format.
-
#unpack(data) ⇒ Integer, ...
Unpacks the binary data.
Methods inherited from Type
#[], #align, #alignment, #dequeue_value, #enqueue_value, #initialize, #size, #uninitialized_value
Constructor Details
This class inherits a constructor from Ronin::Support::Binary::CTypes::Type
Instance Method Details
#length ⇒ Integer, Float::INFINITY
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method is abstract.
The number of elements within the aggregate type.
41 42 43 |
# File 'lib/ronin/support/binary/ctypes/aggregate_type.rb', line 41 def length raise(NotImplementedError,"#{self.class}##{__method__} was not implemented") end |
#pack(value) ⇒ String
Packs the value into the aggregate type's binary format.
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/ronin/support/binary/ctypes/aggregate_type.rb', line 59 def pack(value) if @pack_string values = [] enqueue_value(values,value) return values.pack(@pack_string) else raise(NotImplementedError,"#{self.class} does not define a #pack_string") end end |
#unpack(data) ⇒ Integer, ...
Unpacks the binary data.
84 85 86 87 88 89 90 91 92 |
# File 'lib/ronin/support/binary/ctypes/aggregate_type.rb', line 84 def unpack(data) if @pack_string values = data.unpack(@pack_string) return dequeue_value(values) else raise(NotImplementedError,"#{self.class} does not define a #pack_string") end end |