| 1 | package Finnigan::InstrumentLogRecord; | ||
| 2 | |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings FATAL => qw( all ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | our $VERSION = 0.0206; | |
| 6 | |||
| 7 | 2 | ▶ | use Finnigan; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 2 | ▶ | use base 'Finnigan::Decoder'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 17 | ▶ | sub decode { |
|
Subroutine
decode: called CC=1 SCAR=0.0
Pod
documented
| |||
| 11 | 17 | my ($class, $stream, $field_templates) = @_; | |
| 12 | |||
| 13 | # This is a sleazy way of decoding this structure. The result will | ||
| 14 | # be a hash whose keys start with the ordinal numbers of elements; | ||
| 15 | # this answers the need to preserve order and to introduce gaps and | ||
| 16 | # section titles commanded by the GenericDataHeader but not present | ||
| 17 | # in the actual record. The field_templates() method of | ||
| 18 | # GenericDataHeader modifies all keys by adding ordinals to them. | ||
| 19 | 17 | my $self = Finnigan::Decoder->read($stream, | |
| 20 | [ | ||
| 21 | '0|time' => ['f<', 'Float32'], | ||
| 22 | @$field_templates # ordered templates from GenericDataHeader | ||
| 23 | ] | ||
| 24 | ); | ||
| 25 | 17 | return bless $self, $class; | |
| 26 | } | ||
| 27 | |||
| 28 | 1 | ▶ | sub time { |
|
Subroutine
time: called CC=1 SCAR=0.0
Pod
documented
| |||
| 29 | 1 | shift->{data}->{'0|time'}->{value}; | |
| 30 | } | ||
| 31 | |||
| 32 | 0 | ▶ | sub fields { |
|
Subroutine
fields: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 33 | 0 | my $self = shift; | |
| 34 | 0 | map{$self->{data}->{$_}} | |
| 35 | 0 | sort {(split /\|/, $a)[0] <=> (split /\|/, $b)[0]} | |
| 36 | 0 | grep {!/0\|time/} | |
| 37 | 0 | keys %{$self->{data}}; | |
| 38 | } | ||
| 39 | |||
| 40 | 2 | 1; | |
| 41 | __END__ | ||