Sha256: f0b6352f003f94cd9d763f75d5dbb8206cf6ccc9ca94d970de2a314e21ba1421

Contents?: true

Size: 1.45 KB

Versions: 15

Compression:

Stored size: 1.45 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
  class TableItemParser < PacketItemParser
    # @param parser [ConfigParser] Configuration parser
    # @param table [Table] Table all parsed items should be added to
    def self.parse(parser, table)
      parser = TableItemParser.new(parser)
      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

15 entries across 15 versions & 1 rubygems

Version Path
cosmos-4.1.1-java lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.1.1 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.1.0-java lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.1.0 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.0.3-java lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.0.3-universal-java-1.8 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.0.3 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.0.2-universal-java-1.8 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.0.2 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.0.1-universal-java-1.8 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.0.1 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.0.0-universal-java-1.8 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-4.0.0 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-3.9.2 lib/cosmos/tools/table_manager/table_item_parser.rb
cosmos-3.9.1 lib/cosmos/tools/table_manager/table_item_parser.rb