MythTV  master
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PeriodicHouseKeeperTask Class Reference

Modified HouseKeeperTask for tasks to be run at a regular interval. More...

#include <housekeeper.h>

Inheritance diagram for PeriodicHouseKeeperTask:
Inheritance graph
[legend]
Collaboration diagram for PeriodicHouseKeeperTask:
Collaboration graph
[legend]

Public Member Functions

 PeriodicHouseKeeperTask (const QString &dbTag, std::chrono::seconds period, float min=0.5, float max=1.1, std::chrono::seconds retry=0s, HouseKeeperScope scope=kHKGlobal, HouseKeeperStartup startup=kHKNormal)
 
bool DoCheckRun (const QDateTime &now) override
 
virtual bool InWindow (const QDateTime &now)
 
virtual bool PastWindow (const QDateTime &now)
 
QDateTime UpdateLastRun (const QDateTime &last, bool successful=true) override
 
void SetLastRun (const QDateTime &last, bool successful=true) override
 
virtual void SetWindow (float min, float max)
 
- Public Member Functions inherited from HouseKeeperTask
 HouseKeeperTask (const QString &dbTag, HouseKeeperScope scope=kHKGlobal, HouseKeeperStartup startup=kHKNormal)
 
 ~HouseKeeperTask () override=default
 
bool CheckRun (const QDateTime &now)
 
bool Run (void)
 
bool ConfirmRun (void) const
 
bool IsRunning (void) const
 
bool CheckImmediate (void)
 
bool CheckStartup (void)
 
QString GetTag (void)
 
QDateTime GetLastRun (void)
 
QDateTime GetLastSuccess (void)
 
HouseKeeperScope GetScope (void)
 
QDateTime QueryLastRun (void)
 
QDateTime QueryLastSuccess (void)
 
QDateTime UpdateLastRun (bool successful=true)
 
virtual bool DoRun (void)
 
virtual void Terminate (void)
 
- Public Member Functions inherited from ReferenceCounter
 ReferenceCounter (const QString &debugName, bool logDebug=true)
 Creates reference counter with an initial value of 1. More...
 
virtual int IncrRef (void)
 Increments reference count. More...
 
virtual int DecrRef (void)
 Decrements reference count and deletes on 0. More...
 

Protected Member Functions

virtual void CalculateWindow (void)
 
- Protected Member Functions inherited from ReferenceCounter
virtual ~ReferenceCounter (void)
 Called on destruction, will warn if object deleted with references in place. More...
 

Protected Attributes

std::chrono::seconds m_period
 
std::chrono::seconds m_retry
 
QPair< float, float > m_windowPercent
 
QPair< std::chrono::seconds, std::chrono::seconds > m_windowElapsed
 
float m_currentProb
 
- Protected Attributes inherited from ReferenceCounter
bool m_logDebug
 This is used to suppress creating LoggingItem classes for LoggingItem reference count changes. More...
 
QAtomicInt m_referenceCount {1}
 

Additional Inherited Members

- Static Public Member Functions inherited from ReferenceCounter
static void PrintDebug (void)
 Print out any leaks if that level of debugging is enabled. More...
 

Detailed Description

Modified HouseKeeperTask for tasks to be run at a regular interval.

This task type is to be used for tasks that need to be run at a regular interval. The period argument in the constructor defines this interval in integer seconds. The min and max attributes control the region over which the task can be run, given as a float multiple of the period. The defaults are 0.5-1.1. The test for running is a linearly increasing probability from the start to end of this period, and the task is forced to run if the end of the period is reached.

Definition at line 85 of file housekeeper.h.

Constructor & Destructor Documentation

◆ PeriodicHouseKeeperTask()

PeriodicHouseKeeperTask::PeriodicHouseKeeperTask ( const QString &  dbTag,
std::chrono::seconds  period,
float  min = 0.5,
float  max = 1.1,
std::chrono::seconds  retry = 0s,
HouseKeeperScope  scope = kHKGlobal,
HouseKeeperStartup  startup = kHKNormal 
)

Definition at line 324 of file housekeeper.cpp.

Member Function Documentation

◆ DoCheckRun()

bool PeriodicHouseKeeperTask::DoCheckRun ( const QDateTime &  now)
overridevirtual

◆ InWindow()

bool PeriodicHouseKeeperTask::InWindow ( const QDateTime &  now)
virtual

Reimplemented in DailyHouseKeeperTask.

Definition at line 416 of file housekeeper.cpp.

Referenced by DailyHouseKeeperTask::InWindow().

◆ PastWindow()

bool PeriodicHouseKeeperTask::PastWindow ( const QDateTime &  now)
virtual

Definition at line 428 of file housekeeper.cpp.

Referenced by DailyHouseKeeperTask::InWindow().

◆ UpdateLastRun()

QDateTime PeriodicHouseKeeperTask::UpdateLastRun ( const QDateTime &  last,
bool  successful = true 
)
overridevirtual

Reimplemented from HouseKeeperTask.

Definition at line 356 of file housekeeper.cpp.

Referenced by HardwareProfile::SubmitProfile().

◆ SetLastRun()

void PeriodicHouseKeeperTask::SetLastRun ( const QDateTime &  last,
bool  successful = true 
)
overridevirtual

Reimplemented from HouseKeeperTask.

Definition at line 365 of file housekeeper.cpp.

◆ SetWindow()

void PeriodicHouseKeeperTask::SetWindow ( float  min,
float  max 
)
virtual

Definition at line 349 of file housekeeper.cpp.

◆ CalculateWindow()

void PeriodicHouseKeeperTask::CalculateWindow ( void  )
protectedvirtual

Member Data Documentation

◆ m_period

std::chrono::seconds PeriodicHouseKeeperTask::m_period
protected

Definition at line 101 of file housekeeper.h.

Referenced by CalculateWindow(), and PeriodicHouseKeeperTask().

◆ m_retry

std::chrono::seconds PeriodicHouseKeeperTask::m_retry
protected

Definition at line 102 of file housekeeper.h.

Referenced by CalculateWindow(), and PeriodicHouseKeeperTask().

◆ m_windowPercent

QPair<float,float> PeriodicHouseKeeperTask::m_windowPercent
protected

Definition at line 103 of file housekeeper.h.

Referenced by CalculateWindow(), and SetWindow().

◆ m_windowElapsed

QPair<std::chrono::seconds,std::chrono::seconds> PeriodicHouseKeeperTask::m_windowElapsed
protected

◆ m_currentProb

float PeriodicHouseKeeperTask::m_currentProb
protected

Definition at line 105 of file housekeeper.h.

Referenced by DoCheckRun(), SetLastRun(), and UpdateLastRun().


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