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