VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
asyncJob.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <vrfutil/vrfutilDefines.h>
12 
13 #include <vlutil/vlPrint.h>
14 #include <vlutil/vlExceptions.h>
15 
16 #include "asyncJobMapEntry.h"
17 #include "asyncJobServer.h"
18 
20 #include <vrfutil/objectCounter.h>
21 
22 #include <boost/function.hpp>
23 
24 class DtAsyncJob;
25 
27 struct job_canceled{};
28 
32 {
33 public:
34  DtJobCancelledFunc(const DtAsyncJob& job);
35  bool operator()() const;
36 
37 protected:
38  const DtAsyncJob& job;
39 };
40 
47  : public DtAlgorithmManager
48 #ifdef DtObjectDebugger_Enable
49  , public DtObjectDebugger<DtAsyncJob>
50 #endif
51 {
52 public:
54  DtAsyncJob();
55 
57  virtual ~DtAsyncJob();
58 
60  virtual void execute();
61 
63  virtual void onExecute() = 0;
64 
66  virtual void onException() = 0;
67 
69  virtual void tick();
70 
73  virtual std::shared_ptr<DtAsyncJobMapEntry> getEntry() const = 0;
74 
76  virtual void setEntry(std::shared_ptr<DtAsyncJobMapEntry>) = 0;
77 
79  virtual bool cancel() const override;
80 
81 protected:
83 };
84 
90 {
91 public:
92  virtual std::shared_ptr<DtAsyncJobMapEntry> getEntry() const override;
93  virtual void setEntry(std::shared_ptr<DtAsyncJobMapEntry>) override;
94 
95 protected:
96  std::weak_ptr<DtAsyncJobMapEntry> myEntry;
97 };
98 
104 {
105 public:
106  virtual std::shared_ptr<DtAsyncJobMapEntry> getEntry() const override;
107  virtual void setEntry(std::shared_ptr<DtAsyncJobMapEntry>) override;
108 
109  virtual void execute() override;
110 
111 protected:
112  std::shared_ptr<DtAsyncJobMapEntry> myEntry;
113 };
114 
Concrete job class which manages a weak pointer to it&#39;s job map entry. Using this job will require th...
Definition: asyncJob.h:89
An asynchronous job that can be added to and executed by a job server. Since this class derives from ...
Definition: asyncJob.h:46
virtual void setEntry(std::shared_ptr< DtAsyncJobMapEntry >)=0
Set the job entry.
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:31
Default on in debug, off in release.
Definition: objectCounter.h:27
Concrete job class which manages a shared pointer to it&#39;s job map entry. Using this job does not requ...
Definition: asyncJob.h:103
virtual bool cancel() const
Returns true if no longer needed.
DtAsyncJobServer * myServer
Definition: asyncJob.h:82
virtual void execute()
Do not override. Calls onExecute, then onException if there is an exception thrown.
std::weak_ptr< DtAsyncJobMapEntry > myEntry
Definition: asyncJob.h:96
virtual std::shared_ptr< DtAsyncJobMapEntry > getEntry() const =0
Returns the entry associated with this task. If it is null the task is no longer needed.
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
Manages async job objects.
Definition: asyncJobServer.h:61
Exception for termination of a task during execution.
Definition: asyncJob.h:27
General interface which can be passed into an algorithm to control its behavior.
Definition: algorithmManager.h:24
std::shared_ptr< DtAsyncJobMapEntry > myEntry
Definition: asyncJob.h:112
const DtAsyncJob & job
Definition: asyncJob.h:38
For passing to algorithms which may take long enough that they need to check if they can been cancell...
Definition: asyncJob.h:31

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)