IsRunning()
const;
128 voidx_OnJobNotification(
CEvent* evt);
144std::rethrow_exception(m_Exception);
149 virtual string GetText()
const{
return ""; };
167m_State = rhs.m_State;
168m_Canceled = rhs.m_Canceled;
169m_Result = std::move(rhs.m_Result);
170m_Error = std::move(rhs.m_Error);
171m_JobAdapter = std::move(rhs.m_JobAdapter);
174m_JobAdapter->SetCallback(
this);
177rhs.m_Canceled =
false;
187m_State = rhs.m_State;
188m_Canceled = rhs.m_Canceled;
189m_Result = std::move(rhs.m_Result);
190m_Error = std::move(rhs.m_Error);
191m_JobAdapter = std::move(rhs.m_JobAdapter);
194m_JobAdapter->SetCallback(
this);
197rhs.m_Canceled =
false;
204 bool IsRunning()
const{
returnm_JobAdapter ? m_JobAdapter->IsRunning() :
false; }
213m_JobAdapter->Cancel();
220 virtual voidOnJobCanceled();
234 boolm_Canceled =
false;
242 template<
class_Rty>
281 template<
class_Rty>
288m_Canceled =
result->GetCanceled();
289 return result->SetData();
291 throwstd::runtime_error(m_BadJobResponse);
359 template<
class_Fty,
typename_Rty>
362m_Result.Reset(
new TResult());
366 result.SetData() = m_Farg(*x_GetICanceled());
368 catch(
conststd::exception&) {
381 template<
class_Fty>
397 template<
class_Fty>
406 catch(
conststd::exception&) {
419 template<
class_Fty>
427 template<
class_Fty>
432 return typenametr::future(*job);
466 template<
class_Fty,
typename_Rty>
478 if(
future.IsComplete()) {
492 template<
class_Fty,
class_Fty2>
497async_job_type* job =
newasync_job_type(_Fnarg2,
job_async(_Fnarg, descr));
CEvent - generic event implementation TODO TODO - Attachments.
Base class to build jobs with cancel functionality.
virtual void OnJobResult(CObject *result)=0
virtual void OnJobCanceled()=0
virtual void OnJobFailed(const IAppJobError *error)=0
Here is set of classes to implement launching jobs (to execute code on a worker thread using C++ Tool...
IJobCallback * m_Callback
CAppJobDispatcher::TJobID m_JobId
void SetCallback(IJobCallback *callback)
std::exception_ptr m_Exception
virtual string GetText() const
returns a string describing the error
virtual bool IsUserLevel() const
CJobFutureError(const std::exception_ptr &ex)
virtual CConstIRef< IAppJobError > GetError()
Returns IAppJobError object describing internal error that caused the Job to fail.
CJobFutureJobBase(const string &descr)
virtual CConstIRef< IAppJobProgress > GetProgress()
return progress object, the function shall be synchronized internally.
virtual CRef< CObject > GetResult()
Returns the Job Result.
CConstRef< CJobFutureError > m_Error
virtual string x_GetJobName() const
virtual string GetDescr() const
Returns a human readable description of the Job (optional)
CJobFutureJob(const _Fty &_Fnarg, const string &descr)
CJobFutureResultRet< _Rty > TResult
virtual EJobState Run()
Function that does all the useful work, called by the Engine.
CJobFutureJob(const _Fty &_Fnarg, const string &descr)
list< async_job * > m_Jobs
void AddJob(async_job *job)
static CJobHandler & Instance()
void x_RemoveJob(async_job *job)
async_job_impl(const _Fty &_Fnres, job_future< _Rty > &&_future)
job_future< _Rty > future
virtual bool complete()=0
virtual bool canceled()=0
job_future & operator=(job_future &&rhs)
job_future(job_future &&rhs)
virtual ~job_future_base()
job_future_base & operator=(job_future_base const &)=delete
CRef< CJobFutureAdapter > m_JobAdapter
CConstRef< CJobFutureError > m_Error
job_future_base(job_future_base const &)=delete
job_future_base(job_future_base &&rhs)
job_future_base & operator=(job_future_base &&rhs)
static const char * m_BadJobResponse
job_future_base
job_future(job_future &&rhs)
job_future & operator=(job_future &&rhs)
ICanceled * x_GetICanceled()
virtual bool IsCanceled() const override
EJobState
Job states (describe FSM)
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual void Process(SOCK sock)=0
Runs asynchronously (from a separate thread) for each request.
#define NCBI_GUIUTILS_EXPORT
Defines to provide correct exporting from DLLs in Windows.
job_function_traits< _Fty >::future job_async(const _Fty &_Fnarg, const string &descr)
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
CJobFutureJob< _Fty, result > job
job_future< result > future
std::invoke_result< _Fty, ICanceled & >::type result
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4