13#ifndef ML_MEMORY_IMAGE_H
14#define ML_MEMORY_IMAGE_H
31class MemoryImageCurrentlyUsedMemoryTracker;
61 _userControlled(
false),
62 _calculationPending(
false),
63 _calculationPendingProcessingScope(-1),
64 _currentlyUsedMemoryTracker(
nullptr)
91 inline bool isValid()
const {
Lock lock(_mutex);
return _isValid; }
97 return _subImg.getSizeInBytes();
121 return _userControlled;
131 _calculationPending =
flag;
132 _calculationPendingProcessingScope = processingScope;
140 return _calculationPending && (_calculationPendingProcessingScope == processingScope);
179 void updateProfilingData();
182 mutable Mutex _mutex;
191 bool _userControlled;
194 bool _calculationPending;
197 int _calculationPendingProcessingScope;
200 MemoryImageCurrentlyUsedMemoryTracker* _currentlyUsedMemoryTracker;
205 friend class MemoryImageCurrentlyUsedMemoryTracker;
219 inline ostream&
operator<<(ostream& s,
const ML_NAMESPACE::MemoryImage &
mi)
221 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 by somebody and that is is best to wait until t...
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 info string about memory image.
MLint getSizeInBytes() const
Returns the currently used size of memory image in bytes.
MemoryImage()
Defines a memory image always as 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 meta profile 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 not.
bool isCalculationPending(int processingScope) const
Returns if a calculation is pending on the given processingScope.
bool isUserControlled() const
Returns who controls the memory image.
Class which represents an image, which manages properties of an image and image data which is located...
This class manages/represents a rectangular 6d image region which 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.