VR-Forces 4.1.1 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
include
vrfutil
asyncJob.h
Go to the documentation of this file.
1
/*******************************************************************************
2
** Copyright 2010 VT MAK
3
*******************************************************************************/
4
7
8
#pragma once
9
10
#include <vlutil/vlPrint.h>
11
#include <vlutil/vlExceptions.h>
12
13
#include "
asyncJobMapEntry.h
"
14
#include "
asyncJobServer.h
"
15
16
#include "tbb/task.h"
17
18
#include "boost/function.hpp"
19
24
25
#include <
vrfutil/vrfutilDefines.h
>
26
27
struct
job_canceled
{};
//exception for termination of a task during execution.
28
struct
outside_search_radius
{};
//exception for graph search has gone too far out of the way.
29
30
struct
DtJobCancelStruct
31
{
32
DtJobCancelStruct
(
size_t
id
,
DtAsyncJobServer
* jobServer)
33
:
myId
(id)
34
,
myJobServer
(jobServer)
35
{
36
37
}
38
39
bool
operator()
()
const
40
{
41
return
myJobServer
->
jobStatus
(
myId
) ==
canceled
;
42
}
43
44
size_t
myId
;
45
DtAsyncJobServer
*
myJobServer
;
46
};
47
48
//An asynchronous job that can be added to and executed by a job server.
49
class
DT_DLL_vrfutil
DtAsyncJob
:
public
tbb::task
50
{
51
public
:
52
DtAsyncJob
();
53
54
virtual
~
DtAsyncJob
();
55
56
//Do not override. Calls onExecute, then onException if there is an exception thrown.
57
virtual
task
* execute();
58
60
virtual
task
* onExecute() = 0;
62
virtual
task
* onException() = 0;
63
64
protected
:
67
friend
class
DtAsyncJobServer
;
68
DtAsyncJobServer
*
myJobServer
;
69
size_t
myId
;
70
};
71
Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (
www.mak.com
)