Image Component Library (ICL)
|
Singelton class that provides access to reusable temporary images. More...
#include <ImgBuffer.h>
Public Member Functions | |
~ImgBuffer () | |
Destructor. More... | |
template<class T > | |
ICLCore_API Img< T > * | get () |
returns an independent image if available, otherwise, a new one is added More... | |
template<class T > | |
ICLCore_API Img< T > * | get (const utils::Size &size, int channels) |
returns an independent image with preferably correct parameters or a new one More... | |
template<class T > | |
ICLCore_API Img< T > * | get (const ImgParams ¶ms) |
returns an independent image with preferably correct parameters or a new one More... | |
ImgBase * | get (depth d) |
non template version for get(void) More... | |
ImgBase * | get (depth d, const utils::Size &size, int channels) |
non template version for get(const Size&,channels) More... | |
ImgBase * | get (depth d, const ImgParams &p) |
non template version for get(const ImgParams&) More... | |
Static Public Member Functions | |
static ImgBuffer * | instance () |
Obtain the singelton instance of ImgBuffer. More... | |
Private Member Functions | |
ImgBuffer () | |
private contructor -> use static function instance to get the singelton instance More... | |
Private Attributes | |
Data * | data |
internal data storage class More... | |
Additional Inherited Members | |
Protected Member Functions inherited from icl::utils::Uncopyable | |
Uncopyable () | |
Empty base constructor. More... | |
Singelton class that provides access to reusable temporary images.
For global functions as those, provided by the ICLQuick module, it is a common problem that functions that return whole images always have to allocation new memory for those images. To avoid this, a globel function can ask the singelton ImgBuffer instance for a temporary image (using one of the ImgBuffer::get functions). This will return a pointer to an image whose memory is managed by the ImgBuffer class.
ICL Images internally use SmartPtr instances to manage their channel data pointers. ImgBase instances can be asked whether they are independent, i.e. no other image does currently share the image data.
The ImgBuffer does internally manage a list potentially reusable Img-Instances for each possible image depth.
If ImgBuffer::get<T>(void) is called, the ImgBuffer searches in the current buffer-list for depth-T for an image that is currently independent, i.e, the ImgBuffer itself holds the only reference to the images memory. If an independent image can be found, it is returned, otherwise a new image is added to the ImgBuffers internal buffer list for depth-T.
If ImgBuffer::get<T>(const ImgParams&) or ImgBuffer::get<T>(const Size&,int) is called, the ImgBuffer will first search for an image that is not only independent but that already has the desired parameters. If a compatible image is found, it is returned. Otherwise, an independent image is preferred. If an independent image can be found, it's parameters are adapted to the desired parameters. Otherwise, a new image with the desired parameters is created, stored and returned.
|
private |
private contructor -> use static function instance to get the singelton instance
icl::core::ImgBuffer::~ImgBuffer | ( | ) |
Destructor.
ICLCore_API Img<T>* icl::core::ImgBuffer::get | ( | ) |
returns an independent image if available, otherwise, a new one is added
ICLCore_API Img<T>* icl::core::ImgBuffer::get | ( | const utils::Size & | size, |
int | channels | ||
) |
returns an independent image with preferably correct parameters or a new one
ICLCore_API Img<T>* icl::core::ImgBuffer::get | ( | const ImgParams & | params | ) |
returns an independent image with preferably correct parameters or a new one
ImgBase* icl::core::ImgBuffer::get | ( | depth | d, |
const utils::Size & | size, | ||
int | channels | ||
) |
non template version for get(const Size&,channels)
non template version for get(const ImgParams&)
|
static |
Obtain the singelton instance of ImgBuffer.
|
private |
internal data storage class
internal data storage pointer