ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/Block.pm
(Generate patch)

Comparing COMP/SCRAM/src/BuildSystem/Block.pm (file contents):
Revision 1.1 by williamc, Fri Sep 29 15:04:09 2000 UTC vs.
Revision 1.2 by williamc, Sat Oct 14 16:08:16 2000 UTC

# Line 12 | Line 12
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 + # objectids()           : return a list of all object ids
16  
17  
18   package BuildSystem::Block;
# Line 21 | Line 22 | sub new {
22          my $class=shift;
23          my $self={};
24          bless $self, $class;
25 +        $self->{objects}={};
26          return $self;
27   }
28  
# Line 48 | Line 50 | sub getobj {
50          return $oref;
51   }
52  
53 + sub objectids {
54 +        my $self=shift;
55 +
56 +        # -- get all local objs
57 +        my @objs=(keys %{$self->{objects}});
58 +
59 +        if ( defined $self->{parent} ) {
60 +          # -- add any objects from parent not found locally
61 +          foreach $obj ( $self->{parent}->objectids() ) {
62 +            my @tmp=grep ({ $_ eq $obj } @objs);
63 +            if ( $#tmp < 0 ) {
64 +              push @objs, $obj;
65 +            }
66 +          }
67 +        }
68 +        return @objs;
69 + }
70 +
71   sub parent {
72          my $self=shift;
73          if ( @_ ) {
74 +           $self->{parent}=shift;
75          }
76          return (defined $self->{parent})?$self->{parent}:undef;
77   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines