![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
This class defines a shared cache. The cache is intended to be used my multiple data layers (TSLDataLayer) at the same time, rather than each data layer having its own cache. The cache can be used in an application to set a single cache size.
This is useful when there are multiple data layers in use but not all of them are currently visible. As visible layers are drawn they can utilise the cache without being limited to individual cache sizes per layer.
Note that the cache is not thread safe.
To use the cache with a particular data layer, call the setSharedCache() function and pass in the data layer which will use the cache. This can be repeated for any other data layers that will share the same cache.
Public Member Functions | |
TSLSingleThreadCache () | |
Constructor. | |
void | destroy () |
void | setCacheSize (uint64_t size) |
uint64_t | getCacheSize () const |
bool | setSharedCache (TSLDataLayer &dataLayer) |
int | userCount () const |
void * | operator new (size_t size) TSL_NO_THROW |
Allocation override for API redirection. | |
void * | operator new (size_t size, char *filename, int line) |
Protected Member Functions | |
~TSLSingleThreadCache () | |
Destructor. | |
TSLSingleThreadCache::TSLSingleThreadCache | ( | ) |
Constructor.
|
inlineprotected |
Destructor.
void TSLSingleThreadCache::destroy | ( | ) |
Destroy method. This should be called rather than deleting the object, since the calls are redirected internally to MapLink.
uint64_t TSLSingleThreadCache::getCacheSize | ( | ) | const |
Returns the maximum size of the cache, in megabytes.
void * TSLSingleThreadCache::operator new | ( | size_t | size | ) |
Allocation override for API redirection.
void * TSLSingleThreadCache::operator new | ( | size_t | size, |
char * | filename, | ||
int | line ) |
When included in an MFC application in debug mode, the debug new expects this to be here. Override it and return the same as the normal one. The library must include it when compiled in release mode, since the user's application may be in debug mode.
void TSLSingleThreadCache::setCacheSize | ( | uint64_t | size | ) |
Sets the maximum size of the cache, in megabytes.
size | the new size of the cache in megabytes. |
bool TSLSingleThreadCache::setSharedCache | ( | TSLDataLayer & | dataLayer | ) |
Sets the shared cache to be used by the given data layer.
dataLayer | the data layer (TSLDataLayer) to set to use this cache. |
int TSLSingleThreadCache::userCount | ( | ) | const |
Returns the number of data layers that are using this cache.