AGX Dynamics  2.37.3.2
UnresolvedTask.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 
18 #ifndef AGX_UNRESOLVED_TASK_H
19 #define AGX_UNRESOLVED_TASK_H
20 
21 
22 #include <agx/config/AGX_USE_OPENCL.h>
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 
35 namespace agx
36 {
40  {
41  public:
42  static agx::Model* ClassModel();
43 
44  static Task* load(TiXmlElement* eTask, Device* device);
45  virtual void configure(TiXmlElement* eTask) override;
46  void configureSource(TiXmlElement* eTask);
47  static void deleteAllConfiguredProxies();
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 
59  Task* getInstance();
60 
61  const Name& getInstanceName() const;
62  const Name& getImplementationName() 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_ */
Representation of a path, a list of name components.
Definition: Path.h:32
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: HashSet.h:669
bool Bool
Definition: Integer.h:48
A model is an abstract representation of the class of an agx::Object.
Definition: Model.h:40
Generalized callback, using std::function.
Definition: Callback.h:53
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
A representation of a generic task.
Definition: Task.h:57
Representation of a name string.
Definition: Name.h:32
Callback1< UnresolvedTask * > InjectCallback
SerialTask.
Definition: Task.h:469
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
A representation of a task/kernel parameter, which can be bound using a string path or explicitly to ...
Definition: Parameter.h:61
virtual void configure(TiXmlElement *eTask) override
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
Inheritance with partial specialization due to bug with ref_ptr containers.
An agx::Device is an abstract representation of a device on which data can be stored and processed...
Definition: Device.h:57
Unresolved parameter.
Definition: Parameter.h:215
#define AGXCORE_EXPORT