DD::Image::ImagePlaneCache Class Reference

Inherits DD::Image::MemoryHolder.

List of all members.

Public Types

typedef size_t BlockIndex

Public Member Functions

 ImagePlaneCache (PlanarI *planarI, DD::Image::Iop *iop, bool allLocked)
virtual ~ImagePlaneCache ()
void initPlanes (BlockIndex blockCount, const DD::Image::Hash &hash)
void setPlane (BlockIndex idx, PlanarI::PlaneID planeID, const ImagePlane &plane)
bool getPlane (BlockIndex blockIndex, Channel z, ImagePlane &imagePlane) const
bool getPlane (BlockIndex blockIndex, PlanarI::PlaneID planeID, ImagePlane &imagePlane) const
ImagePlane getPlane (BlockIndex blockIndex, Channel z) const
virtual bool memoryFree (size_t amount)
virtual void memoryInfo (Memory::MemoryInfoArray &output, const void *restrict_to) const
virtual int memoryWeight () const
const float * lookupLine (Channel z, int y) const

Static Public Member Functions

static ImagePlaneCachecreate (PlanarI *planarI, Iop *iop, bool allLocked)

Detailed Description

Represent a bunch of ImagePlanes


Constructor & Destructor Documentation

DD::Image::ImagePlaneCache::ImagePlaneCache ( PlanarI planarI,
DD::Image::Iop iop,
bool  allLocked 
)

constructor, takes the Iop it is the primary cache for (may be NULL, if it just a working cache; e.g. for GeneralTiles).

Don't call this directly, use ImagePlaneCache::create!

DD::Image::ImagePlaneCache::~ImagePlaneCache ( ) [virtual]

virtual destructor needed for MemoryHolder


Member Function Documentation

void DD::Image::ImagePlaneCache::initPlanes ( BlockIndex  blockCount,
const DD::Image::Hash hash 
)

initialise the plane cache for the given number of planes and hash.

if this object is being reused and these match then the existing cache will be kept around; otherwise they (and the planes within) will be destroyed

Referenced by DD::Image::PlanarIop::_open(), and DD::Image::GeneralTile::GeneralTile().

void DD::Image::ImagePlaneCache::setPlane ( BlockIndex  idx,
PlanarI::PlaneID  planeID,
const ImagePlane plane 
)

set the plane at idx and planeID to /plane/, which it takes a copy of (with copy-on-write)

it is assumed that this plane index and ID are not already used

Referenced by DD::Image::GeneralTile::GeneralTile().

bool DD::Image::ImagePlaneCache::getPlane ( BlockIndex  blockIndex,
Channel  z,
ImagePlane imagePlane 
) const

get the plane in the given block which contains the data for the given channel

returns false if not present

References DD::Image::PlanarI::getPlaneFromChannel().

Referenced by DD::Image::GeneralTile::at().

bool DD::Image::ImagePlaneCache::getPlane ( BlockIndex  blockIndex,
PlanarI::PlaneID  planeID,
ImagePlane imagePlane 
) const

get the plane in the given block which contains the data for the given planeid

returns false if not present

ImagePlane DD::Image::ImagePlaneCache::getPlane ( BlockIndex  blockIndex,
Channel  z 
) const

get the plane in the given block which contains the data for the given channel

assert if not present. this should only be used if you know the plane is present (i.e. you have called setPlane for it and allLocked is true)

References getPlane().

Referenced by getPlane().

bool DD::Image::ImagePlaneCache::memoryFree ( size_t  amount) [virtual]

implementation of memoryFree. frees memory, if it will help

Implements DD::Image::MemoryHolder.

References DD::Image::RefCountedFloatBuffer::usage().

void DD::Image::ImagePlaneCache::memoryInfo ( Memory::MemoryInfoArray &  output,
const void *  restrict_to 
) const [virtual]

implementation of memoryInfo.

if allLocked then this is just a Tile's one and therefore probably shouldn't be accounted for here, because this would lead to double-counting.

Implements DD::Image::MemoryHolder.

int DD::Image::ImagePlaneCache::memoryWeight ( ) const [virtual]

implementation of memoryWeight

Implements DD::Image::MemoryHolder.

References DD::Image::Iop::cached().

const float * DD::Image::ImagePlaneCache::lookupLine ( Channel  z,
int  y 
) const

Return the pointer to the data at (y,0) for channel z. (This is a common convention used throughout DDImage to avoid pointer arithmetic downstream.)

References DD::Image::ImagePlane::at(), DD::Image::ImagePlane::chanNo(), DD::Image::PlanarI::getPlaneFromChannel(), and DD::Image::PlanarI::rowToStripeIndex().