Sha256: eb5b156a6163e253cd014a2f3c867ba760c4ce3acc5fb772ae0da4708350c65b
Contents?: true
Size: 1.62 KB
Versions: 24
Compression:
Stored size: 1.62 KB
Contents
# encoding: ascii-8bit # Copyright 2014 Ball Aerospace & Technologies Corp. # All Rights Reserved. # # This program is free software; you can modify and/or redistribute it # under the terms of the GNU General Public License # as published by the Free Software Foundation; version 3 with # attribution addendums as found in the LICENSE.txt require 'cosmos/packets/packet_config' require 'cosmos/packets/packet_item' module Cosmos # Extends the PacketItemParser to create TableItems for TableManager class TableItemParser < PacketItemParser # @param parser [ConfigParser] Configuration parser # @param table [Table] Table all parsed items should be added to # # @param warnings [Array<String>] Array of warning strings from PacketConfig def self.parse(parser, table, warnings) parser = TableItemParser.new(parser, warnings) parser.verify_parameters(PacketConfig::COMMAND) parser.create_table_item(table) end # @param table [Table] Table created items are added to def create_table_item(table) name = @parser.parameters[0] if table.type == :TWO_DIMENSIONAL name = "#{name}0" table.num_columns += 1 end item = TableItem.new(name, get_bit_offset(), get_bit_size(), get_data_type(), get_endianness(table), get_array_size(), :ERROR) # overflow item.range = get_range() item.default = get_default() item.description = get_description() if append? item = table.append(item) else item = table.define(item) end item rescue => err raise @parser.error(err, @usage) end end end
Version data entries
24 entries across 24 versions & 1 rubygems