AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
UnresolvedTask.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. 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
18#ifndef AGX_UNRESOLVED_TASK_H
19#define AGX_UNRESOLVED_TASK_H
20
21
23#include <agx/Task.h>
24#include <agxData/Value.h>
25#include <agx/Pointer.h>
27
28#ifdef _MSC_VER
29# pragma warning(push)
30# pragma warning( disable : 4275 ) // warning C4275: non dll-interface class
31# pragma warning( disable : 4251 ) // class X needs to have dll-interface to be used by clients of class Y
32#endif
33
34
35namespace agx
36{
40 {
41 public:
43
44 static Task* load(TiXmlElement* eTask, Device* device);
45 virtual void configure(TiXmlElement* eTask) override;
46 void configureSource(TiXmlElement* eTask);
48
50
51 static Task* parse(const String& function, const InjectCallback& injectCallback = InjectCallback(&UnresolvedTask::injectInstance));
52 public:
54 const Name& instanceName, Device* device, const Path& taskPath, const Name& implementationName,
55 const Path& basePath = Path(), const InjectCallback& injectCallback = InjectCallback(&UnresolvedTask::injectInstance));
56
57 virtual void run() override;
58
60
61 const Name& getInstanceName() const;
63
64 // virtual agx::Job* getPreJob();
65 // virtual agx::Job* getPostJob();
66
67 protected:
68 virtual ~UnresolvedTask();
69
70
71 private:
72 void retain();
73 void valueUpdateCallback(Parameter* value);
74 bool instantiateProxy();
75 void performLoadAttempts();
76 void tryPlugin();
77 void tryKernel();
78 void tryKernel(const Path& path);
79 void tryTask();
80 void swapDevice();
81 void tryInstanciateTask(TiXmlElement* eTask);
82 void addProxyParameter(UnresolvedParameter* parameter);
83 void configureInstance();
84 static void splitParameters(const String& function, StringVector& result);
85 void configure(const String& function);
86
87 using Task::configure;
88
89 static void injectInstance(UnresolvedTask* proxy);
90 // static Parameter* loadParameter(TiXmlElement* eValue);
91
92#if AGX_USE_OPENCL()
93 void createVerifierTask();
94#endif
95
96 static void glInitCallback();
97 static agx::HashSet<UnresolvedTask *> s_glTasks;
98 static Callback s_glInitCallback;
99
100 private:
101 // typedef HashTable<String, ParameterRef> ParameterTable;
102 ParameterTable m_proxyParameters;
103 Path m_basePath;
104 Path m_taskPath;
105 Task* m_instance;
106 Name m_instanceName;
107 Name m_implementation;
108 Device* m_device;
109 Parameter::Event::CallbackType m_valueUpdateCallback;
110 ParameterPtrVector m_nonInstanceParameters;
111 InjectCallback m_injectCallback;
112 Path m_triggerPath;
113 TaskRef m_retain;
114 PointerRefVector m_aliases;
115 TiXmlElement* m_eTask;
116#if AGX_USE_OPENCL()
117 Bool m_shouldVerify;
118#endif
119 };
120}
121
122#ifdef _MSC_VER
123# pragma warning(pop)
124#endif
125
126
127#endif /* _AGX_UNRESOLVED_TASK_H_ */
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGXCORE_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
Templated callback with one argument.
Definition: Callback.h:101
Generalized callback, using std::function.
Definition: Callback.h:54
An agx::Device is an abstract representation of a device on which data can be stored and processed.
Definition: Device.h:58
T CallbackType
Definition: Event.h:37
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: agx/HashSet.h:670
Inheritance with partial specialization due to bug with ref_ptr containers.
A model is an abstract representation of the class of an agx::Object.
Definition: Model.h:41
Representation of a name string.
Definition: Name.h:33
A representation of a task/kernel parameter, which can be bound using a string path or explicitly to ...
Definition: Parameter.h:62
Representation of a path, a list of name components.
Definition: Path.h:33
SerialTask.
Definition: Task.h:469
A representation of a generic task.
Definition: Task.h:57
Unresolved parameter.
Definition: Parameter.h:216
const Name & getImplementationName() const
void configureSource(TiXmlElement *eTask)
virtual ~UnresolvedTask()
static void deleteAllConfiguredProxies()
Callback1< UnresolvedTask * > InjectCallback
static Task * load(TiXmlElement *eTask, Device *device)
static Task * parse(const String &function, const InjectCallback &injectCallback=InjectCallback(&UnresolvedTask::injectInstance))
virtual void configure(TiXmlElement *eTask) override
UnresolvedTask(const Name &instanceName, Device *device, const Path &taskPath, const Name &implementationName, const Path &basePath=Path(), const InjectCallback &injectCallback=InjectCallback(&UnresolvedTask::injectInstance))
static agx::Model * ClassModel()
virtual void run() override
Execution callback.
const Name & getInstanceName() const
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition: Integer.h:40