Class ClearCLRecyclablePeerPointer

  • All Implemented Interfaces:
    net.haesleinhuepf.clij.coremem.interfaces.SizedInBytes, net.haesleinhuepf.clij.coremem.recycling.RecyclableInterface<ClearCLRecyclablePeerPointer,​ClearCLRecyclableRequest>, net.haesleinhuepf.clij.coremem.rgc.Freeable

    public class ClearCLRecyclablePeerPointer
    extends ClearCLPeerPointer
    implements net.haesleinhuepf.clij.coremem.recycling.RecyclableInterface<ClearCLRecyclablePeerPointer,​ClearCLRecyclableRequest>
    Recyclable peer pointer.

    Peer pointers of this kind can be recycled. This is usefull in the case of tricky ressources (for example contexts) that don't behave well when created or destroyed. using this type of recyclable peer pointer reduces the risks and system pressure associated with creating such ressources.

    Note: Best practice is to avoid mixing different types of pointer in the same recycler. Actually, just don't do that, at all (why would you anyway, think about it).

    • Constructor Detail

      • ClearCLRecyclablePeerPointer

        public ClearCLRecyclablePeerPointer​(ClearCLPeerPointer pPeerPointer,
                                            Class<?> pClass)
        Constructs a recyclable peer pointer given an existing peer pointer. The actual pointer information is copied. A class must be provided in order to know whih
        Parameters:
        pPeerPointer - peer pointer to use
        pClass - type
    • Method Detail

      • setRecycler

        public void setRecycler​(net.haesleinhuepf.clij.coremem.recycling.RecyclerInterface pRecycler)
        Specified by:
        setRecycler in interface net.haesleinhuepf.clij.coremem.recycling.RecyclableInterface<ClearCLRecyclablePeerPointer,​ClearCLRecyclableRequest>
      • getSizeInBytes

        public long getSizeInBytes()
        Specified by:
        getSizeInBytes in interface net.haesleinhuepf.clij.coremem.interfaces.SizedInBytes
      • free

        public void free()
        Specified by:
        free in interface net.haesleinhuepf.clij.coremem.rgc.Freeable
      • isFree

        public boolean isFree()
        Specified by:
        isFree in interface net.haesleinhuepf.clij.coremem.rgc.Freeable
      • complainIfFreed

        public void complainIfFreed()
                             throws net.haesleinhuepf.clij.coremem.exceptions.FreedException
        Specified by:
        complainIfFreed in interface net.haesleinhuepf.clij.coremem.rgc.Freeable
        Throws:
        net.haesleinhuepf.clij.coremem.exceptions.FreedException