0.006 release
[poe-xs-queue-array.git] / Array.pm
CommitLineData
e38f8ec4
TC
1package POE::XS::Queue::Array;
2use strict;
3use vars qw(@ISA $VERSION);
4use POE::Queue;
5
e38f8ec4 6BEGIN {
a603f2ce 7 @ISA = qw(POE::Queue);
c1081c2f 8 $VERSION = '0.006';
e38f8ec4
TC
9 eval {
10 # try XSLoader first, DynaLoader has annoying baggage
11 require XSLoader;
12 XSLoader::load('POE::XS::Queue::Array' => $VERSION);
13 1;
14 } or do {
15 require DynaLoader;
16 push @ISA, 'DynaLoader';
17 bootstrap POE::XS::Queue::Array $VERSION;
18 }
19}
20
21# lifted from POE::Queue::Array
22sub ITEM_PRIORITY () { 0 }
23sub ITEM_ID () { 1 }
24sub ITEM_PAYLOAD () { 2 }
25
26sub import {
27 my $package = caller();
28 no strict 'refs';
29 *{ $package . '::ITEM_PRIORITY' } = \&ITEM_PRIORITY;
30 *{ $package . '::ITEM_ID' } = \&ITEM_ID;
31 *{ $package . '::ITEM_PAYLOAD' } = \&ITEM_PAYLOAD;
32}
33
29c3b237
TC
34sub CLONE_SKIP { 1 }
35
e38f8ec4
TC
36# everything else is XS
371;
38
39__END__
40
41=head1 NAME
42
43POE::XS::Queue::Array - an XS implementation of POE::Queue::Array.
44
45=head1 SYNOPSIS
46
47See POE::Queue.
48
49=head1 DESCRIPTION
50
51This class is an implementation of the abstract POE::Queue interface.
52It implements a priority queue using C, with an XS interface supplied.
53
54The current implementation could use some optimization, especially for
55large queues.
56
1351c36f 57Please see the POE::Queue documentation, which explains this one's
e38f8ec4
TC
58functions, features, and behavior.
59
1351c36f
TC
60The following extra methods are added beyond POE::Queue::Array:
61
62=over
63
64=item dump
65
66Dumps the internal structure of the queue to stderr.
67
68=item verify
69
70Does limited verification of the structure of the queue. If the
71verification fails then a message is sent to stderr and the queue is
72dumped as with the dump() method, and your program will exit.
73
74=back
75
e38f8ec4
TC
76=head1 SEE ALSO
77
78POE, POE::Queue, POE::Queue::Array
79
80=head1 BUGS
81
82None known.
83
84Some possible improvements include:
85
86=over
87
88=item *
89
e38f8ec4
TC
90use a B-Tree for the queue (not a binary tree, a B-Tree), though this
91would require a module rename.
92
93=item *
94
95use a custom hash instead of a HV for the id to priority mapping,
96either glib's hash or convert to C++ and use the STL map.
97
98=item *
99
100some of the XS code could be optimized to do less work in scalar
101context, pq_remove_items and pq_peek_items could avoid building all
102those array refs.
103
104=back
105
fce9821a
TC
106=head1 LICENSE
107
108POE::XS::Queue::Array is licensed under the same terms as Perl itself.
109
e38f8ec4
TC
110=head1 AUTHOR
111
112Tony Cook <tonyc@cpan.org>
113
114=cut
115
116