Class: OpenC3::TableItemParser

Inherits:
PacketItemParser show all
Defined in:
lib/openc3/tools/table_manager/table_item_parser.rb

Overview

Extends the PacketItemParser to create TableItems for TableManager

Constant Summary

Constants inherited from PacketItemParser

PacketItemParser::BIG_ARRAY_SIZE

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PacketItemParser

#create_packet_item, #initialize, #verify_parameters

Constructor Details

This class inherits a constructor from OpenC3::PacketItemParser

Class Method Details

.parse(parser, table, warnings) ⇒ Object

# @param warnings [Array<String>] Array of warning strings from PacketConfig

Parameters:

  • parser (ConfigParser)

    Configuration parser

  • table (Table)

    Table all parsed items should be added to



33
34
35
36
37
# File 'lib/openc3/tools/table_manager/table_item_parser.rb', line 33

def self.parse(parser, table, warnings)
  parser = TableItemParser.new(parser, warnings)
  parser.verify_parameters(PacketConfig::COMMAND)
  parser.create_table_item(table)
end

Instance Method Details

#create_table_item(table) ⇒ Object

Parameters:

  • table (Table)

    Table created items are added to



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/openc3/tools/table_manager/table_item_parser.rb', line 40

def create_table_item(table)
  name = @parser.parameters[0]
  if table.type == :ROW_COLUMN
    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
end