Method: OpenC3::Structure#append
- Defined in:
- lib/openc3/packets/structure.rb
#append(item) ⇒ StrutureItem
Adds an item at the end of the structure. It adds the item to the items hash and resizes the buffer to accommodate the new item.
314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/openc3/packets/structure.rb', line 314 def append(item) if item.data_type == :DERIVED item.bit_offset = 0 else # We're appending a new item so set the bit_offset item.bit_offset = @defined_length_bits # Also set original_bit_offset because it's currently 0 # due to PacketItemParser::create_packet_item # get_bit_offset() returning 0 if append item.original_bit_offset = @defined_length_bits end return define(item) end |