Class: Orocos::Log::Annotations

Inherits:
Object
  • Object
show all
Defined in:
lib/orocos/log/replay.rb

Overview

class which is storing stream annotions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, stream) ⇒ Annotations

Returns a new instance of Annotations



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/orocos/log/replay.rb', line 16

def initialize(path,stream)
    @samples = Array.new
    @file_name = path
    @stream = stream
    @current_state = Hash.new

    stream.samples.each do |rt,lg,sample|
        @samples << sample
    end

    @samples.sort! do |a,b|
        a.time <=> b.time
    end
end

Instance Attribute Details

#current_stateObject (readonly)

Returns the value of attribute current_state



14
15
16
# File 'lib/orocos/log/replay.rb', line 14

def current_state
  @current_state
end

#file_nameObject (readonly)

Returns the value of attribute file_name



13
14
15
# File 'lib/orocos/log/replay.rb', line 13

def file_name
  @file_name
end

#samplesObject (readonly)

Returns the value of attribute samples



11
12
13
# File 'lib/orocos/log/replay.rb', line 11

def samples
  @samples
end

#streamObject (readonly)

Returns the value of attribute stream



12
13
14
# File 'lib/orocos/log/replay.rb', line 12

def stream
  @stream
end

Instance Method Details

#pretty_print(pp) ⇒ Object



37
38
39
# File 'lib/orocos/log/replay.rb', line 37

def pretty_print(pp)
    pp.text "Stream name #{@file_name}, number of annotations #{@annotations.size}"
end

#update(info) ⇒ Object



31
32
33
34
35
# File 'lib/orocos/log/replay.rb', line 31

def update(info)
    stream, position = *info
    sample = stream.read_one_raw_data_sample(position)
    current_state[sample.key] = sample.value
end