Last change
on this file since 166 was
166,
checked in by thauvin, 18 years ago
|
- add ObsData::Event to handle message from backend to interactive tools
|
-
Property cvs2svn:cvs-rev set to
1.1
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1007 bytes
|
Line | |
---|
1 | # $Id$ |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | |
---|
6 | package ObsData::Event; |
---|
7 | |
---|
8 | sub new { |
---|
9 | my ($class, $id, $message) = @_; |
---|
10 | |
---|
11 | if(!($id && $message)) { |
---|
12 | return undef; |
---|
13 | } |
---|
14 | |
---|
15 | bless( |
---|
16 | { |
---|
17 | id => $id, |
---|
18 | message => $message, |
---|
19 | test => {}, |
---|
20 | test_order => [], |
---|
21 | }, |
---|
22 | $class |
---|
23 | ); |
---|
24 | } |
---|
25 | |
---|
26 | sub id { |
---|
27 | my ($self) = @_; |
---|
28 | return($self->{id}); |
---|
29 | } |
---|
30 | |
---|
31 | sub message { |
---|
32 | my ($self) = @_; |
---|
33 | return($self->{message}); |
---|
34 | } |
---|
35 | |
---|
36 | sub add_test { |
---|
37 | my ($self, $test_id, $message, $result) = @_; |
---|
38 | if (!exists($self->{test}{$test_id})) { |
---|
39 | push(@{$self->{test_order}}, $test_id); |
---|
40 | } |
---|
41 | $self->{test}{$test_id}{message} ||= $message; |
---|
42 | $self->{test}{$test_id}{result} = $result; |
---|
43 | } |
---|
44 | |
---|
45 | sub list_test { |
---|
46 | my ($self) = @_; |
---|
47 | return(@{$self->{test_order}}); |
---|
48 | } |
---|
49 | |
---|
50 | sub test_message { |
---|
51 | my ($self, $test_id) = @_; |
---|
52 | return($self->{test}{$test_id}{message}); |
---|
53 | } |
---|
54 | |
---|
55 | sub test_result { |
---|
56 | my ($self, $test_id) = @_; |
---|
57 | return($self->{test}{$test_id}{result}); |
---|
58 | } |
---|
59 | |
---|
60 | 1; |
---|
61 | |
---|
Note: See
TracBrowser
for help on using the repository browser.