lv_cache_entry.h

Functions

uint32_t lv_cache_entry_get_size(const uint32_t node_size)

Get the size of a cache entry.

Parameters:

node_size -- The size of the node in the cache.

Returns:

The size of the cache entry.

int32_t lv_cache_entry_get_ref(lv_cache_entry_t *entry)

Get the reference count of a cache entry.

Parameters:

entry -- The cache entry to get the reference count of.

Returns:

The reference count of the cache entry.

uint32_t lv_cache_entry_get_node_size(lv_cache_entry_t *entry)

Get the node size of a cache entry. Which is the same size with lv_cache_entry_get_size()'s node_size parameter.

Parameters:

entry -- The cache entry to get the node size of.

Returns:

The node size of the cache entry.

bool lv_cache_entry_is_invalid(lv_cache_entry_t *entry)

Check if a cache entry is invalid.

Parameters:

entry -- The cache entry to check.

Returns:

True: the cache entry is invalid. False: the cache entry is valid.

void *lv_cache_entry_get_data(lv_cache_entry_t *entry)

Get the data of a cache entry.

Parameters:

entry -- The cache entry to get the data of.

Returns:

The pointer to the data of the cache entry.

const lv_cache_t *lv_cache_entry_get_cache(const lv_cache_entry_t *entry)

Get the cache instance of a cache entry.

Parameters:

entry -- The cache entry to get the cache instance of.

Returns:

The pointer to the cache instance of the cache entry.

lv_cache_entry_t *lv_cache_entry_get_entry(void *data, const uint32_t node_size)

Get the cache entry of a data. The data should be allocated by the cache instance.

Parameters:
  • data -- The data to get the cache entry of.

  • node_size -- The size of the node in the cache.

Returns:

The pointer to the cache entry of the data.

lv_cache_entry_t *lv_cache_entry_alloc(const uint32_t node_size, const lv_cache_t *cache)

Allocate a cache entry.

Parameters:
  • node_size -- The size of the node in the cache.

  • cache -- The cache instance to allocate the cache entry from.

Returns:

The pointer to the allocated cache entry.

void lv_cache_entry_init(lv_cache_entry_t *entry, const lv_cache_t *cache, const uint32_t node_size)

Initialize a cache entry.

Parameters:
  • entry -- The cache entry to initialize.

  • cache -- The cache instance to allocate the cache entry from.

  • node_size -- The size of the node in the cache.

void lv_cache_entry_delete(lv_cache_entry_t *entry)

Deallocate a cache entry. And the data of the cache entry will be freed.

Parameters:

entry -- The cache entry to deallocate.