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();
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;
219 inline ostream&
operator<<(ostream& s,
const ML_NAMESPACE::MemoryImage &mi)
221 return s << mi.getAsString().c_str();
void setUserControlled(bool userControlled)
void setCalculationPending(bool flag, int processingScope=-1)
MLEXPORT void updateWithSubImage(const SubImage &image)
MLEXPORT std::string getAsString() const
Returns an information string about memory image.
MLint getSizeInBytes() const
MemoryImage()
Defines a memory image that is always a member of a paged image with empty content.
virtual MLEXPORT ~MemoryImage()
Destructor. Cleans up allocated memory.
MLEXPORT MLErrorCode update(PagedImage *image, const SubImageBox &roi, MLDataType newDataType, MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
const SubImage & getImage() const
Returns a constant subimage representing the data.
friend class MemoryImageCurrentlyUsedMemoryTracker
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
bool isUserControlled() const
MLint32 MLErrorCode
Type of an ML Error code.
#define MLEXPORT
Code it as import symbol if compiled elsewhere.
void MLRequestProgressCB(void *usrData, double progress)
std::ostream & operator<<(std::ostream &out, const ml::Variant &variant)
boost::mutex::scoped_lock Lock
Defines a lock for locking a non-recursive mutex.
TSubImageBox< MLint > SubImageBox
Defines the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type...