VR-Forces 4.8 Class Documentation
 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 2010 VT MAK
3 *******************************************************************************/
4 
7 
8 #pragma once
9 
10 #include <vrfutil/vrfutilDefines.h>
11 
12 #include <vlutil/vlPrint.h>
13 #include <vlutil/vlExceptions.h>
14 
15 #include "asyncJobMapEntry.h"
16 #include "asyncJobServer.h"
17 
19 #include <vrfutil/objectCounter.h>
20 
21 #include <tbb/task.h>
22 
23 #include <boost/function.hpp>
24 
25 class DtAsyncJob;
26 
28 struct job_canceled{};
29 
33 {
34 public:
35  DtJobCancelledFunc(const DtAsyncJob& job);
36  bool operator()() const;
37 
38 protected:
39  const DtAsyncJob& job;
40 };
41 
48  : public tbb::task
49  , public DtAlgorithmManager
50  , public DtObjectDebugger<DtAsyncJob>
51 {
52 public:
54  DtAsyncJob();
55 
57  virtual ~DtAsyncJob();
58 
60  virtual task* execute();
61 
63  virtual task* onExecute() = 0;
64 
66  virtual task* onException() = 0;
67 
69  virtual void tick();
70 
73  virtual boost::shared_ptr<DtAsyncJobMapEntry> getEntry() const = 0;
74 
76  virtual void setEntry(boost::shared_ptr<DtAsyncJobMapEntry>) = 0;
77 
79  bool cancel() const;
80 
81 protected:
83 };
84 
90 {
91 public:
92  boost::shared_ptr<DtAsyncJobMapEntry> getEntry() const;
93  void setEntry(boost::shared_ptr<DtAsyncJobMapEntry>);
94 
95 protected:
96  boost::weak_ptr<DtAsyncJobMapEntry> myEntry;
97 };
98 
104 {
105 public:
106  boost::shared_ptr<DtAsyncJobMapEntry> getEntry() const;
107  void setEntry(boost::shared_ptr<DtAsyncJobMapEntry>);
108 
109  task* execute();
110 
111 protected:
112  boost::shared_ptr<DtAsyncJobMapEntry> myEntry;
113 };
114 
Concrete job class which manages a weak pointer to it&#39;s job map entry.
Definition: asyncJob.h:89
virtual void setEntry(boost::shared_ptr< DtAsyncJobMapEntry >)=0
Set the job entry.
virtual boost::shared_ptr< DtAsyncJobMapEntry > getEntry() const =0
Returns the entry associated with this task.
An asynchronous job that can be added to and executed by a job server.
Definition: asyncJob.h:47
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:265
Default on in debug, off in release.
Definition: objectCounter.h:31
Concrete job class which manages a shared pointer to it&#39;s job map entry.
Definition: asyncJob.h:103
virtual bool cancel() const
Returns true if no longer needed.
DtAsyncJobServer * myServer
Definition: asyncJob.h:82
#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
virtual task * execute()
Do not override. Calls onExecute, then onException if there is an exception thrown.
Manages async job objects.
Definition: asyncJobServer.h:73
Exception for termination of a task during execution.
Definition: asyncJob.h:28
boost::weak_ptr< DtAsyncJobMapEntry > myEntry
Definition: asyncJob.h:96
boost::shared_ptr< DtAsyncJobMapEntry > myEntry
Definition: asyncJob.h:112
General interface which can be passed into an algorithm to control its behavior.
Definition: algorithmManager.h:24
const DtAsyncJob & job
Definition: asyncJob.h:39
For passing to algorithms which may take long enough that they need to check if they can been cancell...
Definition: asyncJob.h:32

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)