MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLSingleThreadCache Class Reference
Inheritance diagram for TSLSingleThreadCache:

Detailed Description

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.
 

Constructor & Destructor Documentation

◆ TSLSingleThreadCache()

TSLSingleThreadCache::TSLSingleThreadCache ( )

Constructor.

◆ ~TSLSingleThreadCache()

TSLSingleThreadCache::~TSLSingleThreadCache ( )
inlineprotected

Destructor.

Member Function Documentation

◆ destroy()

void TSLSingleThreadCache::destroy ( )

Destroy method. This should be called rather than deleting the object, since the calls are redirected internally to MapLink.

◆ getCacheSize()

uint64_t TSLSingleThreadCache::getCacheSize ( ) const

Returns the maximum size of the cache, in megabytes.

Returns
the current size of the cache in megabytes.

◆ operator new() [1/2]

void * TSLSingleThreadCache::operator new ( size_t size)

Allocation override for API redirection.

◆ operator new() [2/2]

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.

◆ setCacheSize()

void TSLSingleThreadCache::setCacheSize ( uint64_t size)

Sets the maximum size of the cache, in megabytes.

Parameters
sizethe new size of the cache in megabytes.

◆ setSharedCache()

bool TSLSingleThreadCache::setSharedCache ( TSLDataLayer & dataLayer)

Sets the shared cache to be used by the given data layer.

Parameters
dataLayerthe data layer (TSLDataLayer) to set to use this cache.
Returns
'true' on success, 'false' otherwise.

◆ userCount()

int TSLSingleThreadCache::userCount ( ) const

Returns the number of data layers that are using this cache.

Returns
the number of data layers that are using this cache.