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