QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ComponentInformationCache Class Reference

#include <ComponentInformationCache.h>

+ Inheritance diagram for ComponentInformationCache:
+ Collaboration diagram for ComponentInformationCache:

Public Member Functions

 ComponentInformationCache (const QDir &path, int maxNumFiles)
 
QString access (const QString &fileTag)
 
QString insert (const QString &fileTag, const QString &fileName)
 

Static Public Member Functions

static ComponentInformationCachedefaultInstance ()
 

Detailed Description

Simple file cache with a maximum number of files and LRU retention policy based on last access Notes:

  • fileTag defines the cache keys and the format is up to the user
  • only one instance per directory must exist
  • not thread-safe

Definition at line 17 of file ComponentInformationCache.h.

Constructor & Destructor Documentation

◆ ComponentInformationCache()

ComponentInformationCache::ComponentInformationCache ( const QDir &  path,
int  maxNumFiles 
)

Definition at line 11 of file ComponentInformationCache.cc.

Member Function Documentation

◆ access()

QString ComponentInformationCache::access ( const QString &  fileTag)

Try to access a file and set the access counter

Parameters
fileTag
Returns
empty string if not found, or file path

Definition at line 34 of file ComponentInformationCache.cc.

◆ defaultInstance()

ComponentInformationCache & ComponentInformationCache::defaultInstance ( )
static

Definition at line 17 of file ComponentInformationCache.cc.

◆ insert()

QString ComponentInformationCache::insert ( const QString &  fileTag,
const QString &  fileName 
)

Insert a file into the cache & remove old files if there's too many.

Parameters
fileTag
fileNamefile to insert, will be moved (or deleted if already exists)
Returns
cached file name if inserted or already exists, "" on error

Definition at line 71 of file ComponentInformationCache.cc.


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