MeVisLabToolboxReference
ml::MemoryImage Class Reference

A memory cache for the complete output image of an output connector. More...

#include <mlMemoryImage.h>

List of all members.

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 MLMetaProfilePtrgetMetaProfile () 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
SubImagegetImage ()
 Returns a subimage representing the data.
const SubImagegetImage () 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)
SubImagegetImg ()
const SubImagegetConstImg () const
MLint getMemoryImgSize () const
MLEXPORT void clearMemoryImg ()
MLEXPORT void updateWithSubImg (const SubImage &image)
void setManualControl (bool flag)
bool getManualControl () const

Friends

class MemoryImageCurrentlyUsedMemoryTracker

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

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]
Deprecated:
Use clear() instead.

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]
Deprecated:
Use getImage() instead.

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]
Deprecated:
Use getImage() instead.

Definition at line 214 of file mlMemoryImage.h.

bool ml::MemoryImage::getManualControl ( ) const [inline]
Deprecated:
Use isUserControlled() instead

Definition at line 232 of file mlMemoryImage.h.

MLint ml::MemoryImage::getMemoryImgSize ( ) const [inline]
Deprecated:
Use getSizeInBytes() instead.

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]
Deprecated:
Use setUserControlled() instead

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.

  • The default mode is false, where the host uses this buffer for caching when appended operators request memory mapped input tiles.
  • The user mode does not change anything in the memory output until the user changes it. The Module itself does not change by default. Sets the mode how the memory image output shall be used. Default mode 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 
)
Deprecated:
Use update() with PagedImage instead.
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]
Deprecated:
Use updateWithSubImage() instead.

Definition at line 226 of file mlMemoryImage.h.


Friends And Related Function Documentation

friend class MemoryImageCurrentlyUsedMemoryTracker [friend]

Definition at line 200 of file mlMemoryImage.h.


The documentation for this class was generated from the following file: