line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Rinchi Common Image Generator Interface for Perl |
3
|
|
|
|
|
|
|
# Class Identifier: f78b105e-200e-11de-bdc3-001c25551abc |
4
|
|
|
|
|
|
|
# Author: Brian M. Ames |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rinchi::CIGIPP::SymbolClone; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
20
|
use 5.006; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
41
|
|
10
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
11
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
12
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1421
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
require Exporter; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
) ] ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our @EXPORT = qw( |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Preloaded methods go here. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Rinchi::CIGIPP::SymbolClone - Perl extension for the Common Image Generator |
42
|
|
|
|
|
|
|
Interface - Symbol Clone data packet. |
43
|
|
|
|
|
|
|
data packet. |
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Rinchi::CIGIPP::SymbolClone; |
47
|
|
|
|
|
|
|
my $sym_clone = Rinchi::CIGIPP::SymbolClone->new(); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$packet_type = $sym_clone->packet_type(); |
50
|
|
|
|
|
|
|
$packet_size = $sym_clone->packet_size(); |
51
|
|
|
|
|
|
|
$symbol_ident = $sym_clone->symbol_ident(41795); |
52
|
|
|
|
|
|
|
$source_type = $sym_clone->source_type(Rinchi::CIGIPP->Symbol); |
53
|
|
|
|
|
|
|
$source_ident = $sym_clone->source_ident(42236); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The Symbol Clone packet is used to create an exact copy of a symbol. The copy |
58
|
|
|
|
|
|
|
will inherit all attributes that were defined by the Symbol Text Definition, |
59
|
|
|
|
|
|
|
Symbol Circle Definition, Symbol Line Definition, or Symbol Clone packet that |
60
|
|
|
|
|
|
|
was used to create the original symbol. Any operations that are performed upon |
61
|
|
|
|
|
|
|
the copy (e.g., translation, rotation, or change of color) will not affect the |
62
|
|
|
|
|
|
|
original unless otherwise dictated by a hierarchical relationship. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Alternatively, the Symbol Clone packet can be used to instantiate an IG-defined |
65
|
|
|
|
|
|
|
symbol template (see Section 3.3.3). Operations performed on the symbol |
66
|
|
|
|
|
|
|
instance will not affect the template. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
When a new symbol is created with a Symbol Clone packet, that symbol is hidden |
69
|
|
|
|
|
|
|
by default. The symbol will remain hidden until its state is changed with a |
70
|
|
|
|
|
|
|
Symbol Control packet. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 EXPORT |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
None by default. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#============================================================================== |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item new $sym_clone = Rinchi::CIGIPP::SymbolClone->new() |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Constructor for Rinchi::SymbolClone. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub new { |
85
|
1
|
|
|
1
|
1
|
49
|
my $class = shift; |
86
|
1
|
|
33
|
|
|
8
|
$class = ref($class) || $class; |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
11
|
my $self = { |
89
|
|
|
|
|
|
|
'_Buffer' => '', |
90
|
|
|
|
|
|
|
'_ClassIdent' => 'f78b105e-200e-11de-bdc3-001c25551abc', |
91
|
|
|
|
|
|
|
'_Pack' => 'CCSCCS', |
92
|
|
|
|
|
|
|
'_Swap1' => 'CCvCCv', |
93
|
|
|
|
|
|
|
'_Swap2' => 'CCnCCn', |
94
|
|
|
|
|
|
|
'packetType' => 33, |
95
|
|
|
|
|
|
|
'packetSize' => 8, |
96
|
|
|
|
|
|
|
'symbolIdent' => 0, |
97
|
|
|
|
|
|
|
'_bitfields1' => 0, # Includes bitfields unused59, and sourceType. |
98
|
|
|
|
|
|
|
'sourceType' => 0, |
99
|
|
|
|
|
|
|
'_unused60' => 0, |
100
|
|
|
|
|
|
|
'sourceIdent' => 0, |
101
|
|
|
|
|
|
|
}; |
102
|
|
|
|
|
|
|
|
103
|
1
|
50
|
|
|
|
12
|
if (@_) { |
104
|
0
|
0
|
|
|
|
0
|
if (ref($_[0]) eq 'ARRAY') { |
|
|
0
|
|
|
|
|
|
105
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = $_[0][0]; |
106
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
107
|
0
|
|
|
|
|
0
|
foreach my $attr (keys %{$_[0]}) { |
|
0
|
|
|
|
|
0
|
|
108
|
0
|
0
|
|
|
|
0
|
$self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
1
|
|
|
|
|
2
|
bless($self,$class); |
114
|
1
|
|
|
|
|
4
|
return $self; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
#============================================================================== |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item sub packet_type() |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
$value = $sym_clone->packet_type(); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Data Packet Identifier. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This attribute identifies this data packet as the Symbol Clone packet. The |
126
|
|
|
|
|
|
|
value of this attribute must be 33. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub packet_type() { |
131
|
1
|
|
|
1
|
1
|
6
|
my ($self) = @_; |
132
|
1
|
|
|
|
|
8
|
return $self->{'packetType'}; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
#============================================================================== |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item sub packet_size() |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
$value = $sym_clone->packet_size(); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Data Packet Size. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This attribute indicates the number of bytes in this data packet. The value of |
144
|
|
|
|
|
|
|
this attribute must be 16. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub packet_size() { |
149
|
1
|
|
|
1
|
1
|
12
|
my ($self) = @_; |
150
|
1
|
|
|
|
|
5
|
return $self->{'packetSize'}; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
#============================================================================== |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item sub symbol_ident([$newValue]) |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
$value = $sym_clone->symbol_ident($newValue); |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Symbol ID. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
This attribute specifies the identifier of the symbol that is being defined. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This identifier must be unique among all existing symbols. If a symbol with the |
164
|
|
|
|
|
|
|
specified identifier already exists, then that symbol and any children will be |
165
|
|
|
|
|
|
|
destroyed and a new symbol created. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub symbol_ident() { |
170
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
171
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
172
|
1
|
|
|
|
|
3
|
$self->{'symbolIdent'} = $nv; |
173
|
|
|
|
|
|
|
} |
174
|
1
|
|
|
|
|
3
|
return $self->{'symbolIdent'}; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
#============================================================================== |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item sub source_type([$newValue]) |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
$value = $sym_clone->source_type($newValue); |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Source Type. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
This attribute determines whether the new symbol will be a copy of an existing |
186
|
|
|
|
|
|
|
symbol or an instance of an IG-defined symbol template. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Symbol 0 |
189
|
|
|
|
|
|
|
SymbolTemplate 1 |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub source_type() { |
194
|
1
|
|
|
1
|
1
|
2
|
my ($self,$nv) = @_; |
195
|
1
|
50
|
|
|
|
6
|
if (defined($nv)) { |
196
|
1
|
50
|
33
|
|
|
6
|
if (($nv==0) or ($nv==1)) { |
197
|
1
|
|
|
|
|
2
|
$self->{'sourceType'} = $nv; |
198
|
1
|
|
|
|
|
3
|
$self->{'_bitfields1'} |= $nv &0x01; |
199
|
|
|
|
|
|
|
} else { |
200
|
0
|
|
|
|
|
0
|
carp "source_type must be 0 (Symbol), or 1 (SymbolTemplate)."; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
} |
203
|
1
|
|
|
|
|
2
|
return ($self->{'_bitfields1'} & 0x01); |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
#============================================================================== |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item sub source_ident([$newValue]) |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
$value = $sym_clone->source_ident($newValue); |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Source ID. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
This attribute identifies the symbol to be copied or the symbol template to be |
215
|
|
|
|
|
|
|
instantiated. |
216
|
|
|
|
|
|
|
If Source Type is set to Symbol (0), then this attribute will specify the |
217
|
|
|
|
|
|
|
identifier of the symbol to be copied. |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
If Source Type is set to Symbol Template (1), then this attribute will specify |
220
|
|
|
|
|
|
|
the identifier of the symbol template to be instantiated. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
If the specified source does not exist, then the packet will be ignored. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=cut |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub source_ident() { |
227
|
1
|
|
|
1
|
1
|
7
|
my ($self,$nv) = @_; |
228
|
1
|
50
|
|
|
|
9
|
if (defined($nv)) { |
229
|
1
|
|
|
|
|
3
|
$self->{'sourceIdent'} = $nv; |
230
|
|
|
|
|
|
|
} |
231
|
1
|
|
|
|
|
3
|
return $self->{'sourceIdent'}; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
#========================================================================== |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item sub pack() |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
$value = $sym_clone->pack(); |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Returns the packed data packet. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=cut |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub pack($) { |
245
|
1
|
|
|
1
|
1
|
5
|
my $self = shift ; |
246
|
|
|
|
|
|
|
|
247
|
1
|
|
|
|
|
5
|
$self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, |
248
|
|
|
|
|
|
|
$self->{'packetType'}, |
249
|
|
|
|
|
|
|
$self->{'packetSize'}, |
250
|
|
|
|
|
|
|
$self->{'symbolIdent'}, |
251
|
|
|
|
|
|
|
$self->{'_bitfields1'}, # Includes bitfields unused59, and sourceType. |
252
|
|
|
|
|
|
|
$self->{'_unused60'}, |
253
|
|
|
|
|
|
|
$self->{'sourceIdent'}, |
254
|
|
|
|
|
|
|
); |
255
|
|
|
|
|
|
|
|
256
|
1
|
|
|
|
|
4
|
return $self->{'_Buffer'}; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
#========================================================================== |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=item sub unpack() |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
$value = $sym_clone->unpack(); |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
Unpacks the packed data packet. |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=cut |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub unpack($) { |
270
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
271
|
|
|
|
|
|
|
|
272
|
0
|
0
|
|
|
|
|
if (@_) { |
273
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
274
|
|
|
|
|
|
|
} |
275
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); |
276
|
0
|
|
|
|
|
|
$self->{'packetType'} = $a; |
277
|
0
|
|
|
|
|
|
$self->{'packetSize'} = $b; |
278
|
0
|
|
|
|
|
|
$self->{'symbolIdent'} = $c; |
279
|
0
|
|
|
|
|
|
$self->{'_bitfields1'} = $d; # Includes bitfields unused59, and sourceType. |
280
|
0
|
|
|
|
|
|
$self->{'_unused60'} = $e; |
281
|
0
|
|
|
|
|
|
$self->{'sourceIdent'} = $f; |
282
|
|
|
|
|
|
|
|
283
|
0
|
|
|
|
|
|
$self->{'sourceType'} = $self->source_type(); |
284
|
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
#========================================================================== |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=item sub byte_swap() |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
$obj_name->byte_swap(); |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Byte swaps the packed data packet. |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=cut |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
sub byte_swap($) { |
299
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
300
|
|
|
|
|
|
|
|
301
|
0
|
0
|
|
|
|
|
if (@_) { |
302
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
303
|
|
|
|
|
|
|
} else { |
304
|
0
|
|
|
|
|
|
$self->pack(); |
305
|
|
|
|
|
|
|
} |
306
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); |
307
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f); |
309
|
0
|
|
|
|
|
|
$self->unpack(); |
310
|
|
|
|
|
|
|
|
311
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
1; |
315
|
|
|
|
|
|
|
__END__ |