ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/Block.pm
Revision: 1.1
Committed: Fri Sep 29 15:04:09 2000 UTC (24 years, 7 months ago) by williamc
Content type: text/plain
Branch: MAIN
Log Message:
Container Block Prototype

File Contents

# User Rev Content
1 williamc 1.1 #
2     # Block.pm
3     #
4     # Originally Written by Christopher Williams
5     #
6     # Description
7     #
8     # Interface
9     # ---------
10     # new(namestring) : A new Block object
11     # parent([Block]) : Set/get the parent - no parent = undef
12     # getobj(id) : get object associated with key - returns the nearest
13     # match going up the block tree
14     # setobj(oref,id) : hold an object reference with a key
15    
16    
17     package BuildSystem::Block;
18     require 5.004;
19    
20     sub new {
21     my $class=shift;
22     my $self={};
23     bless $self, $class;
24     return $self;
25     }
26    
27     sub setobj {
28     my $self=shift;
29     my $oref=shift;
30     my $key=shift;
31    
32     $self->{objects}{$key}=$oref;
33     }
34    
35     sub getobj {
36     my $self=shift;
37     my $key=shift;
38    
39     my $oref=undef;
40     if ( ! exists $self->{objects}{$key} ) {
41     if ( defined $self->{parent} ) {
42     $oref=$self->{parent}->getobj($key);
43     }
44     }
45     else {
46     $oref=$self->{objects}{$key};
47     }
48     return $oref;
49     }
50    
51     sub parent {
52     my $self=shift;
53     if ( @_ ) {
54     }
55     return (defined $self->{parent})?$self->{parent}:undef;
56     }