13#ifndef ML_VIRTUAL_VOLUME_H
14#define ML_VIRTUAL_VOLUME_H
53 template<
class DATATYPE>
class TVirtualVolume;
55 class VirtualVolumeMemoryTracker;
85 bool areExceptionsOnFlag =
false);
99 bool areExceptionsOnFlag =
false);
106 bool areExceptionsOnFlag =
false);
135 inline bool isValid()
const {
return _valid; }
244 bool enableWrittenPages=
true)
const;
282 bool areExceptionsOnFlag =
false);
382 bool _areExceptionsOn;
407 MLuint _numPageArrayEntries;
Class to manage a binary image.
const ImageVector & getPageExtent() const
Returns the extent of any written/read page used by the virtual volume.
void(* PageFunc)(VirtualVolume *obj, PageBuffer *page, PageMapped mapped, void *userData)
void * _loadPage(PageBuffer *pageBuffer)
MLuint getNumWrittenPages()
Returns number of written (and therefore locked) pages.
void _cleanUpMemory()
Cleans up all allocated memory areas.
VirtualVolume(PagedImage *image, MLDataType dType, MLint maxNumKB=-1, bool areExceptionsOnFlag=false)
MLint getDim() const
Return dimension of specified volume.
PageBuffer * _getPageBuffer6D(const ImageVector &pos)
void copyTileFromInputImage(const SubImageBox &box, PagedImage &image, const ImageVector &shift, const ScaleShiftData &scaleShift=ScaleShiftData())
void resize(const ImageVector &newExt)
MLuint getNumBytes()
Returns number of bytes currently allocated as pages in the virtual volume.
void * getWrittenPageData(MLuint32 wp)
MLDataType getDataType() const
Return data type enum.
void _init(PagedImage *img, const ImageVector &ext, const ImageVector &pageExtent, MLdouble fillVal, MLDataType dType, MLint maxNumKB=-1, bool areExceptionsOnFlag=false)
VirtualVolume(const ImageVector &ext=ImageVector(0), MLdouble fillVal=0, MLDataType dType=MLuint8Type, MLint maxNumKB=-1, bool areExceptionsOnFlag=false)
bool isValid() const
Returns true if instance is valid; otherwise, it returns false.
MLuint getNumMappedPages() const
Returns number of currently mapped (volatile) pages. Written pages are counted only temporarily here.
const SubImageBox & getBox() const
Get box extents of input volume.
friend class TVirtualVolume
For performance reasons permit direct member access of TVirtualVolume to this class.
Module * getModule() const
BitImage * getUsedPagesMask(bool enableMappedPages=true, bool enableWrittenPages=true) const
void _reset()
Cleans up all allocated memory and resets instance to state after _default().
MLint getInputIndex() const
Returns the output index of the input baseOp or -1 if there is no input baseOp.
const SubImageBox & getWrittenPageBox(MLuint32 wp)
MLuint getNumPages()
Returns number of all (mapped and written) pages.
void _default()
Set all members to default values without freeing anything.
void unMapAndClearWrittenPages()
void copyToSubImage(SubImage &outSubImg)
VirtualVolume(const ImageVector &extent, const ImageVector &pageExtent, MLdouble fillVal=0, MLDataType dType=MLuint8Type, MLint maxNumKB=-1, bool areExceptionsOnFlag=false)
Constructor that allows to pass the pageExtent.
friend class VirtualVolumeMemoryTracker
void * createTypedVirtualVolume()
static void destroyTypedVirtualVolume(void *tVV, MLDataType dt)
const ImageVector & getPageArrayExtent() const
Returns the extent of the array of page buffers.
void registerPageFunction(PageFunc pFunc, void *userData)
static void * _loadPageCB(PageBuffer *pageBuffer)
PagedImage * getInputImage() const
virtual ~VirtualVolume()
Destructor.
ImageVector getExtent() const
Get extents of input volume.
static void * _getPageCB(PageBuffer *pageBuffer)
Simply return the data of the page. This is the normal access function to page data.
void _updateWrittenPages()
bool areExceptionsOn() const
Returns true if exception handling is enabled otherwise false.
void invalidate()
Invalidates state of virtual volume, e.g. after an error.
@ MLuint8Type
Enumerator for the unsigned 8-bit ML integer type.
TScaleShiftData< MLdouble > ScaleShiftData
Double version of TScaleShiftData for maximum reasonable precision.
TSubImageBox< MLint > SubImageBox
Defines the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type...
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.
SubImageBox _box
Box of original image mapped in this page.
VirtualVolume * _virtVol
Pointer to the virtual volume object.
ReturnPageFunc _getPageFkt
Pointer to function to return the page managed by the PageBuffer.
MLMemoryBlockHandle _memoryBlockHandle
The memory block handle for holding the page data locked.
bool _locked
If true this page contains written data and must not be removed.
PageBuffer()
Initialize the structure.
void *(* ReturnPageFunc)(PageBuffer *toMePtr)
Function to return the data page of the PageBuffer.