Unravel Engine C++ Reference
Loading...
Searching...
No Matches
fs::cache< T > Class Template Reference

#include <cache.hpp>

Classes

struct  cache_entry
 

Public Types

using iterator_t = T
 
using clock_t = std::chrono::steady_clock
 

Public Member Functions

 cache ()=default
 
 cache (const fs::path &p, clock_t::duration scan_frequency)
 
 cache (const fs::path &p, const pattern_filter &filter, clock_t::duration scan_frequency)
 
 cache (const cache &rhs)
 
 cache (cache &&rhs) noexcept
 
cacheoperator= (const cache &rhs)
 
cacheoperator= (cache &&rhs) noexcept
 
 ~cache ()
 
decltype(auto) begin () const
 Returns the begin iterator for the underlying cached container and also refreshes the container if needed.
 
decltype(auto) end () const
 Returns the end iterator for the underlying cached container.
 
decltype(auto) size () const
 Returns the size for the underlying cached container.
 
decltype(auto) at (size_t idx) const
 Directly index into the underlying cached container.
 
decltype(auto) operator[] (size_t idx) const
 
void refresh () const
 Refreshes the cache and updates the timestamp of the last refresh. This operation is slow so try to not call it often. By default it is called only if iterated and marked by the dir watcher since its last refresh.
 
const fs::path & get_path () const
 
void set_path (const fs::path &path, const fs::pattern_filter &filter)
 
void set_scan_frequency (clock_t::duration scan_frequency)
 

Detailed Description

template<typename T>
class fs::cache< T >

Definition at line 14 of file cache.hpp.

Member Typedef Documentation

◆ clock_t

template<typename T >
using fs::cache< T >::clock_t = std::chrono::steady_clock

Definition at line 22 of file cache.hpp.

◆ iterator_t

template<typename T >
using fs::cache< T >::iterator_t = T

Definition at line 17 of file cache.hpp.

Constructor & Destructor Documentation

◆ cache() [1/5]

template<typename T >
fs::cache< T >::cache ( )
default

◆ cache() [2/5]

template<typename T >
fs::cache< T >::cache ( const fs::path & p,
clock_t::duration scan_frequency )
inline

Definition at line 26 of file cache.hpp.

◆ cache() [3/5]

template<typename T >
fs::cache< T >::cache ( const fs::path & p,
const pattern_filter & filter,
clock_t::duration scan_frequency )
inline

Definition at line 34 of file cache.hpp.

◆ cache() [4/5]

template<typename T >
fs::cache< T >::cache ( const cache< T > & rhs)
inline

Definition at line 43 of file cache.hpp.

◆ cache() [5/5]

template<typename T >
fs::cache< T >::cache ( cache< T > && rhs)
inlinenoexcept

Definition at line 53 of file cache.hpp.

◆ ~cache()

template<typename T >
fs::cache< T >::~cache ( )
inline

Definition at line 89 of file cache.hpp.

Member Function Documentation

◆ at()

template<typename T >
decltype(auto) fs::cache< T >::at ( size_t idx) const
inline

Directly index into the underlying cached container.

Definition at line 141 of file cache.hpp.

◆ begin()

template<typename T >
decltype(auto) fs::cache< T >::begin ( ) const
inline

Returns the begin iterator for the underlying cached container and also refreshes the container if needed.

Definition at line 100 of file cache.hpp.

◆ end()

template<typename T >
decltype(auto) fs::cache< T >::end ( ) const
inline

Returns the end iterator for the underlying cached container.

Definition at line 115 of file cache.hpp.

◆ get_path()

template<typename T >
const fs::path & fs::cache< T >::get_path ( ) const
inline

Definition at line 194 of file cache.hpp.

◆ operator=() [1/2]

template<typename T >
cache & fs::cache< T >::operator= ( cache< T > && rhs)
inlinenoexcept

Definition at line 76 of file cache.hpp.

◆ operator=() [2/2]

template<typename T >
cache & fs::cache< T >::operator= ( const cache< T > & rhs)
inline

Definition at line 63 of file cache.hpp.

◆ operator[]()

template<typename T >
decltype(auto) fs::cache< T >::operator[] ( size_t idx) const
inline

Definition at line 145 of file cache.hpp.

◆ refresh()

template<typename T >
void fs::cache< T >::refresh ( ) const
inline

Refreshes the cache and updates the timestamp of the last refresh. This operation is slow so try to not call it often. By default it is called only if iterated and marked by the dir watcher since its last refresh.

Definition at line 159 of file cache.hpp.

◆ set_path()

template<typename T >
void fs::cache< T >::set_path ( const fs::path & path,
const fs::pattern_filter & filter )
inline

Definition at line 199 of file cache.hpp.

◆ set_scan_frequency()

template<typename T >
void fs::cache< T >::set_scan_frequency ( clock_t::duration scan_frequency)
inline

Definition at line 212 of file cache.hpp.

◆ size()

template<typename T >
decltype(auto) fs::cache< T >::size ( ) const
inline

Returns the size for the underlying cached container.

Definition at line 126 of file cache.hpp.


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