Class: Cosmos::TableItem
- Inherits:
-
PacketItem
- Object
- StructureItem
- PacketItem
- Cosmos::TableItem
- Defined in:
- lib/cosmos/tools/table_manager/table_item.rb
Overview
Maintains knowledge of an item in a Table
Constant Summary
Constants inherited from PacketItem
Instance Attribute Summary collapse
-
#constraint ⇒ Object
Returns the value of attribute constraint.
-
#display_type ⇒ Object
Returns the value of attribute display_type.
-
#editable ⇒ Object
Returns the value of attribute editable.
Attributes inherited from PacketItem
#default, #description, #format_string, #hazardous, #id_value, #limits, #range, #read_conversion, #required, #state_colors, #states, #units, #units_full, #write_conversion
Instance Method Summary collapse
-
#clone ⇒ Object
(also: #dup)
Make a light weight clone of this item.
-
#initialize(name, bit_offset, bit_size, data_type, endianness, array_size = nil, overflow = :ERROR) ⇒ TableItem
constructor
Create a StructureItem by setting all the attributes.
- #to_hash ⇒ Object
Methods inherited from PacketItem
#check_default_and_range_data_types, #meta
Constructor Details
#initialize(name, bit_offset, bit_size, data_type, endianness, array_size = nil, overflow = :ERROR) ⇒ TableItem
Create a StructureItem by setting all the attributes. It calls all the setter routines to do the attribute verification and then verifies the overall integrity.
It also initializes the attributes of the PacketItem. It also initializes the attributes of the TableItem.
23 24 25 26 27 28 |
# File 'lib/cosmos/tools/table_manager/table_item.rb', line 23 def initialize(name, bit_offset, bit_size, data_type, endianness, array_size = nil, overflow = :ERROR) super(name, bit_offset, bit_size, data_type, endianness, array_size, overflow) @display_type = nil @editable = true @constraint = nil end |
Instance Attribute Details
#constraint ⇒ Object
Returns the value of attribute constraint.
19 20 21 |
# File 'lib/cosmos/tools/table_manager/table_item.rb', line 19 def constraint @constraint end |
#display_type ⇒ Object
Returns the value of attribute display_type.
17 18 19 |
# File 'lib/cosmos/tools/table_manager/table_item.rb', line 17 def display_type @display_type end |
#editable ⇒ Object
Returns the value of attribute editable.
18 19 20 |
# File 'lib/cosmos/tools/table_manager/table_item.rb', line 18 def editable @editable end |
Instance Method Details
#clone ⇒ Object Also known as: dup
Make a light weight clone of this item
49 50 51 52 53 |
# File 'lib/cosmos/tools/table_manager/table_item.rb', line 49 def clone item = super() item.constraint = self.constraint.clone if self.constraint item end |
#to_hash ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/cosmos/tools/table_manager/table_item.rb', line 56 def to_hash hash = super() if self.display_type hash['display_type'] = self.display_type.to_s else hash['display_type'] = nil end hash['editable'] = self.editable if self.constraint hash['constraint'] = self.constraint.to_s else hash['constraint'] = nil end hash end |