ML Reference
|
A memory cache for the complete output image of an output connector. More...
#include <mlMemoryImage.h>
Public Member Functions | |
MLEXPORT MLErrorCode | update (PagedImage *image, const SubImageBox &roi, MLDataType newDataType, MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr) |
Updates the given image . | |
MLEXPORT void | updateWithSubImage (const SubImage &image) |
Sets the memory image to the given image and clears the previous data. | |
MLEXPORT MLMetaProfilePtr & | getMetaProfile () const |
Returns the profiling meta profile pointer. | |
Construction/Destruction | |
MemoryImage () | |
Defines a memory image always as member of a paged image with empty content. | |
virtual MLEXPORT | ~MemoryImage () |
Destructor. Cleans up allocated memory. | |
Access to members and state | |
SubImage & | getImage () |
Returns a subimage representing the data. | |
const SubImage & | getImage () const |
Returns a constant subimage representing the data. | |
void | setValid (bool valid) |
If set to true, the image data is valid, otherwise not. | |
bool | isValid () const |
Returns true if image contents is valid. Otherwise false is returned. | |
MLint | getSizeInBytes () const |
Returns the currently used size of memory image in bytes. | |
void | setUserControlled (bool userControlled) |
Sets the control modes for the memory image to userControlled . | |
bool | isUserControlled () const |
Returns who controls the memory image. | |
void | setCalculationPending (bool flag, int processingScope=-1) |
Sets a flag that the memory image is being calculated by somebody and that is is best to wait until that is finished. | |
bool | isCalculationPending (int processingScope) const |
Returns if a calculation is pending on the given processingScope. | |
MLEXPORT std::string | getAsString () const |
Returns an info string about memory image. | |
MLEXPORT void | clear () |
Clears the memory image if it is handled by the ML. | |
Friends | |
class | MemoryImageCurrentlyUsedMemoryTracker |
A memory cache for the complete output image of an output connector.
This cache can be used as a memory image output controlled and set by the user. If the user leaves it unused the host can use it as an automatic cache if any appended operator requests a memory cached input. It is basically used as a member of the OutputConnector class.
Definition at line 48 of file mlMemoryImage.h.
|
inline |
Defines a memory image always as member of a paged image with empty content.
Definition at line 58 of file mlMemoryImage.h.
|
virtual |
Destructor. Cleans up allocated memory.
MLEXPORT void ml::MemoryImage::clear | ( | ) |
Clears the memory image if it is handled by the ML.
A user controlled memory image is not changed.
MLEXPORT std::string ml::MemoryImage::getAsString | ( | ) | const |
Returns an info string about memory image.
|
inline |
Returns a subimage representing the data.
Definition at line 78 of file mlMemoryImage.h.
|
inline |
Returns a constant subimage representing the data.
Definition at line 81 of file mlMemoryImage.h.
MLEXPORT MLMetaProfilePtr & ml::MemoryImage::getMetaProfile | ( | ) | const |
Returns the profiling meta profile pointer.
|
inline |
Returns the currently used size of memory image in bytes.
Signed return type is only used for safer signed arithmetics; result will not be less than 0.
Definition at line 95 of file mlMemoryImage.h.
|
inline |
Returns if a calculation is pending on the given processingScope.
See also setCalculationPending().
Definition at line 137 of file mlMemoryImage.h.
|
inline |
Returns who controls the memory image.
false=host, true=Module. See also setUserControlled(bool).
Definition at line 119 of file mlMemoryImage.h.
|
inline |
Returns true if image contents is valid. Otherwise false is returned.
Definition at line 91 of file mlMemoryImage.h.
|
inline |
Sets a flag that the memory image is being calculated by somebody and that is is best to wait until that is finished.
The processing scope can be used to store on which processing scope of the ML host the calculation is pending.
Definition at line 128 of file mlMemoryImage.h.
|
inline |
Sets the control modes for the memory image to userControlled
.
false
, where the host uses this buffer for caching when appended operators request memory mapped input tiles.false
is that the host uses that image for caching if appended operators request buffered input pages. If manually is set to true then the Module is responsible for the memory output. Definition at line 112 of file mlMemoryImage.h.
|
inline |
If set to true, the image data is valid, otherwise not.
Definition at line 84 of file mlMemoryImage.h.
MLEXPORT MLErrorCode ml::MemoryImage::update | ( | PagedImage * | image, |
const SubImageBox & | roi, | ||
MLDataType | newDataType, | ||
MLRequestProgressCB * | progressCallback = nullptr, | ||
void * | progressCallbackUserData = nullptr ) |
Updates the given image
.
Usually this method is called by the user. On success it returns ML_RESULT_OK, otherwise the error code. If a roi
is passed, the memory image is set to that size, otherwise the output image size is used. The user must pass the memory image's data type in newDatType
. It is strongly recommended to use the data type of the PagedImage which uses this memory image.
Sets the memory image to the given image
and clears the previous data.
The memory image is valid after this step if the image
contains data. Note: The data in image should be passed as MLMemoryBlockHandle. Thread-safe and synchronized with isValid()/setValid()/isCalculationPending()/setCalculationPending(). Clears calculation pending flag as well.
|
friend |
Definition at line 205 of file mlMemoryImage.h.