Method: OpenC3::BinaryAccessor.check_overflow_array

Defined in:
lib/openc3/accessors/binary_accessor.rb

.check_overflow_array(values, min_value, max_value, hex_max_value, bit_size, data_type, overflow) ⇒ Array[Integer]

Checks for overflow of an array of integer data types

Parameters:

  • values (Array[Integer])

    Values to write into the buffer

  • min_value (Integer)

    Minimum allowed value

  • max_value (Integer)

    Maximum allowed value

  • hex_max_value (Integer)

    Maximum allowed value if specified in hex

  • bit_size (Integer)

    Size of the item in bits

  • data_type (Symbol)
  • overflow (Symbol)

Returns:

  • (Array[Integer])

    Potentially modified values



1382
1383
1384
1385
1386
1387
1388
1389
# File 'lib/openc3/accessors/binary_accessor.rb', line 1382

def self.check_overflow_array(values, min_value, max_value, hex_max_value, bit_size, data_type, overflow)
  if overflow != :TRUNCATE
    values.each_with_index do |value, index|
      values[index] = check_overflow(value, min_value, max_value, hex_max_value, bit_size, data_type, overflow)
    end
  end
  values
end