Class: Cosmos::Table
- Defined in:
- lib/cosmos/tools/table_manager/table.rb
Overview
Table extends Packet by adding more attributes relative to displaying binary data in a gui.
Constant Summary
Constants inherited from Packet
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#num_columns ⇒ Object
Returns the value of attribute num_columns.
-
#num_rows ⇒ Object
Returns the value of attribute num_rows.
-
#table_id ⇒ Object
readonly
Returns the value of attribute table_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Packet
#description, #disabled, #given_values, #hazardous, #hazardous_description, #hidden, #messages_disabled, #packet_name, #packet_rate, #raw, #received_count, #received_time, #stale, #target_name
Instance Method Summary collapse
-
#create_param(name, bit_offset, bit_size, type, description, range, default, display_type, editable) ⇒ Object
Calls define_item in Packet but also incrememts @num_columns if this table is a REPEATING table.
-
#duplicate_item(item, name_extension, bit_offset) ⇒ Object
Calls define_packet_item in GenericPacket to duplicate the passed in packet item.
-
#initialize(name, description, type, endianness, table_id, filename) ⇒ Table
constructor
Constructor for a TableDefinition.
Methods inherited from Packet
#append_item, #buffer=, #check_bit_offsets, #check_limits, #clone, #define, #define_item, #description=, #disable_limits, #enable_limits, #formatted, #get_item, #id_items, #identified?, #identify?, #limits_change_callback=, #limits_items, #meta, #out_of_limits, #packet_name=, #processors, #read, #read_all, #read_all_with_limits_states, #read_item, #received_count=, #received_time=, #reset, #restore_defaults, #set_all_limits_states, #set_received_time_fast, #set_stale, #target_name=, #update_limits_items_cache, #write, #write_item
Constructor Details
#initialize(name, description, type, endianness, table_id, filename) ⇒ Table
Constructor for a TableDefinition
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cosmos/tools/table_manager/table.rb', line 27 def initialize(name, description, type, endianness, table_id, filename) super('TABLE', name, endianness, description, '', TableItem) @name = name @type = type @table_id = table_id @filename = filename @num_columns = 0 @num_rows = 0 @num_columns = 1 if @type == :ONE_DIMENSIONAL end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
24 25 26 |
# File 'lib/cosmos/tools/table_manager/table.rb', line 24 def filename @filename end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21 22 23 |
# File 'lib/cosmos/tools/table_manager/table.rb', line 21 def name @name end |
#num_columns ⇒ Object
Returns the value of attribute num_columns.
20 21 22 |
# File 'lib/cosmos/tools/table_manager/table.rb', line 20 def num_columns @num_columns end |
#num_rows ⇒ Object
Returns the value of attribute num_rows.
19 20 21 |
# File 'lib/cosmos/tools/table_manager/table.rb', line 19 def num_rows @num_rows end |
#table_id ⇒ Object (readonly)
Returns the value of attribute table_id.
23 24 25 |
# File 'lib/cosmos/tools/table_manager/table.rb', line 23 def table_id @table_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
22 23 24 |
# File 'lib/cosmos/tools/table_manager/table.rb', line 22 def type @type end |
Instance Method Details
#create_param(name, bit_offset, bit_size, type, description, range, default, display_type, editable) ⇒ Object
Calls define_item in Packet but also incrememts @num_columns if this table is a REPEATING table.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/cosmos/tools/table_manager/table.rb', line 40 def create_param(name, bit_offset, bit_size, type, description, range, default, display_type, editable) @num_columns += 1 if @type == :TWO_DIMENSIONAL item = define_item(name, bit_offset, bit_size, type) item.description = description item.range = range item.default = default item.display_type = display_type item.editable = editable item end |
#duplicate_item(item, name_extension, bit_offset) ⇒ Object
Calls define_packet_item in GenericPacket to duplicate the passed in packet item. name_extension is concatenated with the orignal item name to make it unique.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/cosmos/tools/table_manager/table.rb', line 54 def duplicate_item(item, name_extension, bit_offset) new_item = define_item("#{item.name[0...-1]}#{name_extension}", bit_offset, item.bit_size, item.data_type, item.array_size, item.endianness, item.overflow, item.format_string, item.read_conversion, item.write_conversion, item.id_value) new_item.description = item.description new_item.range = item.range new_item.display_type = item.display_type new_item.editable = item.editable new_item.states = item.states new_item.constraint = item.constraint new_item end |