module Argus::CFields::ClassMethods
Public Instance Methods
allot(n=1)
click to toggle source
# File lib/argus/cfields.rb 28 def allot(n=1) 29 result = data_index 30 @data_index += n 31 result 32 end
data_index()
click to toggle source
# File lib/argus/cfields.rb 20 def data_index 21 @data_index ||= 0 22 end
define_array_field(name, size, format, width, transform)
click to toggle source
# File lib/argus/cfields.rb 48 def define_array_field(name, size, format, width, transform) 49 index = allot(width*size) 50 format_string << "#{format}#{width*size}" 51 define_method(name) { @data[index, width*size] } 52 end
define_field(name, size, format, width=1, &transform)
click to toggle source
# File lib/argus/cfields.rb 34 def define_field(name, size, format, width=1, &transform) 35 if size 36 define_array_field(name, size, format, width, transform) 37 else 38 define_scaler_field(name, format, width, transform) 39 end 40 end
define_scaler_field(name, format, width, transform)
click to toggle source
# File lib/argus/cfields.rb 42 def define_scaler_field(name, format, width, transform) 43 index = allot(width) 44 format_string << (width==1 ? format : "#{format}#{width}") 45 define_method(name) { @data[index] } 46 end
float32_t(name, size=nil)
click to toggle source
# File lib/argus/cfields.rb 62 def float32_t(name, size=nil) 63 define_field(name, size, "e") 64 end
format_string()
click to toggle source
# File lib/argus/cfields.rb 24 def format_string 25 @format_string ||= (defined?(initial_format) ? initial_format : "") 26 end
int32_t(name, size=nil)
click to toggle source
# File lib/argus/cfields.rb 66 def int32_t(name, size=nil) 67 define_field(name, size, "l<") 68 end
matrix33_t(name, size=nil)
click to toggle source
# File lib/argus/cfields.rb 70 def matrix33_t(name, size=nil) 71 define_field(name, size, "V", 9) 72 end
uint16_t(name, size=nil)
click to toggle source
# File lib/argus/cfields.rb 58 def uint16_t(name, size=nil) 59 define_field(name, size, "v") 60 end
uint32_t(name, size=nil)
click to toggle source
# File lib/argus/cfields.rb 54 def uint32_t(name, size=nil) 55 define_field(name, size, "V") 56 end
vector31_t(name, size=nil)
click to toggle source
# File lib/argus/cfields.rb 74 def vector31_t(name, size=nil) 75 define_field(name, size, "V", 3) 76 end