Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cJobBase Class Referenceabstract

#include <cJobBase.h>

Inheritance diagram for GrayLib::cJobBase:
Gray::cRefBase Gray::cThreadState IUnknown GrayLib::cJobPender GrayLib::cJobUnitTest GrayLib::cJobWaiter GrayLib::cScriptJob

Public Member Functions

 cJobBase (cJobArray *pArrayParent=nullptr) noexcept
 
 STDMETHOD_ (cString, get_Name)() const =0
 overload this to give the job a name. More...
 
virtual HRESULT DisposeThis ()
 
virtual void put_JobParam (INT_PTR iParam)
 
bool isJobScheduled () const noexcept
 
TIMESYS_t get_SortValue () const noexcept
 
TIMESYS_t get_TimeNext () const noexcept
 
TIMESECD_t get_TimeNextSec () const noexcept
 
TIMESECD_t get_TimeLastSec () const noexcept
 
HRESULT RunJobX ()
 
HRESULT ClearJob ()
 
HRESULT ScheduleJob (TIMESYSD_t mSecDelay)
 
HRESULT ScheduleJobX (TIMESYSD_t mSecDelay)
 
HRESULT ScheduleJobParam (INT_PTR iParam)
 
virtual void ResetJobTime ()
 reset the next time. More...
 
HRESULT put_TimeNext (TIMESYS_t nTimeNext)
 Job may be in a sorted list. so protect all the time setting functions. More...
 
- Public Member Functions inherited from Gray::cRefBase
 cRefBase (int iRefCount=0) noexcept
 
virtual ~cRefBase ()
 
int get_RefCount () const noexcept
 
HASHCODE_t get_HashCode () const noexcept
 
 STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept
 
virtual void onFinalRelease ()
 
bool isValidObj () const noexcept
 
 STDMETHOD_ (ULONG, AddRef)(void) override
 
 STDMETHOD_ (ULONG, Release)(void) override
 
STDMETHOD() QueryInterface (const IID &riid, void __RPC_FAR *__RPC_FAR *ppvObject) override
 
void IncRefCount ()
 
void DecRefCount ()
 
bool isStaticConstruct () const noexcept
 
void StaticConstruct ()
 
void StaticDestruct ()
 
bool isDestructing () noexcept
 
void SetDestructing ()
 
- Public Member Functions inherited from Gray::cThreadState
 cThreadState () noexcept
 
bool isThreadRunning () const noexcept
 
bool isThreadStopping () const noexcept
 
virtual bool RequestStopThread (bool bWillWait=false) noexcept
 

Static Public Attributes

static const TIMESYS_t k_ASAP = 1
 

Protected Member Functions

virtual HRESULT RunJob ()=0
 Override this to make the job do some real work. More...
 

Friends

class cJobArray
 

Additional Inherited Members

- Protected Attributes inherited from Gray::cThreadState
bool m_bThreadRunning
 called CreateThread() onThreadCreate(), and inside Run(), until onThreadExit() More...
 
volatile bool m_bThreadStopping
 trying to stop the thread nicely. Do this before TerminateThread() More...
 

Detailed Description

Base/Abstract for a single job to be performed/scheduled some time when i get around to it. Maybe on another thread. maybe not. can be used with cJobFiber, cJobThreadSeq or cJobThread etc.

Note
Jobs waiting on 1 or many cSysEvent uses cJobPender

Constructor & Destructor Documentation

◆ cJobBase()

GrayLib::cJobBase::cJobBase ( cJobArray pArrayParent = nullptr)
inlinenoexcept

Member Function Documentation

◆ ClearJob()

HRESULT GrayLib::cJobBase::ClearJob ( )
inline

don't do this task.

◆ DisposeThis()

virtual HRESULT GrayLib::cJobBase::DisposeThis ( void  )
inlinevirtual

If the job is running now, Soft cancel it.

◆ get_SortValue()

TIMESYS_t GrayLib::cJobBase::get_SortValue ( ) const
inlinenoexcept

◆ get_TimeLastSec()

TIMESECD_t GrayLib::cJobBase::get_TimeLastSec ( ) const
inlinenoexcept

seconds since this ran last. <0 = never.

◆ get_TimeNext()

TIMESYS_t GrayLib::cJobBase::get_TimeNext ( ) const
inlinenoexcept

When is this task scheduled next? cTimeSys::k_CLEAR = 0 = not scheduled. 1 = k_ASAP

◆ get_TimeNextSec()

TIMESECD_t GrayLib::cJobBase::get_TimeNextSec ( ) const
inlinenoexcept

seconds until it runs next. INT_MAX = not scheduled. <=0 = should run any time now.

◆ isJobScheduled()

bool GrayLib::cJobBase::isJobScheduled ( ) const
inlinenoexcept

is Job scheduled to run at some time? m_timeNext = 1 = ASAP

◆ put_JobParam()

virtual void GrayLib::cJobBase::put_JobParam ( INT_PTR  iParam)
inlinevirtual

Set some arbitrary parameter depending on the actual job.

◆ put_TimeNext()

HRESULT GrayLib::cJobBase::put_TimeNext ( TIMESYS_t  nTimeNext)

Job may be in a sorted list. so protect all the time setting functions.

When should this job run next ? nTimeNext = system time to schedule this again. cTimeSys::k_CLEAR = 0 = never.

If this is already in a job array. this must be resorted!!

◆ ResetJobTime()

virtual void GrayLib::cJobBase::ResetJobTime ( )
inlinevirtual

reset the next time.

reset the time to next run of the job. (depends on the job)

◆ RunJob()

virtual HRESULT GrayLib::cJobBase::RunJob ( )
protectedpure virtual

Override this to make the job do some real work.

Implemented in GrayLib::cScriptJob, and GrayLib::cJobUnitTest.

◆ RunJobX()

HRESULT GrayLib::cJobBase::RunJobX ( )

◆ ScheduleJob()

HRESULT GrayLib::cJobBase::ScheduleJob ( TIMESYSD_t  mSecDelay)
inline

schedule to run this in mSecDelay from now. mSecDelay = Relative to now. 0 = now

◆ ScheduleJobParam()

HRESULT GrayLib::cJobBase::ScheduleJobParam ( INT_PTR  iParam)
inline

Do this ASAP. With a param.

◆ ScheduleJobX()

HRESULT GrayLib::cJobBase::ScheduleJobX ( TIMESYSD_t  mSecDelay)
inline

schedule to run this in mSecDelay from last time. (or now) Relative to last time. 0 = never

◆ STDMETHOD_()

GrayLib::cJobBase::STDMETHOD_ ( cString  ,
get_Name   
) const
pure virtual

overload this to give the job a name.

Implemented in GrayLib::cJobUnitTest.

Friends And Related Function Documentation

◆ cJobArray

friend class cJobArray
friend

Member Data Documentation

◆ k_ASAP

const TIMESYS_t GrayLib::cJobBase::k_ASAP = 1
static

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