class Px4LogReader::Context

Container to hold the most recent copy of each message type

Attributes

messages[R]

Public Class Methods

new() click to toggle source
# File lib/px4_log_reader/reader.rb, line 80
def initialize
        @messages = {}
end

Public Instance Methods

find_by_name( name ) click to toggle source

Query the context for the most recent copy of a message by name

@param name [String] Message name

# File lib/px4_log_reader/reader.rb, line 88
def find_by_name( name )
        named_message = nil
        @messages.values.each do |message|
                if message.descriptor.name == name
                        named_message = message
                end
        end
        return named_message
end
find_by_type( type ) click to toggle source

Query the context for the most recent copy of a message by type

@param type [Fixnum] Message type

# File lib/px4_log_reader/reader.rb, line 102
def find_by_type( type )
        return @messages[ type ]
end
set( message ) click to toggle source

Set the most recent copy of a message by type. Any existing message is overwritten.

@param message [LogMessage] Message instance

# File lib/px4_log_reader/reader.rb, line 111
def set( message )
        @messages[ message.descriptor.type ] = message.dup
end