line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Rinchi Common Image Generator Interface for Perl |
3
|
|
|
|
|
|
|
# Class Identifier: f78b3b42-200e-11de-bdd3-001c25551abc |
4
|
|
|
|
|
|
|
# Author: Brian M. Ames |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rinchi::CIGIPP::CollisionDetectionSegmentNotification; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
19
|
use 5.006; |
|
1
|
|
|
|
|
6015
|
|
|
1
|
|
|
|
|
63
|
|
10
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
12
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1566
|
|
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::CollisionDetectionSegmentNotification - Perl extension for the |
42
|
|
|
|
|
|
|
Common Image Generator Interface - Collision Detection Segment Notification |
43
|
|
|
|
|
|
|
data packet. |
44
|
|
|
|
|
|
|
data packet. |
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use Rinchi::CIGIPP::CollisionDetectionSegmentNotification; |
48
|
|
|
|
|
|
|
my $cds_ntc = Rinchi::CIGIPP::CollisionDetectionSegmentNotification->new(); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$packet_type = $cds_ntc->packet_type(); |
51
|
|
|
|
|
|
|
$packet_size = $cds_ntc->packet_size(); |
52
|
|
|
|
|
|
|
$entity_ident = $cds_ntc->entity_ident(22708); |
53
|
|
|
|
|
|
|
$segment_ident = $cds_ntc->segment_ident(165); |
54
|
|
|
|
|
|
|
$collision_type = $cds_ntc->collision_type(Rinchi::CIGIPP->CollisionEntity); |
55
|
|
|
|
|
|
|
$contacted_entity_ident = $cds_ntc->contacted_entity_ident(26345); |
56
|
|
|
|
|
|
|
$material_code = $cds_ntc->material_code(56614); |
57
|
|
|
|
|
|
|
$intersection_distance = $cds_ntc->intersection_distance(10.493); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 DESCRIPTION |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
The Collision Detection Segment Notification packet is used to notify the Host |
62
|
|
|
|
|
|
|
when a collision occurs between a collision detection segment and a polygon. |
63
|
|
|
|
|
|
|
When a segment intersects a polygon whose material code matches the collision |
64
|
|
|
|
|
|
|
mask defined for the segment, the IG sends a Collision Detection Segment |
65
|
|
|
|
|
|
|
Notification packet indicating where and with what the collision occurred. If a |
66
|
|
|
|
|
|
|
segment intersects multiple polygons with material codes matching the mask, |
67
|
|
|
|
|
|
|
only the closest intersection is returned. Segments are not tested against |
68
|
|
|
|
|
|
|
polygons belonging to same the entity as the segment. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Note that collision detection testing is performed every frame by the IG. If a |
71
|
|
|
|
|
|
|
collision detection segment has been disabled, it will be excluded from all |
72
|
|
|
|
|
|
|
collision testing. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 EXPORT |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
None by default. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#============================================================================== |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item new $cds_ntc = Rinchi::CIGIPP::CollisionDetectionSegmentNotification->new() |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Constructor for Rinchi::CollisionDetectionSegmentNotification. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub new { |
87
|
1
|
|
|
1
|
1
|
45
|
my $class = shift; |
88
|
1
|
|
33
|
|
|
6
|
$class = ref($class) || $class; |
89
|
|
|
|
|
|
|
|
90
|
1
|
|
|
|
|
12
|
my $self = { |
91
|
|
|
|
|
|
|
'_Buffer' => '', |
92
|
|
|
|
|
|
|
'_ClassIdent' => 'f78b3b42-200e-11de-bdd3-001c25551abc', |
93
|
|
|
|
|
|
|
'_Pack' => 'CCSCCSIf', |
94
|
|
|
|
|
|
|
'_Swap1' => 'CCvCCvVV', |
95
|
|
|
|
|
|
|
'_Swap2' => 'CCnCCnNN', |
96
|
|
|
|
|
|
|
'packetType' => 113, |
97
|
|
|
|
|
|
|
'packetSize' => 16, |
98
|
|
|
|
|
|
|
'entityIdent' => 0, |
99
|
|
|
|
|
|
|
'segmentIdent' => 0, |
100
|
|
|
|
|
|
|
'_bitfields1' => 0, # Includes bitfields unused83, and collisionType. |
101
|
|
|
|
|
|
|
'collisionType' => 0, |
102
|
|
|
|
|
|
|
'contactedEntityIdent' => 0, |
103
|
|
|
|
|
|
|
'materialCode' => 0, |
104
|
|
|
|
|
|
|
'intersectionDistance' => 0, |
105
|
|
|
|
|
|
|
}; |
106
|
|
|
|
|
|
|
|
107
|
1
|
50
|
|
|
|
3
|
if (@_) { |
108
|
0
|
0
|
|
|
|
0
|
if (ref($_[0]) eq 'ARRAY') { |
|
|
0
|
|
|
|
|
|
109
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = $_[0][0]; |
110
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
111
|
0
|
|
|
|
|
0
|
foreach my $attr (keys %{$_[0]}) { |
|
0
|
|
|
|
|
0
|
|
112
|
0
|
0
|
|
|
|
0
|
$self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
1
|
|
|
|
|
3
|
bless($self,$class); |
118
|
1
|
|
|
|
|
8
|
return $self; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
#============================================================================== |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item sub packet_type() |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
$value = $cds_ntc->packet_type(); |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Data Packet Identifier. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This attribute identifies this data packet as the Collision Detection Segment |
130
|
|
|
|
|
|
|
Notification packet. The value of this attribute must be 113. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub packet_type() { |
135
|
1
|
|
|
1
|
1
|
6
|
my ($self) = @_; |
136
|
1
|
|
|
|
|
7
|
return $self->{'packetType'}; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
#============================================================================== |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item sub packet_size() |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
$value = $cds_ntc->packet_size(); |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Data Packet Size. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This attribute indicates the number of bytes in this data packet. The value of |
148
|
|
|
|
|
|
|
this attribute must be 16. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub packet_size() { |
153
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
154
|
1
|
|
|
|
|
3
|
return $self->{'packetSize'}; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
#============================================================================== |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item sub entity_ident([$newValue]) |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
$value = $cds_ntc->entity_ident($newValue); |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Entity ID. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
This attribute indicates the entity to which the collision detection segment belongs. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub entity_ident() { |
170
|
1
|
|
|
1
|
1
|
10
|
my ($self,$nv) = @_; |
171
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
172
|
1
|
|
|
|
|
2
|
$self->{'entityIdent'} = $nv; |
173
|
|
|
|
|
|
|
} |
174
|
1
|
|
|
|
|
2
|
return $self->{'entityIdent'}; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
#============================================================================== |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item sub segment_ident([$newValue]) |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
$value = $cds_ntc->segment_ident($newValue); |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Segment ID. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
This attribute indicates the ID of the collision detection segment along which |
186
|
|
|
|
|
|
|
the collision occurred. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
This attribute, along with Entity ID, allows the Host to match this response |
189
|
|
|
|
|
|
|
with the corresponding request. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub segment_ident() { |
194
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
195
|
1
|
50
|
|
|
|
3
|
if (defined($nv)) { |
196
|
1
|
|
|
|
|
2
|
$self->{'segmentIdent'} = $nv; |
197
|
|
|
|
|
|
|
} |
198
|
1
|
|
|
|
|
3
|
return $self->{'segmentIdent'}; |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
#============================================================================== |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item sub collision_type([$newValue]) |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
$value = $cds_ntc->collision_type($newValue); |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Collision Type. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
This attribute indicates whether the collision occurred with another entity or |
210
|
|
|
|
|
|
|
with a non-entity object such as the terrain. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
CollisionNonEntity 0 |
213
|
|
|
|
|
|
|
CollisionEntity 1 |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=cut |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub collision_type() { |
218
|
1
|
|
|
1
|
1
|
3
|
my ($self,$nv) = @_; |
219
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
220
|
1
|
50
|
33
|
|
|
7
|
if (($nv==0) or ($nv==1)) { |
221
|
1
|
|
|
|
|
2
|
$self->{'collisionType'} = $nv; |
222
|
1
|
|
|
|
|
2
|
$self->{'_bitfields1'} |= $nv &0x01; |
223
|
|
|
|
|
|
|
} else { |
224
|
0
|
|
|
|
|
0
|
carp "collision_type must be 0 (CollisionNonEntity), or 1 (CollisionEntity)."; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
} |
227
|
1
|
|
|
|
|
3
|
return ($self->{'_bitfields1'} & 0x01); |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
#============================================================================== |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=item sub contacted_entity_ident([$newValue]) |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
$value = $cds_ntc->contacted_entity_ident($newValue); |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Contacted Entity ID. |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
This attribute indicates the entity with which the collision occurred. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
If Collision Type is set to Non-entity (0), this attribute is ignored. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=cut |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub contacted_entity_ident() { |
245
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
246
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
247
|
1
|
|
|
|
|
2
|
$self->{'contactedEntityIdent'} = $nv; |
248
|
|
|
|
|
|
|
} |
249
|
1
|
|
|
|
|
2
|
return $self->{'contactedEntityIdent'}; |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
#============================================================================== |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=item sub material_code([$newValue]) |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
$value = $cds_ntc->material_code($newValue); |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Material Code. |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
This attribute indicates the material code of the surface at the point of collision. |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub material_code() { |
265
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
266
|
1
|
50
|
|
|
|
3
|
if (defined($nv)) { |
267
|
1
|
|
|
|
|
2
|
$self->{'materialCode'} = $nv; |
268
|
|
|
|
|
|
|
} |
269
|
1
|
|
|
|
|
3
|
return $self->{'materialCode'}; |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
#============================================================================== |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=item sub intersection_distance([$newValue]) |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
$value = $cds_ntc->intersection_distance($newValue); |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
Intersection Distance. |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
This attribute indicates the distance along the collision test vector from the |
281
|
|
|
|
|
|
|
source endpoint (defined by the X1, Y1, and Z1 attributes in the Collision |
282
|
|
|
|
|
|
|
intersection. Detection Segment Definition packet) to the point of intersection. |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=cut |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
sub intersection_distance() { |
287
|
1
|
|
|
1
|
1
|
4
|
my ($self,$nv) = @_; |
288
|
1
|
50
|
|
|
|
66
|
if (defined($nv)) { |
289
|
1
|
|
|
|
|
2
|
$self->{'intersectionDistance'} = $nv; |
290
|
|
|
|
|
|
|
} |
291
|
1
|
|
|
|
|
3
|
return $self->{'intersectionDistance'}; |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
#========================================================================== |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=item sub pack() |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
$value = $cds_ntc->pack(); |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
Returns the packed data packet. |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=cut |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
sub pack($) { |
305
|
1
|
|
|
1
|
1
|
10
|
my $self = shift ; |
306
|
|
|
|
|
|
|
|
307
|
1
|
|
|
|
|
7
|
$self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, |
308
|
|
|
|
|
|
|
$self->{'packetType'}, |
309
|
|
|
|
|
|
|
$self->{'packetSize'}, |
310
|
|
|
|
|
|
|
$self->{'entityIdent'}, |
311
|
|
|
|
|
|
|
$self->{'segmentIdent'}, |
312
|
|
|
|
|
|
|
$self->{'_bitfields1'}, # Includes bitfields unused83, and collisionType. |
313
|
|
|
|
|
|
|
$self->{'contactedEntityIdent'}, |
314
|
|
|
|
|
|
|
$self->{'materialCode'}, |
315
|
|
|
|
|
|
|
$self->{'intersectionDistance'}, |
316
|
|
|
|
|
|
|
); |
317
|
|
|
|
|
|
|
|
318
|
1
|
|
|
|
|
3
|
return $self->{'_Buffer'}; |
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
#========================================================================== |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=item sub unpack() |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
$value = $cds_ntc->unpack(); |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
Unpacks the packed data packet. |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=cut |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
sub unpack($) { |
332
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
333
|
|
|
|
|
|
|
|
334
|
0
|
0
|
|
|
|
|
if (@_) { |
335
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
336
|
|
|
|
|
|
|
} |
337
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); |
338
|
0
|
|
|
|
|
|
$self->{'packetType'} = $a; |
339
|
0
|
|
|
|
|
|
$self->{'packetSize'} = $b; |
340
|
0
|
|
|
|
|
|
$self->{'entityIdent'} = $c; |
341
|
0
|
|
|
|
|
|
$self->{'segmentIdent'} = $d; |
342
|
0
|
|
|
|
|
|
$self->{'_bitfields1'} = $e; # Includes bitfields unused83, and collisionType. |
343
|
0
|
|
|
|
|
|
$self->{'contactedEntityIdent'} = $f; |
344
|
0
|
|
|
|
|
|
$self->{'materialCode'} = $g; |
345
|
0
|
|
|
|
|
|
$self->{'intersectionDistance'} = $h; |
346
|
|
|
|
|
|
|
|
347
|
0
|
|
|
|
|
|
$self->{'collisionType'} = $self->collision_type(); |
348
|
|
|
|
|
|
|
|
349
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
350
|
|
|
|
|
|
|
} |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
#========================================================================== |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
=item sub byte_swap() |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
$obj_name->byte_swap(); |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
Byte swaps the packed data packet. |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
=cut |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
sub byte_swap($) { |
363
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
364
|
|
|
|
|
|
|
|
365
|
0
|
0
|
|
|
|
|
if (@_) { |
366
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
367
|
|
|
|
|
|
|
} else { |
368
|
0
|
|
|
|
|
|
$self->pack(); |
369
|
|
|
|
|
|
|
} |
370
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); |
371
|
|
|
|
|
|
|
|
372
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h); |
373
|
0
|
|
|
|
|
|
$self->unpack(); |
374
|
|
|
|
|
|
|
|
375
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
376
|
|
|
|
|
|
|
} |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
1; |
379
|
|
|
|
|
|
|
__END__ |