Module: RubyTDMS::Streaming

Included in:
File
Defined in:
lib/ruby_tdms/streaming.rb

Instance Method Summary collapse

Instance Method Details

#read_boolObject



15
16
17
# File 'lib/ruby_tdms/streaming.rb', line 15

def read_bool
	read(1) != "\000"
end

#read_doubleObject



100
101
102
# File 'lib/ruby_tdms/streaming.rb', line 100

def read_double
	read(8).unpack('E')[0]
end

#read_double_beObject



105
106
107
# File 'lib/ruby_tdms/streaming.rb', line 105

def read_double_be
	read(8).unpack('G')[0]
end

#read_i16Object



60
61
62
# File 'lib/ruby_tdms/streaming.rb', line 60

def read_i16
	read(2).unpack('s<')[0]
end

#read_i16_beObject



65
66
67
# File 'lib/ruby_tdms/streaming.rb', line 65

def read_i16_be
	read(2).unpack('s>')[0]
end

#read_i32Object



70
71
72
# File 'lib/ruby_tdms/streaming.rb', line 70

def read_i32
	read(4).unpack('l<')[0]
end

#read_i32_beObject



75
76
77
# File 'lib/ruby_tdms/streaming.rb', line 75

def read_i32_be
	read(4).unpack('l>')[0]
end

#read_i64Object



80
81
82
# File 'lib/ruby_tdms/streaming.rb', line 80

def read_i64
	read(8).unpack('q<')[0]
end

#read_i64_beObject



85
86
87
# File 'lib/ruby_tdms/streaming.rb', line 85

def read_i64_be
	read(8).unpack('q>')[0]
end

#read_i8Object



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_singleObject



90
91
92
# File 'lib/ruby_tdms/streaming.rb', line 90

def read_single
	read(4).unpack('e')[0]
end

#read_single_beObject



95
96
97
# File 'lib/ruby_tdms/streaming.rb', line 95

def read_single_be
	read(4).unpack('g')[0]
end

#read_timestampObject



116
117
118
119
120
121
122
# File 'lib/ruby_tdms/streaming.rb', line 116

def read_timestamp
	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_u16Object



25
26
27
# File 'lib/ruby_tdms/streaming.rb', line 25

def read_u16
	read(2).unpack('S<')[0]
end

#read_u16_beObject



30
31
32
# File 'lib/ruby_tdms/streaming.rb', line 30

def read_u16_be
	read(2).unpack('S>')[0]
end

#read_u32Object



35
36
37
# File 'lib/ruby_tdms/streaming.rb', line 35

def read_u32
	read(4).unpack('L<')[0]
end

#read_u32_beObject



40
41
42
# File 'lib/ruby_tdms/streaming.rb', line 40

def read_u32_be
	read(4).unpack('L>')[0]
end

#read_u64Object



45
46
47
# File 'lib/ruby_tdms/streaming.rb', line 45

def read_u64
	read(8).unpack('Q<')[0]
end

#read_u64_beObject



50
51
52
# File 'lib/ruby_tdms/streaming.rb', line 50

def read_u64_be
	read(8).unpack('Q>')[0]
end

#read_u8Object



20
21
22
# File 'lib/ruby_tdms/streaming.rb', line 20

def read_u8
	read(1).unpack('C')[0]
end

#read_utf8_stringObject



110
111
112
113
# File 'lib/ruby_tdms/streaming.rb', line 110

def read_utf8_string
	length = read_u32
	read length
end