AGX Dynamics  2.37.2.0
TaskTemplate.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_TASKTEMPLATE_H
18 #define AGX_TASKTEMPLATE_H
19 
20 #include <agx/agx.h>
21 #include <agx/Task.h>
22 // #include <agx/TaskManager.h>
23 #include <agx/TaskExport.h>
24 //#include <agx/Component.h>
25 #include <agx/TaskManager.h>
26 #include <agx/Model.h>
27 
28 typedef agx::Task * (*TaskConstructor)(agx::Device *device);
29 
30 #define AGX_PRE_JOB
31 #define AGX_POST_JOB
32 
33 #define AGX_TASK(_Name, _Path) \
34 namespace \
35 { \
36  agx::TaskPlugin plugin_ ## _Name(_Path, agx::Device::CPU); \
37  agx::TaskPluginImplementationT<_Name> plugin_implementation(&plugin_ ## _Name); \
38 }
39 
40 #if 0
41  \
42 extern "C" \
43 { \
44  \
45 AGXTASK_EXPORT const char *name() \
46 { \
47  return #_Name; \
48 } \
49  \
50  \
51 AGXTASK_EXPORT agx::Device::Type deviceType() \
52 { \
53  return _DeviceType; \
54 } \
55  \
56 AGXTASK_EXPORT agx::Task *create(agx::Device *device, agx::UInt implementation) \
57 { \
58  return implementation == 0 ? new ::_Name(device) : nullptr; \
59 } \
60  \
61 AGXTASK_EXPORT void destroy(agx::Task * /*task*/) \
62 { \
63  /*delete task; */ \
64 } \
65 }
66 
67 #define AGX_OVERLOADED_TASK(_Name, _DeviceType) \
68  \
69 extern "C" \
70 { \
71  \
72 AGXTASK_EXPORT const char *name() \
73 { \
74  return #_Name; \
75 } \
76  \
77  \
78 AGXTASK_EXPORT agx::Device::Type deviceType() \
79 { \
80  return _DeviceType; \
81 } \
82  \
83 AGXTASK_EXPORT agx::Task *create(agx::Device *device, agx::UInt implementation) \
84 { \
85  return constructors[implementation] ? constructors[implementation](device) : nullptr; \
86 } \
87  \
88 AGXTASK_EXPORT void destroy(agx::Task * /*task*/) \
89 { \
90  /*delete task; */ \
91 } \
92 }
93 #endif
94 
95 
96 #endif /* _AGX_TASKTEMPLATE_H_ */
97 
A representation of a generic task.
Definition: Task.h:57
uint32_t UInt
Definition: Integer.h:34
Type
Explicit list of device types.
Definition: Device.h:75
An agx::Device is an abstract representation of a device on which data can be stored and processed...
Definition: Device.h:57