13 #ifndef ML_MEMORY_IMAGE_H
14 #define ML_MEMORY_IMAGE_H
25 #include <mlMetaProfilePtr.h>
31 class 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();
114 _userControlled = userControlled;
121 return _userControlled;
131 _calculationPending = flag;
132 _calculationPendingProcessingScope = processingScope;
140 return _calculationPending && (_calculationPendingProcessingScope == processingScope);
164 void* progressCallbackUserData =
nullptr);
179 void updateProfilingData();
182 mutable Mutex _mutex;
191 bool _userControlled;
194 bool _calculationPending;
197 int _calculationPendingProcessingScope;
200 MemoryImageCurrentlyUsedMemoryTracker* _currentlyUsedMemoryTracker;
203 mutable MLMetaProfilePtr _metaProfilePtr;
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 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.
MLEXPORT MLMetaProfilePtr & getMetaProfile() const
Returns the profiling metaprofile pointer.
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.
SubImage & getImage()
Returns a subimage representing the data.
bool isValid() const
Returns true if image contents is valid. Otherwise, false is returned.
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.
const SubImage & getImage() const
Returns a constant subimage representing the data.
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.
MLEXPORT std::ostream & operator<<(std::ostream &s, const ml::Field &v)
Overloads the operator '<<' for stream output of Field objects.
#define MLEXPORT
To export symbols from a DLL/shared object, we need to mark them with the MLEXPORT symbol.
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 ...
boost::mutex::scoped_lock Lock
Defines a lock for locking a non-recursive mutex.