13#ifndef ML_MEMORY_IMAGE_H
14#define ML_MEMORY_IMAGE_H
31class MemoryImageCurrentlyUsedMemoryTracker;
60 , _userControlled(
false)
61 , _calculationPending(
false)
62 , _calculationPendingProcessingScope(-1)
63 , _currentlyUsedMemoryTracker(
nullptr)
105 return _subImg.getSizeInBytes();
129 return _userControlled;
139 _calculationPending =
flag;
140 _calculationPendingProcessingScope = processingScope;
148 return _calculationPending && (_calculationPendingProcessingScope == processingScope);
187 void updateProfilingData();
190 mutable Mutex _mutex;
199 bool _userControlled;
202 bool _calculationPending;
205 int _calculationPendingProcessingScope;
208 MemoryImageCurrentlyUsedMemoryTracker* _currentlyUsedMemoryTracker;
213 friend class MemoryImageCurrentlyUsedMemoryTracker;
227 inline ostream&
operator<<(ostream& s,
const ML_NAMESPACE::MemoryImage&
mi)
229 return s <<
mi.getAsString().c_str();
A memory cache for the complete output image of an output connector.
void setUserControlled(bool userControlled)
Sets the control modes for the memory image to userControlled.
void setCalculationPending(bool flag, int processingScope=-1)
Sets a flag that the memory image is being calculated and that is is best to wait until the calculati...
MLEXPORT void updateWithSubImage(const SubImage &image)
Sets the memory image to the given image and clears the previous data.
MLEXPORT std::string getAsString() const
Returns an information string about memory image.
MLint getSizeInBytes() const
Returns the currently used size of memory image in bytes.
MemoryImage()
Defines a memory image that is always a member of a paged image with empty content.
MLEXPORT void clear()
Clears the memory image if it is handled by the ML.
virtual MLEXPORT ~MemoryImage()
Destructor. Cleans up allocated memory.
MLEXPORT MLErrorCode update(PagedImage *image, const SubImageBox &roi, MLDataType newDataType, MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
Updates the given image.
const SubImage & getImage() const
Returns a constant subimage representing the data.
MLEXPORT MLMetaProfilePtr & getMetaProfile() const
Returns the profiling metaprofile pointer.
bool isValid() const
Returns true if image contents is valid. Otherwise, false is returned.
SubImage & getImage()
Returns a subimage representing the data.
void setValid(bool valid)
If set to true, the image data is valid; otherwise, it is not valid.
bool isCalculationPending(int processingScope) const
Returns whether a calculation is pending on the given processingScope.
bool isUserControlled() const
Returns who controls the memory image.
The class PagedImage, representing a fragmented image that manages properties and data of an image lo...
This class manages/represents a rectangular 6D image region that is organized linearly in memory.
MLint32 MLDataType
MLDataType.
MLint32 MLErrorCode
Type of an ML Error code.
boost::mutex Mutex
Defines a non-recursive mutex.
#define MLEXPORT
To export symbols from a DLL/shared object, we need to mark them with the MLEXPORT symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
void MLRequestProgressCB(void *usrData, double progress)
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
std::ostream & operator<<(std::ostream &out, const ml::Variant &variant)
boost::mutex::scoped_lock Lock
Defines a lock for locking a non-recursive mutex.