| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Lab::XPRESS::Sweep::Frame; | 
| 2 |  |  |  |  |  |  | #ABSTRACT: Frames for nested sweep structures | 
| 3 |  |  |  |  |  |  | $Lab::XPRESS::Sweep::Frame::VERSION = '3.881'; | 
| 4 | 1 |  |  | 1 |  | 1625 | use v5.20; | 
|  | 1 |  |  |  |  | 4 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 6 | use Time::HiRes qw/usleep/, qw/time/; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 7 | 1 |  |  | 1 |  | 142 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 22 |  | 
| 8 | 1 |  |  | 1 |  | 5 | use Lab::Exception; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 20 |  | 
| 9 | 1 |  |  | 1 |  | 5 | use Lab::Generic; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 401 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | our @ISA = ('Lab::Generic'); | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub new { | 
| 14 | 0 |  |  | 0 | 0 |  | my $proto = shift; | 
| 15 | 0 |  | 0 |  |  |  | my $class = ref($proto) || $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 |  |  | 0 | 1 |  | my $self = shift; | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 0 | 0 |  |  |  |  | if ( not defined $self->{master} ) { | 
| 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 |  |  | 0 | 0 |  | my $self = shift; | 
| 39 |  |  |  |  |  |  |  | 
| 40 | 0 | 0 |  |  |  |  | if ( defined $self->{master} ) { | 
| 41 | 0 |  |  |  |  |  | $self->{master}->abort(); | 
| 42 |  |  |  |  |  |  | } | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | sub pause { | 
| 46 | 0 |  |  | 0 | 0 |  | return shift; | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | sub add_master { | 
| 50 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 51 | 0 |  |  |  |  |  | $self->{master} = shift; | 
| 52 |  |  |  |  |  |  |  | 
| 53 | 0 |  |  |  |  |  | my $type = ref( $self->{master} ); | 
| 54 | 0 | 0 |  |  |  |  | if ( not $type =~ /^Lab::XPRESS::Sweep/ ) { | 
| 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 |  |  | 0 | 1 |  | my $self  = shift; | 
| 63 | 0 |  |  |  |  |  | my $slave = shift; | 
| 64 |  |  |  |  |  |  |  | 
| 65 | 0 | 0 |  |  |  |  | if ( not defined $self->{master} ) { | 
| 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; | 
| 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 |