The Battle for Wesnoth  1.19.7+dev
Public Member Functions | Private Attributes | List of all members
image::cache_type< T > Class Template Reference

Public Member Functions

bool in_cache (const locator &item) const
 
const T * locate_in_cache (const locator &item) const
 Returns a pointer to the cached value, or nullptr if not found. More...
 
T & access_in_cache (const locator &item)
 Returns a reference to the cache item associated with the given key. More...
 
void add_to_cache (const locator &item, T data)
 
void flush ()
 

Private Attributes

std::unordered_map< locator, T > content_
 

Detailed Description

template<typename T>
class image::cache_type< T >

Definition at line 77 of file picture.cpp.

Member Function Documentation

◆ access_in_cache()

template<typename T >
T& image::cache_type< T >::access_in_cache ( const locator item)
inline

Returns a reference to the cache item associated with the given key.

If no corresponding value is found, a default instance will be created.

Definition at line 99 of file picture.cpp.

References image::cache_type< T >::content_.

◆ add_to_cache()

template<typename T >
void image::cache_type< T >::add_to_cache ( const locator item,
data 
)
inline

Definition at line 104 of file picture.cpp.

References image::cache_type< T >::content_, and data.

◆ flush()

template<typename T >
void image::cache_type< T >::flush ( )
inline

Definition at line 109 of file picture.cpp.

References image::cache_type< T >::content_.

◆ in_cache()

template<typename T >
bool image::cache_type< T >::in_cache ( const locator item) const
inline

Definition at line 80 of file picture.cpp.

References image::cache_type< T >::content_.

◆ locate_in_cache()

template<typename T >
const T* image::cache_type< T >::locate_in_cache ( const locator item) const
inline

Returns a pointer to the cached value, or nullptr if not found.

Definition at line 86 of file picture.cpp.

References image::cache_type< T >::content_.

Member Data Documentation

◆ content_

template<typename T >
std::unordered_map<locator, T> image::cache_type< T >::content_
private

The documentation for this class was generated from the following file: