ZNC  trunk
Public Types | Public Member Functions | Protected Attributes | List of all members
CModuleJob Class Referenceabstract

A CJob version which can be safely used in modules. More...

#include <Modules.h>

+ Inheritance diagram for CModuleJob:
+ Collaboration diagram for CModuleJob:

Public Types

enum  EJobState { READY , RUNNING , DONE , CANCELLED }
 

Public Member Functions

 CModuleJob (CModule *pModule, const CString &sName, const CString &sDesc)
 
virtual ~CModuleJob ()
 
 CModuleJob (const CModuleJob &)=delete
 
CModuleJoboperator= (const CModuleJob &)=delete
 
CModuleGetModule () const
 
const CStringGetName () const
 
const CStringGetDescription () const
 
virtual void runThread ()=0
 This function is called in a separate thread and can do heavy, blocking work. More...
 
virtual void runMain ()=0
 This function is called from the main thread after runThread() finishes. More...
 
bool wasCancelled () const
 This can be used to check if the job was cancelled. More...
 

Protected Attributes

CModulem_pModule
 
const CString m_sName
 
const CString m_sDescription
 

Detailed Description

A CJob version which can be safely used in modules.

The job will be cancelled when the module is unloaded.

Member Enumeration Documentation

◆ EJobState

enum CJob::EJobState
inherited
Enumerator
READY 
RUNNING 
DONE 
CANCELLED 

Constructor & Destructor Documentation

◆ CModuleJob() [1/2]

CModuleJob::CModuleJob ( CModule pModule,
const CString sName,
const CString sDesc 
)
inline

◆ ~CModuleJob()

virtual CModuleJob::~CModuleJob ( )
virtual

◆ CModuleJob() [2/2]

CModuleJob::CModuleJob ( const CModuleJob )
delete

Member Function Documentation

◆ GetDescription()

const CString& CModuleJob::GetDescription ( ) const
inline

References m_sName.

◆ GetModule()

CModule* CModuleJob::GetModule ( ) const
inline

◆ GetName()

const CString& CModuleJob::GetName ( ) const
inline

References m_pModule.

◆ operator=()

CModuleJob& CModuleJob::operator= ( const CModuleJob )
delete

◆ runMain()

virtual void CJob::runMain ( )
pure virtualinherited

This function is called from the main thread after runThread() finishes.

It can be used to handle the results from runThread() without needing synchronization primitives.

◆ runThread()

virtual void CJob::runThread ( )
pure virtualinherited

This function is called in a separate thread and can do heavy, blocking work.

◆ wasCancelled()

bool CJob::wasCancelled ( ) const
inherited

This can be used to check if the job was cancelled.

For example, runThread() can return early if this returns true.

Member Data Documentation

◆ m_pModule

CModule* CModuleJob::m_pModule
protected

Referenced by GetName().

◆ m_sDescription

const CString CModuleJob::m_sDescription
protected

◆ m_sName

const CString CModuleJob::m_sName
protected

Referenced by GetDescription().


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