52 #ifndef __PCL_FileDataCache_h
53 #define __PCL_FileDataCache_h
116 return path == item.
path;
125 if ( path != item.
path )
126 return path < item.
path;
127 return key < item.
key;
381 return m_maxItemDuration;
398 m_maxItemDuration =
Range( days, 0, 120 );
410 return m_maxItemDuration <= 0;
457 return m_compressionEnabled;
467 m_compressionEnabled = enable;
477 EnableCompression( !disable );
573 return m_modifiedCount;
583 return m_modifiedCount > 0;
636 mutable Mutex m_mutex;
641 int m_maxItemDuration = 30;
642 bool m_compressionEnabled =
true;
643 mutable int m_modifiedCount = 0;
Element of a file data cache.
virtual ~FileDataCacheItem()
FileDataCacheItem(const FileDataCacheItem &)=default
virtual void AssignData(const FileDataCacheItem &item)
virtual IsoStringList SerializedData() const
static IsoStringList SerializedMatrices(const Array< DMatrix > &matrices)
static bool DeserializeMatrix(DMatrix &matrix, IsoStringList::const_iterator &start, const IsoStringList &tokens)
IsoString key
Cache key. Allows different cache entries for the same file.
TimePoint lastUsed
Time this cache item was last used.
static bool DeserializeVector(DVector &vector, IsoStringList::const_iterator &start, const IsoStringList &tokens)
TimePoint time
Cached file time.
void Assign(const FileDataCacheItem &item)
String path
Full path to the file represented by this item.
static bool DeserializeMultiVector(DMultiVector &multivector, IsoStringList::const_iterator &start, const IsoStringList &tokens)
double DaysSinceLastUsed() const
static IsoStringList SerializedMultiVector(const DMultiVector &multivector)
static bool DeserializeMatrices(Array< DMatrix > &matrices, IsoStringList::const_iterator &start, const IsoStringList &tokens)
static IsoStringList SerializedVector(const DVector &vector)
bool ModifiedSince(FileTime t) const
virtual bool DeserializeData(const IsoStringList &tokens)
static IsoStringList SerializedMatrix(const DMatrix &matrix)
virtual bool ValidateData() const
Abstract base class of file data cache implementations.
int MaxItemDuration() const
void DisableCompression(bool disable=true)
bool IsCompressionEnabled() const
virtual int MinSupportedVersion() const
size_type NumberOfItems() const
bool ItemsNeverExpire() const
virtual void SetMaxItemDuration(int days)
virtual String CacheName() const
virtual void Purge() const
IsoString TokenSeparator() const
void Add(const FileDataCacheItem &item)
FileDataCache(const IsoString &identifier, int maxItemDuration=30)
fsize_type FileSize() const
int ModifiedCount() const
void SetTokenSeparator(const IsoString &separator)
virtual void Save() const
void EnableCompression(bool enable=true)
bool Get(FileDataCacheItem &item, const String &path, const IsoString &key=IsoString())
const FileDataCacheItem * Find(const String &path, const IsoString &key=IsoString()) const
virtual int Version() const
virtual FileDataCacheItem * NewItem() const =0
Generic dynamic matrix of arbitrary dimensions.
Generic array of vectors.
bool IsEmpty() const noexcept
Generic vector of arbitrary length.
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Adaptive mutual exclusion lock variable.
An instant in any timescale.
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
constexpr const T & Range(const T &x, const T &a, const T &b) noexcept
uint16 milliseconds
Milliseconds [0,999].