Method: OpenC3::Structure#append_item
- Defined in:
- lib/openc3/packets/structure.rb
#append_item(name, bit_size, data_type, array_size = nil, endianness = @default_endianness, overflow = :ERROR) ⇒ StrutureItem
Define an item at the end of the structure. This creates a new instance of the item_class as given in the constructor and adds it to the items hash. It also resizes the buffer to accomodate the new item.
301 302 303 304 305 306 307 308 |
# File 'lib/openc3/packets/structure.rb', line 301 def append_item(name, bit_size, data_type, array_size = nil, endianness = @default_endianness, overflow = :ERROR) raise ArgumentError, "Can't append an item after a variably sized item" if !@fixed_size if data_type == :DERIVED return define_item(name, 0, bit_size, data_type, array_size, endianness, overflow) else return define_item(name, @defined_length_bits, bit_size, data_type, array_size, endianness, overflow) end end |