Bio::Phylo::Util::IDPool - Utility class for generating object IDs. No serviceable parts inside.


Bio-Phylo documentation Contained in the Bio-Phylo distribution.

Index


Code Index:

NAME

Top

Bio::Phylo::Util::IDPool - Utility class for generating object IDs. No serviceable parts inside.

DESCRIPTION

Top

This package defines utility functions for generating and reclaiming object IDs. These functions are called by object constructors and destructors, respectively. There is no direct usage.

SEE ALSO

Top

Bio::Phylo::Manual

Also see the manual: Bio::Phylo::Manual and http://rutgervos.blogspot.com.

CITATION

Top

If you use Bio::Phylo in published research, please cite it:

Rutger A Vos, Jason Caravas, Klaas Hartmann, Mark A Jensen and Chase Miller, 2011. Bio::Phylo - phyloinformatic analysis using Perl. BMC Bioinformatics 12:63. http://dx.doi.org/10.1186/1471-2105-12-63

REVISION

Top

 $Id: IDPool.pm 1593 2011-02-27 15:26:04Z rvos $


Bio-Phylo documentation Contained in the Bio-Phylo distribution.

package Bio::Phylo::Util::IDPool;
use strict;
{
    my @reclaim;
    my $obj_counter = 1;

    sub _initialize {
        my $obj_ID = 0;
        if (@reclaim) {
            $obj_ID = shift(@reclaim);
        }
        else {
            $obj_ID = $obj_counter;
            $obj_counter++;
        }
        return \$obj_ID;
    }

    sub _reclaim {
        my ( $class, $obj ) = @_;

        #        push @reclaim, $obj->get_id;
    }
}
1;
__END__