diff options
author | nkskjames <nkskjames@gmail.com> | 2016-11-16 11:50:34 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-16 11:50:34 -0600 |
commit | f98655bb1ad441d1a0036d2208ca5b6fda989a66 (patch) | |
tree | f4fc51b616100c142cc700c6a7d6c6651a874599 | |
parent | e0f33b53fa87911f2ac8c1c7262044e820a9260b (diff) | |
parent | e546fc9b60909887505ecbcd4c7b893975ad7883 (diff) | |
download | serverwiz-f98655bb1ad441d1a0036d2208ca5b6fda989a66.tar.gz serverwiz-f98655bb1ad441d1a0036d2208ca5b6fda989a66.zip |
Merge pull request #28 from spinler/master
Allow findConnections() to work off more than just direct children
-rw-r--r-- | scripts/Targets.pm | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/scripts/Targets.pm b/scripts/Targets.pm index a8e3a0c..4f460a2 100644 --- a/scripts/Targets.pm +++ b/scripts/Targets.pm @@ -936,7 +936,7 @@ sub findConnections return ""; } - foreach my $child (@{ $self->getTargetChildren($target) }) + foreach my $child ($self->getAllTargetChildren($target)) { my $child_bus_type = $self->getBusType($child); if ($child_bus_type eq $bus_type) @@ -1244,6 +1244,27 @@ sub getTargetChildren return $target_ptr->{CHILDREN}; } +## returns an array of all child (including grandchildren) target names +sub getAllTargetChildren +{ + my $self = shift; + my $target = shift; + my @children; + + my $targets = $self->getTargetChildren($target); + if ($targets ne "") + { + for my $child (@$targets) + { + push @children, $child; + my @more = $self->getAllTargetChildren($child); + push @children, @more; + } + } + + return @children; +} + sub getEnumValue { my $self = shift; @@ -1556,6 +1577,11 @@ C<INDEX>. Returns an array of target strings representing all the children of target C<TARGET_STRING>. +=item getAllTargetChildren(C<TARGET_STRING>) + +Returns an array of target strings representing all the children of target +C<TARGET_STRING>, including grandchildren and below as well. + =item getEnumValue(C<ENUM_TYPE>,C<ENUM_NAME>) Returns the enum value of type C<ENUM_TYPE> and name C<ENUM_NAME>. The |