Module: RubyTDMS::Streaming
- Included in:
- File
- Defined in:
- lib/ruby_tdms/streaming.rb
Instance Method Summary collapse
- #read_bool ⇒ Object
- #read_double ⇒ Object
- #read_double_be ⇒ Object
- #read_i16 ⇒ Object
- #read_i16_be ⇒ Object
- #read_i32 ⇒ Object
- #read_i32_be ⇒ Object
- #read_i64 ⇒ Object
- #read_i64_be ⇒ Object
- #read_i8 ⇒ Object
- #read_property(big_endian) ⇒ Object
- #read_single ⇒ Object
- #read_single_be ⇒ Object
- #read_timestamp ⇒ Object
- #read_u16 ⇒ Object
- #read_u16_be ⇒ Object
- #read_u32 ⇒ Object
- #read_u32_be ⇒ Object
- #read_u64 ⇒ Object
- #read_u64_be ⇒ Object
- #read_u8 ⇒ Object
- #read_utf8_string ⇒ Object
Instance Method Details
#read_bool ⇒ Object
15 16 17 |
# File 'lib/ruby_tdms/streaming.rb', line 15 def read_bool read(1) != "\000" end |
#read_double ⇒ Object
100 101 102 |
# File 'lib/ruby_tdms/streaming.rb', line 100 def read_double read(8).unpack('E')[0] end |
#read_double_be ⇒ Object
105 106 107 |
# File 'lib/ruby_tdms/streaming.rb', line 105 def read_double_be read(8).unpack('G')[0] end |
#read_i16 ⇒ Object
60 61 62 |
# File 'lib/ruby_tdms/streaming.rb', line 60 def read_i16 read(2).unpack('s<')[0] end |
#read_i16_be ⇒ Object
65 66 67 |
# File 'lib/ruby_tdms/streaming.rb', line 65 def read_i16_be read(2).unpack('s>')[0] end |
#read_i32 ⇒ Object
70 71 72 |
# File 'lib/ruby_tdms/streaming.rb', line 70 def read_i32 read(4).unpack('l<')[0] end |
#read_i32_be ⇒ Object
75 76 77 |
# File 'lib/ruby_tdms/streaming.rb', line 75 def read_i32_be read(4).unpack('l>')[0] end |
#read_i64 ⇒ Object
80 81 82 |
# File 'lib/ruby_tdms/streaming.rb', line 80 def read_i64 read(8).unpack('q<')[0] end |
#read_i64_be ⇒ Object
85 86 87 |
# File 'lib/ruby_tdms/streaming.rb', line 85 def read_i64_be read(8).unpack('q>')[0] end |
#read_i8 ⇒ Object
55 56 57 |
# File 'lib/ruby_tdms/streaming.rb', line 55 def read_i8 read(1).unpack('c')[0] end |
#read_property(big_endian) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/ruby_tdms/streaming.rb', line 6 def read_property(big_endian) name = read_utf8_string type_id = read_u32 data = DataTypes.find_by_id(type_id).read_from_stream self, big_endian Property.new name, data end |
#read_single ⇒ Object
90 91 92 |
# File 'lib/ruby_tdms/streaming.rb', line 90 def read_single read(4).unpack('e')[0] end |
#read_single_be ⇒ Object
95 96 97 |
# File 'lib/ruby_tdms/streaming.rb', line 95 def read_single_be read(4).unpack('g')[0] end |
#read_timestamp ⇒ Object
116 117 118 119 120 121 122 |
# File 'lib/ruby_tdms/streaming.rb', line 116 def positive_fractions_of_second = read_u64 # ignored seconds_since_labview_epoch = read(8).unpack('q<')[0] labview_epoch = ::DateTime.new(1904, 1, 1) labview_epoch + Rational(seconds_since_labview_epoch, 86400) end |
#read_u16 ⇒ Object
25 26 27 |
# File 'lib/ruby_tdms/streaming.rb', line 25 def read_u16 read(2).unpack('S<')[0] end |
#read_u16_be ⇒ Object
30 31 32 |
# File 'lib/ruby_tdms/streaming.rb', line 30 def read_u16_be read(2).unpack('S>')[0] end |
#read_u32 ⇒ Object
35 36 37 |
# File 'lib/ruby_tdms/streaming.rb', line 35 def read_u32 read(4).unpack('L<')[0] end |
#read_u32_be ⇒ Object
40 41 42 |
# File 'lib/ruby_tdms/streaming.rb', line 40 def read_u32_be read(4).unpack('L>')[0] end |
#read_u64 ⇒ Object
45 46 47 |
# File 'lib/ruby_tdms/streaming.rb', line 45 def read_u64 read(8).unpack('Q<')[0] end |
#read_u64_be ⇒ Object
50 51 52 |
# File 'lib/ruby_tdms/streaming.rb', line 50 def read_u64_be read(8).unpack('Q>')[0] end |
#read_u8 ⇒ Object
20 21 22 |
# File 'lib/ruby_tdms/streaming.rb', line 20 def read_u8 read(1).unpack('C')[0] end |
#read_utf8_string ⇒ Object
110 111 112 113 |
# File 'lib/ruby_tdms/streaming.rb', line 110 def read_utf8_string length = read_u32 read length end |