digiKam
Digikam::KMemoryInfo Class Reference

Public Types

enum  MemoryDetail {
  TotalRam = 1 << 0 , AvailableRam = 1 << 1 , TotalSwap = 1 << 10 , AvailableSwap = 1 << 11 ,
  AvailableMemory = AvailableRam | AvailableSwap
}
 

Public Member Functions

qint64 bytes (MemoryDetails detail) const
 
int isValid () const
 
double kilobytes (MemoryDetails detail) const
 
 KMemoryInfo ()
 
 KMemoryInfo (const KMemoryInfo &info)
 
QDateTime lastUpdate () const
 
double megabytes (MemoryDetails detail) const
 
KMemoryInfooperator= (const KMemoryInfo &info)
 
int update ()
 
 ~KMemoryInfo ()
 

Static Public Member Functions

static KMemoryInfo currentInfo ()
 

Member Enumeration Documentation

◆ MemoryDetail

A detail of memory.

Enumerator
TotalRam 
AvailableRam 
TotalSwap 
AvailableSwap 
AvailableMemory 

Constructor & Destructor Documentation

◆ KMemoryInfo() [1/2]

Digikam::KMemoryInfo::KMemoryInfo ( )
explicit

Constructs a memory information object which has no updated information.

See also
update()

◆ KMemoryInfo() [2/2]

Digikam::KMemoryInfo::KMemoryInfo ( const KMemoryInfo info)

Copy constructor.

◆ ~KMemoryInfo()

Digikam::KMemoryInfo::~KMemoryInfo ( )

Destructor.

Member Function Documentation

◆ bytes()

qint64 Digikam::KMemoryInfo::bytes ( MemoryDetails  detail) const

Returns the specified memory details, as it was read by the last update(). If you combine the flags, they will either be added, or, when nonsensical, the larger of two values is returned (if you request TotalRam and FreeRam, you get TotalRam).

Returns
the value of the specified detail if available, or -1 if any requested detail detail was not requested or not available in the last update()

References AvailableRam, AvailableSwap, TotalRam, TotalSwap, and value.

Referenced by Digikam::DImgLoader::checkAllocation(), kilobytes(), Digikam::LibsInfoDlg::LibsInfoDlg(), and megabytes().

◆ currentInfo()

KMemoryInfo Digikam::KMemoryInfo::currentInfo ( )
static

Returns a KMemoryInfo object already updated to the current memory situation.

References update().

Referenced by Digikam::DImgLoader::checkAllocation(), and Digikam::LibsInfoDlg::LibsInfoDlg().

◆ isValid()

int Digikam::KMemoryInfo::isValid ( ) const

Returns status if last update was successful and the data is valid. -1 : not valid : unsupported platform 0 : not valid : parse failure from supported platform 1 : valid : parse done with success from supported platform

Referenced by Digikam::DImgLoader::checkAllocation(), and Digikam::LibsInfoDlg::LibsInfoDlg().

◆ kilobytes()

double Digikam::KMemoryInfo::kilobytes ( MemoryDetails  detail) const

References bytes().

◆ lastUpdate()

QDateTime Digikam::KMemoryInfo::lastUpdate ( ) const

Returns the timestamp of the last update, or a null one if the current memory information was never updated.

◆ megabytes()

double Digikam::KMemoryInfo::megabytes ( MemoryDetails  detail) const

References bytes().

◆ operator=()

KMemoryInfo & Digikam::KMemoryInfo::operator= ( const KMemoryInfo info)

◆ update()

int Digikam::KMemoryInfo::update ( )

Request an update of the system memory.

Returns
whether the update was successful : -1 : unsupported platform 0 : parse failure from supported platform 1 : parse done with success from supported platform

Referenced by currentInfo().


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