MT Showcase SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Showcase::CodiceServiceCache Class Reference

This class acts as a cache for marker properties queried from via CodiceServiceAPI. More...

#include <CodiceCache.hpp>

Public Member Functions

 CodiceServiceCache ()=default
 Default constructor.
 
 CodiceServiceCache (CodiceServiceCache &&o)
 Move constructor.
 
CodiceServiceCacheoperator= (CodiceServiceCache &&o)
 Move assignment operator.
 
const
CodiceServiceAPI::MarkerProperties & 
markerProperties (uint64_t code) const
 Query marker properties from the cache. More...
 
bool isCached (uint64_t markerCode) const
 Check if the given marker is in the cache. More...
 
void cache (uint64_t markerCode, CodiceServiceAPI::MarkerProperties props)
 Cache the given marker properties for specified marker code. More...
 
void invalidateCache (uint64_t markerCode)
 Invalidate the given marker code in the cache. More...
 

Detailed Description

This class acts as a cache for marker properties queried from via CodiceServiceAPI.

Since CodiceServiceAPI is synchronous, it is usually best to avoid calling it directly from the main thread to avoid stalling the UI.

Member Function Documentation

void Showcase::CodiceServiceCache::cache ( uint64_t  markerCode,
CodiceServiceAPI::MarkerProperties  props 
)

Cache the given marker properties for specified marker code.

Parameters
markerCodemarker code to cache for
propsproperties to cache
void Showcase::CodiceServiceCache::invalidateCache ( uint64_t  markerCode)

Invalidate the given marker code in the cache.

Parameters
markerCodemarker code to invalidate
bool Showcase::CodiceServiceCache::isCached ( uint64_t  markerCode) const

Check if the given marker is in the cache.

Parameters
markerCodemarker code to check
Returns
true if the marker properties are in cache; otherwise false
const CodiceServiceAPI::MarkerProperties & Showcase::CodiceServiceCache::markerProperties ( uint64_t  code) const

Query marker properties from the cache.

This will only query the cache and will never perform a query using CodiceServiceAPI. Will throw an exception if the requested marker properties are in cache.

Parameters
codemarker code to query
Returns
marker properties from cache