CIGIPP/ShortSymbolControl.pm

filter: Statementstmt 62.6% 82 / 131 Branchbran 36.0% 18 / 50 Conditioncond 29.6% 32 / 108 MC/DCmcdc 0.0% 0 / 47 Subroutinesub 89.4% 17 / 19 Podpod 100% 15 / 15 totaltotal 44.3% 164 / 370 CC 63 SCAR 37.0
CC
63
Cov
46%
unpack
72.0
attribute_select1
71.7
attribute_select2
71.7
CRAP 40.4
« CIGIPP.pm ↑ Summary CIGIPP/SymbolTextDefinition.pm »
1 #
2 # Rinchi Common Image Generator Interface for Perl
3 # Class Identifier: f78b15b8-200e-11de-bdc5-001c25551abc
4 # Author: Brian M. Ames
5 #
6  
7 package Rinchi::CIGIPP::ShortSymbolControl;
8  
9 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 require Exporter;
15  
16 2 our @ISA = qw(Exporter);
17  
18 # Items to export into callers namespace by default. Note: do not export
19 # names by default without a very good reason. Use EXPORT_OK instead.
20 # Do not simply export all your public functions/methods/constants.
21  
22 # This allows declaration use Rinchi::CIGI::AtmosphereControl ':all';
23 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
24 # will save memory.
25 2 our %EXPORT_TAGS = ( 'all' => [ qw(
26
27 ) ] );
28  
29 2 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
30  
31 2 our @EXPORT = qw(
32
33 );
34  
35 2 our $VERSION = '0.01';
36  
37 # Preloaded methods go here.
38  
39 =head1 NAME
40  
41 Rinchi::CIGIPP::ShortSymbolControl - Perl extension for the Common Image
42 Generator Interface - Short Symbol Control data packet.
43 data packet.
44 =head1 SYNOPSIS
45  
46 use Rinchi::CIGIPP::ShortSymbolControl;
47 my $ssym_ctl = Rinchi::CIGIPP::ShortSymbolControl->new();
48  
49 $packet_type = $ssym_ctl->packet_type();
50 $packet_size = $ssym_ctl->packet_size();
51 $symbol_ident = $ssym_ctl->symbol_ident(48088);
52 $inherit_color = $ssym_ctl->inherit_color(Rinchi::CIGIPP->NotInherited);
53 $flash_control = $ssym_ctl->flash_control(Rinchi::CIGIPP->RestartFlash);
54 $attach_state = $ssym_ctl->attach_state(Rinchi::CIGIPP->Detach);
55 $symbol_state = $ssym_ctl->symbol_state(Rinchi::CIGIPP->Hidden);
56 $attribute_select1 = $ssym_ctl->attribute_select1(Rinchi::CIGIPP->None);
57 $attribute_select2 = $ssym_ctl->attribute_select2(Rinchi::CIGIPP->None);
58 $attribute_value1 = $ssym_ctl->attribute_value1(8789);
59 $attribute_value2 = $ssym_ctl->attribute_value2(27011);
60  
61 =head1 DESCRIPTION
62  
63 The Short Symbol Control packet is provided as a lower-bandwidth alternative to
64 the Symbol Control packet (CIGI ICD Section 4.1.33). It can be used when
65 manipulation of only one or two symbol attributes of a symbol are necessary.
66  
67 This packet allows for up to two symbol attributes to be modified. The
68 attributes are specified by the Attribute Select 1 and Attribute Select 2
69 attributes. The values of these attributes determine what data types are used
70 to interpret the Attribute Value 1 and Attribute Value 2 attributes,
71 respectively.
72 A symbol must be defined before the Host sends a Short Symbol Control packet
73 referencing that symbol. Symbols may be predefined by the IG or may be created
74 by the Host sending any one of the symbol definition packets.
75  
76 Before the Host can send a Short Symbol Control referencing a symbol, the Host
77 must first send a Symbol Control packet referencing that symbol so that all of
78 the symbol's attributes can be set.
79  
80 =head2 EXPORT
81  
82 None by default.
83  
84 #==============================================================================
85  
86 =item new $ssym_ctl = Rinchi::CIGIPP::ShortSymbolControl->new()
87  
88 Constructor for Rinchi::ShortSymbolControl.
89  
90 =cut
91  
92 2 ▶sub new {
Subroutine new: called CC=7 SCAR=29.8
Pod documented
93 2 my $class = shift;
94 2 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
95  
96 2 my $self = {
97 '_Buffer' => '',
98 '_ClassIdent' => 'f78b15b8-200e-11de-bdc5-001c25551abc',
99 '_Pack' => 'CCSCCCCff',
100 '_Swap1' => 'CCvCCCCVV',
101 '_Swap2' => 'CCnCCCCNN',
102 'packetType' => 35,
103 'packetSize' => 16,
104 'symbolIdent' => 0,
105 '_bitfields1' => 0, # Includes bitfields unused63, inheritColor, flashControl, attachState, and symbolState.
106 'inheritColor' => 0,
107 'flashControl' => 0,
108 'attachState' => 0,
109 'symbolState' => 0,
110 '_unused64' => 0,
111 'attributeSelect1' => 0,
112 'attributeSelect2' => 0,
113 'attributeValue1' => 0,
114 'attributeValue2' => 0,
115 };
116  
117 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
118 0 ▶ if (ref($_[0]) eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[0] eq 'ARRAY') { } 0 0 0
elsif (ref $_[0] eq 'HASH') { } 0 0 0
119 0 $self->{'_Buffer'} = $_[0][0];
120 } elsif (ref($_[0]) eq 'HASH') {
121 0 foreach my $attr (keys %{$_[0]}) {
122 0 ▶ $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /^_/ 0 0 0
123 }
124 }
125 }
126  
127 2 bless($self,$class);
128 2 return $self;
129 }
130  
131 #==============================================================================
132  
133 =item sub packet_type()
134  
135 $value = $ssym_ctl->packet_type();
136  
137 Data Packet Identifier.
138  
139 This attribute identifies this data packet as the Short Symbol Control packet.
140 The value of this attribute must be 35.
141  
142 =cut
143  
144 2 ▶sub packet_type() {
Subroutine packet_type: called CC=1 SCAR=0.0
Pod documented
145 2 my ($self) = @_;
146 2 return $self->{'packetType'};
147 }
148  
149 #==============================================================================
150  
151 =item sub packet_size()
152  
153 $value = $ssym_ctl->packet_size();
154  
155 Data Packet Size.
156  
157 This attribute indicates the number of bytes in this data packet. The value of
158 this attribute must be 32.
159  
160 =cut
161  
162 2 ▶sub packet_size() {
Subroutine packet_size: called CC=1 SCAR=0.0
Pod documented
163 2 my ($self) = @_;
164 2 return $self->{'packetSize'};
165 }
166  
167 #==============================================================================
168  
169 =item sub symbol_ident([$newValue])
170  
171 $value = $ssym_ctl->symbol_ident($newValue);
172  
173 Symbol ID.
174  
175 This attribute specifies the symbol to which this packet is applied. This value
176 must be unique for each active symbol.
177  
178 =cut
179  
180 2 ▶sub symbol_ident() {
Subroutine symbol_ident: called CC=2 SCAR=7.0
Pod documented
181 2 my ($self,$nv) = @_;
182 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
183 2 $self->{'symbolIdent'} = $nv;
184 }
185 2 return $self->{'symbolIdent'};
186 }
187  
188 #==============================================================================
189  
190 =item sub inherit_color([$newValue])
191  
192 $value = $ssym_ctl->inherit_color($newValue);
193  
194 Inherit Color.
195  
196 This attribute specifies whether this symbol inherits its color from the symbol
197 to which it is attached. If color is inherited, then this symbol's color,
198 including the alpha component, is identical to the current color of the parent
199 symbol. Note that the current color of the parent symbol may be inherited from
200 another symbol.
201  
202 If Attach State is set to Detach (0), this attribute is ignored.
203  
204 NotInherited 0
205 Inherited 1
206  
207 =cut
208  
209 2 ▶sub inherit_color() {
Subroutine inherit_color: called CC=4 SCAR=15.5
Pod documented
210 2 my ($self,$nv) = @_;
211 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
212 2 ▶ if (($nv==0) or ($nv==1)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1) { } 2 0 2
Condition33%1/3
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0 $nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
ABresult
1X1
011
000
213 2 $self->{'inheritColor'} = $nv;
214 2 $self->{'_bitfields1'} |= ($nv << 4) &0x10;
215 } else {
216 0 carp "inherit_color must be 0 (NotInherited), or 1 (Inherited).";
217 }
218 }
219 2 return (($self->{'_bitfields1'} & 0x10) >> 4);
220 }
221  
222 #==============================================================================
223  
224 =item sub flash_control([$newValue])
225  
226 $value = $ssym_ctl->flash_control($newValue);
227  
228 Flash Control.
229  
230 This attribute specifies whether the flash cycle is continued from its present
231 point or whether it is restarted at the beginning.
232  
233 This attribute is ignored if either Flash Duty Cycle Percentage or Flash Period
234 is changed. This attribute may also be ignored if Flash Duty Cycle Percentage
235 is set to 0 or 100.
236  
237 ContinueFlash 0
238 RestartFlash 1
239  
240 =cut
241  
242 2 ▶sub flash_control() {
Subroutine flash_control: called CC=4 SCAR=15.5
Pod documented
243 2 my ($self,$nv) = @_;
244 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
245 2 ▶ if (($nv==0) or ($nv==1)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1) { } 2 0 2
Condition33%1/3
$nv == 0 or $nv == 1
l!l&&r!l&&!r
020
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0 $nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
ABresult
1X1
011
000
246 2 $self->{'flashControl'} = $nv;
247 2 $self->{'_bitfields1'} |= ($nv << 3) &0x08;
248 } else {
249 0 carp "flash_control must be 0 (ContinueFlash), or 1 (RestartFlash).";
250 }
251 }
252 2 return (($self->{'_bitfields1'} & 0x08) >> 3);
253 }
254  
255 #==============================================================================
256  
257 =item sub attach_state([$newValue])
258  
259 $value = $ssym_ctl->attach_state($newValue);
260  
261 Attach State.
262  
263 This attribute specifies whether the symbol should be attached as a child to a
264 parent symbol.
265  
266 If this attribute is set to Detach (0), then the symbol becomes or remains a
267 top-level (non-child) symbol. The Parent Symbol attribute is ignored. The U
268 Position, V Position, and Rotation attributes specify the symbol's position and
269 rotation relative to the symbol surface's local coordinate system (see Section
270 3.4.5.1).
271 If this attribute is set to Attach (1), then the symbol becomes or remains
272 attached to the symbol specified by the Parent Symbol ID attribute. The U
273 Position, V Position, and Rotation attributes specify the symbol's position and
274 rotation relative to the parent symbol's local coordinate system (see Section
275 3.4.5.2).
276 The attach state of a symbol may be changed at any time. The attachment or
277 detachment takes place immediately and remains in effect until changed with
278 another Symbol Control packet or Short Symbol Control packet.
279  
280 Detach 0
281 Attach 1
282  
283 =cut
284  
285 2 ▶sub attach_state() {
Subroutine attach_state: called CC=4 SCAR=15.5
Pod documented
286 2 my ($self,$nv) = @_;
287 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
288 2 ▶ if (($nv==0) or ($nv==1)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1) { } 2 0 2
Condition33%1/3
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0 $nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
ABresult
1X1
011
000
289 2 $self->{'attachState'} = $nv;
290 2 $self->{'_bitfields1'} |= ($nv << 2) &0x04;
291 } else {
292 0 carp "attach_state must be 0 (Detach), or 1 (Attach).";
293 }
294 }
295 2 return (($self->{'_bitfields1'} & 0x04) >> 2);
296 }
297  
298 #==============================================================================
299  
300 =item sub symbol_state([$newValue])
301  
302 $value = $ssym_ctl->symbol_state($newValue);
303  
304 Symbol State.
305  
306 This attribute specifies whether the symbol should be hidden, visible, or
307 destroyed. This attribute may be set to one of the following values:
308  
309 Hidden – The symbol is hidden from view; however, it can be positioned,
310 rotated, and scaled. It can also be attached to another symbol as a child. It
311 can also be used as a parent by other symbols, although any children are also
312 hidden.
313 Visible – The symbol is drawn on the surface. It can be positioned, rotated,
314 and scaled. It can also be attached to another symbol as a child. It can also
315 be used as a parent by other symbols.
316  
317 Destroyed – The symbol is deleted and any system resources are freed. Any
318 children are also destroyed. All other attributes in this packet are ignored.
319  
320 Note: Although the Symbol Control packet supports destruction of symbols, it is
321 recommended that the Short Symbol Control packet be used for this purpose since
322 all other attributes are ignored.
323  
324 Hidden 0
325 Visible 1
326 Destroyed 2
327  
328 =cut
329  
330 2 ▶sub symbol_state() {
Subroutine symbol_state: called CC=5 SCAR=19.1
Pod documented
331 2 my ($self,$nv) = @_;
332 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
333 2 ▶ if (($nv==0) or ($nv==1) or ($nv==2)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1 or $nv == 2) { } 2 0 2
Condition33%2/6
$nv == 0 or $nv == 1 or $nv == 2
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/3
$nv == 0 or $nv == 1 or $nv == 2
$nv == 0 $nv == 1 $nv == 2
Truth table25%1/4
A or B or C
A= $nv == 0B= $nv == 1C= $nv == 2
ABCresult
1XX1
01X1
0011
0000
334 2 $self->{'symbolState'} = $nv;
335 2 $self->{'_bitfields1'} |= $nv &0x03;
336 } else {
337 0 carp "symbol_state must be 0 (Hidden), 1 (Visible), or 2 (Destroyed).";
338 }
339 }
340 2 return ($self->{'_bitfields1'} & 0x03);
341 }
342  
343 #==============================================================================
344  
345 =item sub attribute_select1([$newValue])
346  
347 $value = $ssym_ctl->attribute_select1($newValue);
348  
349 Attribute Select 1.
350  
351 This attribute identifies the attribute whose value is specified in the
352 Attribute Value 1 field.
353  
354 If this attribute is set to None (0), then Attribute Value 1 is ignored.
355  
356 None 0
357 SurfaceIdent 1
358 ParentSymbolIdent 2
359 Layer 3
360 FlashDutyCycle 4
361 FlashPeriod 5
362 PositionU 6
363 PositionV 7
364 Rotation 8
365 Color 9
366 ScaleU 10
367 ScaleV 11
368  
369 =cut
370  
371 2 ▶sub attribute_select1() {
Subroutine attribute_select1: called CC=17 SCAR=42.7
Pod documented
372 2 my ($self,$nv) = @_;
373 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
374 2 ▶ if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3) or ($nv==4) or ($nv==5) or ($nv==6) or ($nv==7) or ($nv==8) or ($nv==9) or ($nv==10) or ($nv==11)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11) { } 2 0 2
Condition33%11/33
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/12
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11
$nv == 0 $nv == 1 $nv == 2 $nv == 3 $nv == 4 $nv == 5 $nv == 6 $nv == 7 $nv == 8 $nv == 9 $nv == 10 $nv == 11
Truth table7%1/13
A or B or C or D or E or F or G or H or I or J or K or L
A= $nv == 0B= $nv == 1C= $nv == 2D= $nv == 3E= $nv == 4F= $nv == 5G= $nv == 6H= $nv == 7I= $nv == 8J= $nv == 9K= $nv == 10L= $nv == 11
ABCDEFGHIJKLresult
1XXXXXXXXXXX1
01XXXXXXXXXX1
001XXXXXXXXX1
0001XXXXXXXX1
00001XXXXXXX1
000001XXXXXX1
0000001XXXXX1
00000001XXXX1
000000001XXX1
0000000001XX1
00000000001X1
0000000000011
0000000000000
375 2 $self->{'attributeSelect1'} = $nv;
376 2 ▶ if($nv >= 5 and $nv <= 10 and $nv !=9) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv >= 5 and $nv <= 10 and $nv != 9) { } 0 2 2
Condition33%2/6
$nv >= 5 and $nv <= 10 and $nv != 9
!ll&&!rl&&r
200
$nv >= 5 and $nv <= 10
!ll&&!rl&&r
200
MC/DC0%0/3
$nv >= 5 and $nv <= 10 and $nv != 9
$nv >= 5 $nv <= 10 $nv != 9
Truth table25%1/4
A and B and C
A= $nv >= 5B= $nv <= 10C= $nv != 9
ABCresult
0XX0
10X0
1100
1111
377 0 substr($self->{'_Pack'},7,1) = 'f';
378 } else {
379 2 substr($self->{'_Pack'},7,1) = 'I';
380 }
381 } else {
382 0 carp "attribute_select1 must be 0 (None), 1 (SurfaceIdent), 2 (ParentSymbolIdent), 3 (Layer), 4 (FlashDutyCycle), 5 (FlashPeriod), 6 (PositionU), 7 (PositionV), 8 (Rotation), 9 (Color), 10 (ScaleU), or 11 (ScaleV).";
383 }
384 }
385 2 return $self->{'attributeSelect1'};
386 }
387  
388 #==============================================================================
389  
390 =item sub attribute_select2([$newValue])
391  
392 $value = $ssym_ctl->attribute_select2($newValue);
393  
394 Attribute Select 2.
395  
396 This attribute identifies the attribute whose value is specified in the
397 Attribute Value 2 field.
398  
399 If this attribute is set to None (0), then Attribute Value 2 is ignored.
400  
401 None 0
402 SurfaceIdent 1
403 ParentSymbolIdent 2
404 Layer 3
405 FlashDutyCycle 4
406 FlashPeriod 5
407 PositionU 6
408 PositionV 7
409 Rotation 8
410 Color 9
411 ScaleU 10
412 ScaleV 11
413  
414 =cut
415  
416 2 ▶sub attribute_select2() {
Subroutine attribute_select2: called CC=17 SCAR=42.7
Pod documented
417 2 my ($self,$nv) = @_;
418 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
419 2 ▶ if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3) or ($nv==4) or ($nv==5) or ($nv==6) or ($nv==7) or ($nv==8) or ($nv==9) or ($nv==10) or ($nv==11)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11) { } 2 0 2
Condition33%11/33
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/12
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11
$nv == 0 $nv == 1 $nv == 2 $nv == 3 $nv == 4 $nv == 5 $nv == 6 $nv == 7 $nv == 8 $nv == 9 $nv == 10 $nv == 11
Truth table7%1/13
A or B or C or D or E or F or G or H or I or J or K or L
A= $nv == 0B= $nv == 1C= $nv == 2D= $nv == 3E= $nv == 4F= $nv == 5G= $nv == 6H= $nv == 7I= $nv == 8J= $nv == 9K= $nv == 10L= $nv == 11
ABCDEFGHIJKLresult
1XXXXXXXXXXX1
01XXXXXXXXXX1
001XXXXXXXXX1
0001XXXXXXXX1
00001XXXXXXX1
000001XXXXXX1
0000001XXXXX1
00000001XXXX1
000000001XXX1
0000000001XX1
00000000001X1
0000000000011
0000000000000
420 2 $self->{'attributeSelect2'} = $nv;
421 2 ▶ if($nv >= 5 and $nv <= 10 and $nv !=9) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv >= 5 and $nv <= 10 and $nv != 9) { } 0 2 2
Condition33%2/6
$nv >= 5 and $nv <= 10 and $nv != 9
!ll&&!rl&&r
200
$nv >= 5 and $nv <= 10
!ll&&!rl&&r
200
MC/DC0%0/3
$nv >= 5 and $nv <= 10 and $nv != 9
$nv >= 5 $nv <= 10 $nv != 9
Truth table25%1/4
A and B and C
A= $nv >= 5B= $nv <= 10C= $nv != 9
ABCresult
0XX0
10X0
1100
1111
422 0 substr($self->{'_Pack'},8,1) = 'f';
423 } else {
424 2 substr($self->{'_Pack'},8,1) = 'I';
425 }
426 } else {
427 0 carp "attribute_select2 must be 0 (None), 1 (SurfaceIdent), 2 (ParentSymbolIdent), 3 (Layer), 4 (FlashDutyCycle), 5 (FlashPeriod), 6 (PositionU), 7 (PositionV), 8 (Rotation), 9 (Color), 10 (ScaleU), or 11 (ScaleV).";
428 }
429 }
430 2 return $self->{'attributeSelect2'};
431 }
432  
433 #==============================================================================
434  
435 =item sub attribute_value1([$newValue])
436  
437 $value = $ssym_ctl->attribute_value1($newValue);
438  
439 Attribute Value 1.
440  
441 This attribute specifies the value of the attribute identified by the Attribute
442 Select 1 field.
443  
444 If Attribute Select 1 is set to Surface ID (1), Parent Symbol ID (2), Layer
445 (3), or Flash Duty Cycle Percentage (4), then Attribute Value 1 is treated as a
446 32-bit integer.
447  
448 If Attribute Select 1 is set to Flash Period (5), Position U (6), Position V
449 (7), Rotation (8), Scale V (10), or Scale V (11), then Attribute Value 1 is
450 treated as a 32-bit single-precision floating-point number.
451  
452 If Attribute Select 1 is Color (9), then Attribute Value 1 is treated as four
453 8-bit integers specifying each of the four color components. The most
454 significant byte specifies the red component, followed by the blue component,
455 then green, and finally alpha.
456  
457 Regardless of the attribute, the IG will byte-swap this attribute as a 32-bit
458 value if byte-swapping is required.
459  
460 =cut
461  
462 2 ▶sub attribute_value1() {
Subroutine attribute_value1: called CC=2 SCAR=7.0
Pod documented
463 2 my ($self,$nv) = @_;
464 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
465 2 $self->{'attributeValue1'} = $nv;
466 }
467 2 return $self->{'attributeValue1'};
468 }
469  
470 #==============================================================================
471  
472 =item sub attribute_value2([$newValue])
473  
474 $value = $ssym_ctl->attribute_value2($newValue);
475  
476 Attribute Value 2.
477  
478 This attribute specifies the value of the attribute identified by the Attribute
479 Select 2 field.
480  
481 If Attribute Select 2 is set to Surface ID (1), Parent Symbol ID (2), Layer
482 (3), or Flash Duty Cycle Percentage (4), then Attribute Value 2 is treated as a
483 32-bit integer.
484  
485 If Attribute Select 2 is set to Flash Period (5), Position U (6), Position V
486 (7), Rotation (8), Scale V (10), or Scale V (11), then Attribute Value 2 is
487 treated as a 32-bit single-precision floating-point number.
488  
489 If Attribute Select 2 is Color (9), then Attribute Value 2 is treated as four
490 8-bit integers specifying each of the four color components. The most
491 significant byte specifies the red component, followed by the blue component,
492 then green, and finally alpha.
493  
494 Regardless of the attribute, the IG will byte-swap this attribute as a 32-bit
495 value if byte-swapping is required.
496  
497 =cut
498  
499 2 ▶sub attribute_value2() {
Subroutine attribute_value2: called CC=2 SCAR=7.0
Pod documented
500 2 my ($self,$nv) = @_;
501 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
502 2 $self->{'attributeValue2'} = $nv;
503 }
504 2 return $self->{'attributeValue2'};
505 }
506  
507 #==========================================================================
508  
509 =item sub pack()
510  
511 $value = $ssym_ctl->pack();
512  
513 Returns the packed data packet.
514  
515 =cut
516  
517 2 ▶sub pack($) {
Subroutine pack: called CC=1 SCAR=0.0
Pod documented
518 2 my $self = shift ;
519
520 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
521 $self->{'packetType'},
522 $self->{'packetSize'},
523 $self->{'symbolIdent'},
524 $self->{'_bitfields1'}, # Includes bitfields unused63, inheritColor, flashControl, attachState, and symbolState.
525 $self->{'_unused64'},
526 $self->{'attributeSelect1'},
527 $self->{'attributeSelect2'},
528 $self->{'attributeValue1'},
529 2 $self->{'attributeValue2'},
530 );
531  
532 2 return $self->{'_Buffer'};
533 }
534  
535 #==========================================================================
536  
537 =item sub unpack()
538  
539 $value = $ssym_ctl->unpack();
540  
541 Unpacks the packed data packet.
542  
543 =cut
544  
545 0 ▶sub unpack($) {
Subroutine unpack: not called CC=8 SCAR=42.8
Pod documented
546 0 my $self = shift @_;
547
548 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
549 0 $self->{'_Buffer'} = shift @_;
550 }
551 0 my ($a,$b,$c,$d,$e,$f,$g,$h,$i) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
552 0 ▶ if($f >= 5 and $f <=10 and $f !=9) {
Branch: 1 branch
BranchTrueFalseTotal
if ($f >= 5 and $f <= 10 and $f != 9) { } 0 0 0
Condition0%0/6
$f >= 5 and $f <= 10 and $f != 9
!ll&&!rl&&r
000
$f >= 5 and $f <= 10
!ll&&!rl&&r
000
MC/DC0%0/3
$f >= 5 and $f <= 10 and $f != 9
$f >= 5 $f <= 10 $f != 9
Truth table0%0/4
A and B and C
A= $f >= 5B= $f <= 10C= $f != 9
ABCresult
0XX0
10X0
1100
1111
553 0 $h = CORE::unpack('f',substr($self->{'_Buffer'},8));
554 0 $self->{'_Pack'} = 'CCSCCCCf';
555 } else {
556 0 $h = CORE::unpack('I',substr($self->{'_Buffer'},8));
557 0 $self->{'_Pack'} = 'CCSCCCCI';
558 }
559 0 ▶ if($g >= 5 and $g <=10 and $g !=9) {
Branch: 1 branch
BranchTrueFalseTotal
if ($g >= 5 and $g <= 10 and $g != 9) { } 0 0 0
Condition0%0/6
$g >= 5 and $g <= 10 and $g != 9
!ll&&!rl&&r
000
$g >= 5 and $g <= 10
!ll&&!rl&&r
000
MC/DC0%0/3
$g >= 5 and $g <= 10 and $g != 9
$g >= 5 $g <= 10 $g != 9
Truth table0%0/4
A and B and C
A= $g >= 5B= $g <= 10C= $g != 9
ABCresult
0XX0
10X0
1100
1111
560 0 $i = CORE::unpack('f',substr($self->{'_Buffer'},12));
561 0 $self->{'_Pack'} .= 'f';
562 } else {
563 0 $i = CORE::unpack('I',substr($self->{'_Buffer'},12));
564 0 $self->{'_Pack'} .= 'I';
565 }
566  
567 0 $self->{'packetType'} = $a;
568 0 $self->{'packetSize'} = $b;
569 0 $self->{'symbolIdent'} = $c;
570 0 $self->{'_bitfields1'} = $d; # Includes bitfields unused63, inheritColor, flashControl, attachState, and symbolState.
571 0 $self->{'_unused64'} = $e;
572 0 $self->{'attributeSelect1'} = $f;
573 0 $self->{'attributeSelect2'} = $g;
574 0 $self->{'attributeValue1'} = $h;
575 0 $self->{'attributeValue2'} = $i;
576  
577 0 $self->{'inheritColor'} = $self->inherit_color();
578 0 $self->{'flashControl'} = $self->flash_control();
579 0 $self->{'attachState'} = $self->attach_state();
580 0 $self->{'symbolState'} = $self->symbol_state();
581  
582 0 return $self->{'_Buffer'};
583 }
584  
585 #==========================================================================
586  
587 =item sub byte_swap()
588  
589 $obj_name->byte_swap();
590  
591 Byte swaps the packed data packet.
592  
593 =cut
594  
595 0 ▶sub byte_swap($) {
Subroutine byte_swap: not called CC=2 SCAR=17.9
Pod documented
596 0 my $self = shift @_;
597
598 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
599 0 $self->{'_Buffer'} = shift @_;
600 } else {
601 0 $self->pack();
602 }
603 0 my ($a,$b,$c,$d,$e,$f,$g) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
604  
605 0 $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g);
606 0 $self->unpack();
607  
608 0 return $self->{'_Buffer'};
609 }
610  
611 2 1;
612 __END__
« CIGIPP.pm ↑ Summary CIGIPP/SymbolTextDefinition.pm »