| 1 | package Lab::XPRESS::Sweep::Frame; | ||||||||||||||||||||
| 2 | #ABSTRACT: Frames for nested sweep structures | ||||||||||||||||||||
| 3 | 1 | $Lab::XPRESS::Sweep::Frame::VERSION = '3.881'; | |||||||||||||||||||
| 4 | 1 | ▶ | use v5.20; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 1 | ▶ | use Time::HiRes qw/usleep/, qw/time/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 1 | ▶ | use Lab::Exception; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 1 | ▶ | use Lab::Generic; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 1 | our @ISA = ('Lab::Generic'); | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | sub new { | ||||||||||||||||||||
| 14 | 0 | ▶ | my $proto = shift; | ||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 15 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 16 | 0 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||
| 17 | 0 | bless( $self, $class ); | |||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 0 | $self->{slave_counter} = 0; | |||||||||||||||||||
| 20 | 0 | $self->{slaves} = (); | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | return $self; | |||||||||||||||||||
| 23 | } | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | sub start { | ||||||||||||||||||||
| 26 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
start: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 0 | ▶ | if ( not defined $self->{master} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | 0 | Lab::Exception::Warning->throw( error => "no master defined" ); | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | else { | ||||||||||||||||||||
| 32 | 0 | $self->{master}->start(); | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | sub abort { | ||||||||||||||||||||
| 38 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
abort: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | ▶ | if ( defined $self->{master} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 41 | 0 | $self->{master}->abort(); | |||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | sub pause { | ||||||||||||||||||||
| 46 | 0 | ▶ | return shift; | ||||||||||||||||||
|
Subroutine
pause: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | sub add_master { | ||||||||||||||||||||
| 50 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
add_master: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 51 | 0 | $self->{master} = shift; | |||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 0 | my $type = ref( $self->{master} ); | |||||||||||||||||||
| 54 | 0 | ▶ | if ( not $type =~ /^Lab::XPRESS::Sweep/ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 55 | 0 | Lab::Exception::Warning->throw( | |||||||||||||||||||
| 56 | error => "Master is not of type Lab::XPRESS::Sweep . " ); | ||||||||||||||||||||
| 57 | } | ||||||||||||||||||||
| 58 | 0 | return $self; | |||||||||||||||||||
| 59 | } | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | sub add_slave { | ||||||||||||||||||||
| 62 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
add_slave: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 63 | 0 | my $slave = shift; | |||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 0 | ▶ | if ( not defined $self->{master} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 66 | 0 | Lab::Exception::Warning->throw( | |||||||||||||||||||
| 67 | error => "no master defined when called add_slave()." ); | ||||||||||||||||||||
| 68 | } | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 0 | $self->{master}->add_slave($slave); | |||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 0 | return $self; | |||||||||||||||||||
| 73 | } | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 1 | 1; | |||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | __END__ | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | =pod | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | =encoding UTF-8 | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | =head1 NAME | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | Lab::XPRESS::Sweep::Frame - Frames for nested sweep structures | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | =head1 VERSION | ||||||||||||||||||||
| 88 | |||||||||||||||||||||
| 89 | version 3.881 | ||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | =head1 SYNOPSIS | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | use Lab::XPRESS::hub; | ||||||||||||||||||||
| 94 | my $hub = new Lab::XPRESS::hub(); | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | my $frame = $hub->Frame(); | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | $frame->add_master($sweep_0); | ||||||||||||||||||||
| 99 | |||||||||||||||||||||
| 100 | $frame->add_slave($sweep_1); | ||||||||||||||||||||
| 101 | $frame->add_slave($sweep_2); | ||||||||||||||||||||
| 102 | $frame->add_slave($sweep_3); | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | $frame->start(); | ||||||||||||||||||||
| 105 | |||||||||||||||||||||
| 106 | . | ||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | =head1 DESCRIPTION | ||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | Parent: Lab::XPRESS::Sweep | ||||||||||||||||||||
| 111 | |||||||||||||||||||||
| 112 | The Lab::XPRESS::Sweep::Frame class implements a module to organize a nested sweep structure in the Lab::XPRESS::Sweep framework. | ||||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | The Frame object has no parameters. | ||||||||||||||||||||
| 115 | . | ||||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | =head1 CONSTRUCTOR | ||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | my $frame = $hub->Frame(); | ||||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | Instantiates a new Frame object. | ||||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | . | ||||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | =head1 METHODS | ||||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | =head2 add_master | ||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | $frame->add_master($sweep); | ||||||||||||||||||||
| 130 | |||||||||||||||||||||
| 131 | use this methode to add a master sweep to the frame object. A Frame accepts only a single master sweep. | ||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | . | ||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | =head2 add_slave | ||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | $frame->add_slave($sweep); | ||||||||||||||||||||
| 138 | |||||||||||||||||||||
| 139 | use this methode to add a slave sweep to the frame object. A Frame can have several slave sweeps. | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | The order in which the slave sweeps are added to the frame object, defines the sequence in which the individual slave sweeps will be executed. | ||||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | $frame->add_slave($sweep_1); | ||||||||||||||||||||
| 144 | $frame->add_slave($sweep_2); | ||||||||||||||||||||
| 145 | $frame->add_slave($sweep_3); | ||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | The frame object accepts also another frame object as a slave sweep. This way you can build up a multi level nested sweep structure. | ||||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | my $inner_frame = $hub->Frame(); | ||||||||||||||||||||
| 150 | my $outer_frame = $hub->Frame(); | ||||||||||||||||||||
| 151 | |||||||||||||||||||||
| 152 | $inner_frame->add_master($sweep_0); | ||||||||||||||||||||
| 153 | |||||||||||||||||||||
| 154 | $inner_frame->add_slave($sweep_1); | ||||||||||||||||||||
| 155 | $inner_frame->add_slave($sweep_2); | ||||||||||||||||||||
| 156 | $inner_frame->add_slave($sweep_3); | ||||||||||||||||||||
| 157 | |||||||||||||||||||||
| 158 | |||||||||||||||||||||
| 159 | $outer_frame->add_master($sweep_10); | ||||||||||||||||||||
| 160 | |||||||||||||||||||||
| 161 | $outer_frame->add_slave($sweep_11); | ||||||||||||||||||||
| 162 | $outer_frame->add_slave($inner_frame); | ||||||||||||||||||||
| 163 | $outer_frame->add_slave($sweep_11); | ||||||||||||||||||||
| 164 | |||||||||||||||||||||
| 165 | |||||||||||||||||||||
| 166 | $outer_frame->start(); | ||||||||||||||||||||
| 167 | |||||||||||||||||||||
| 168 | . | ||||||||||||||||||||
| 169 | |||||||||||||||||||||
| 170 | =head2 start | ||||||||||||||||||||
| 171 | |||||||||||||||||||||
| 172 | $frame->start(); | ||||||||||||||||||||
| 173 | |||||||||||||||||||||
| 174 | use this methode to execute the nested sweeps. | ||||||||||||||||||||
| 175 | |||||||||||||||||||||
| 176 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 177 | |||||||||||||||||||||
| 178 | This software is copyright (c) 2023 by the Lab::Measurement team; in detail: | ||||||||||||||||||||
| 179 | |||||||||||||||||||||
| 180 | Copyright 2012 Stefan Geissler | ||||||||||||||||||||
| 181 | 2013 Andreas K. Huettel, Christian Butschkow, Stefan Geissler | ||||||||||||||||||||
| 182 | 2014 Christian Butschkow | ||||||||||||||||||||
| 183 | 2016 Simon Reinhardt | ||||||||||||||||||||
| 184 | 2017 Andreas K. Huettel | ||||||||||||||||||||
| 185 | 2020 Andreas K. Huettel | ||||||||||||||||||||
| 186 | |||||||||||||||||||||
| 187 | |||||||||||||||||||||
| 188 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 189 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 190 | |||||||||||||||||||||
| 191 | =cut | ||||||||||||||||||||