MeVisLabToolboxReference
|
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) ML_RETURN_VALUE_SHOULD_BE_USED |
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) |
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 () const |
Returns if a calculation is yet pending. See also setCalculationPending(bool). | |
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. | |
Deprecated | |
MLEXPORT MLErrorCode | update (Module *op, MLint outIndex, const SubImageBox &roi, MLDataType newDT) |
SubImage & | getImg () |
const SubImage & | getConstImg () const |
MLint | getMemoryImgSize () const |
MLEXPORT void | clearMemoryImg () |
MLEXPORT void | updateWithSubImg (const SubImage &image) |
void | setManualControl (bool flag) |
bool | getManualControl () const |
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 51 of file mlMemoryImage.h.
ml::MemoryImage::MemoryImage | ( | ) | [inline] |
Defines a memory image always as member of a paged image with empty content.
Definition at line 61 of file mlMemoryImage.h.
References ML_TRACE_IN.
virtual MLEXPORT ml::MemoryImage::~MemoryImage | ( | ) | [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 void ml::MemoryImage::clearMemoryImg | ( | ) | [inline] |
Definition at line 223 of file mlMemoryImage.h.
MLEXPORT std::string ml::MemoryImage::getAsString | ( | ) | const |
Returns an info string about memory image.
const SubImage& ml::MemoryImage::getConstImg | ( | ) | const [inline] |
Definition at line 217 of file mlMemoryImage.h.
SubImage& ml::MemoryImage::getImage | ( | ) | [inline] |
Returns a subimage representing the data.
Definition at line 81 of file mlMemoryImage.h.
const SubImage& ml::MemoryImage::getImage | ( | ) | const [inline] |
Returns a constant subimage representing the data.
Definition at line 84 of file mlMemoryImage.h.
SubImage& ml::MemoryImage::getImg | ( | ) | [inline] |
Definition at line 214 of file mlMemoryImage.h.
bool ml::MemoryImage::getManualControl | ( | ) | const [inline] |
Definition at line 232 of file mlMemoryImage.h.
MLint ml::MemoryImage::getMemoryImgSize | ( | ) | const [inline] |
Definition at line 220 of file mlMemoryImage.h.
MLEXPORT MLMetaProfilePtr& ml::MemoryImage::getMetaProfile | ( | ) | const |
Returns the profiling meta profile pointer.
MLint ml::MemoryImage::getSizeInBytes | ( | ) | const [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 102 of file mlMemoryImage.h.
References ML_CATCH_RETHROW, ML_TRACE_IN, and ML_TRY.
bool ml::MemoryImage::isCalculationPending | ( | ) | const [inline] |
Returns if a calculation is yet pending. See also setCalculationPending(bool).
Definition at line 144 of file mlMemoryImage.h.
bool ml::MemoryImage::isUserControlled | ( | ) | const [inline] |
Returns who controls the memory image.
false=host, true=Module. See also setUserControlled(bool).
Definition at line 131 of file mlMemoryImage.h.
bool ml::MemoryImage::isValid | ( | ) | const [inline] |
Returns true if image contents is valid. Otherwise false is returned.
Definition at line 98 of file mlMemoryImage.h.
void ml::MemoryImage::setCalculationPending | ( | bool | flag | ) | [inline] |
Sets a flag that the memory image is being calculated by somebody and that is is best to wait until that is finished.
Definition at line 138 of file mlMemoryImage.h.
void ml::MemoryImage::setManualControl | ( | bool | flag | ) | [inline] |
Definition at line 229 of file mlMemoryImage.h.
void ml::MemoryImage::setUserControlled | ( | bool | userControlled | ) | [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 124 of file mlMemoryImage.h.
void ml::MemoryImage::setValid | ( | bool | valid | ) | [inline] |
If set to true, the image data is valid, otherwise not.
Definition at line 87 of file mlMemoryImage.h.
References ML_CATCH_RETHROW, ML_TRACE_IN, and ML_TRY.
MLEXPORT MLErrorCode ml::MemoryImage::update | ( | PagedImage * | image, |
const SubImageBox & | roi, | ||
MLDataType | newDataType | ||
) |
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.
MLEXPORT MLErrorCode ml::MemoryImage::update | ( | Module * | op, |
MLint | outIndex, | ||
const SubImageBox & | roi, | ||
MLDataType | newDT | ||
) |
MLEXPORT void ml::MemoryImage::updateWithSubImage | ( | const SubImage & | 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.
MLEXPORT void ml::MemoryImage::updateWithSubImg | ( | const SubImage & | image | ) | [inline] |
Definition at line 226 of file mlMemoryImage.h.
friend class MemoryImageCurrentlyUsedMemoryTracker [friend] |
Definition at line 200 of file mlMemoryImage.h.