1 package POE::XS::Queue::Array;
3 use vars qw(@ISA $VERSION);
10 # try XSLoader first, DynaLoader has annoying baggage
12 XSLoader::load('POE::XS::Queue::Array' => $VERSION);
16 push @ISA, 'DynaLoader';
17 bootstrap POE::XS::Queue::Array $VERSION;
21 # lifted from POE::Queue::Array
22 sub ITEM_PRIORITY () { 0 }
24 sub ITEM_PAYLOAD () { 2 }
27 my $package = caller();
29 *{ $package . '::ITEM_PRIORITY' } = \&ITEM_PRIORITY;
30 *{ $package . '::ITEM_ID' } = \&ITEM_ID;
31 *{ $package . '::ITEM_PAYLOAD' } = \&ITEM_PAYLOAD;
36 # everything else is XS
43 POE::XS::Queue::Array - an XS implementation of POE::Queue::Array.
51 This class is an implementation of the abstract POE::Queue interface.
52 It implements a priority queue using C, with an XS interface supplied.
54 The current implementation could use some optimization, especially for
57 Please see the POE::Queue documentation, which explains this one's
58 functions, features, and behavior.
60 The following extra methods are added beyond POE::Queue::Array:
66 Dumps the internal structure of the queue to stderr.
70 Does limited verification of the structure of the queue. If the
71 verification fails then a message is sent to stderr and the queue is
72 dumped as with the dump() method, and your program will exit.
78 POE, POE::Queue, POE::Queue::Array
84 Some possible improvements include:
90 use a B-Tree for the queue (not a binary tree, a B-Tree), though this
91 would require a module rename.
95 use a custom hash instead of a HV for the id to priority mapping,
96 either glib's hash or convert to C++ and use the STL map.
100 some of the XS code could be optimized to do less work in scalar
101 context, pq_remove_items and pq_peek_items could avoid building all
108 POE::XS::Queue::Array is licensed under the same terms as Perl itself.
112 Tony Cook <tonyc@cpan.org>