HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
legacyTaskFactory.h
Go to the documentation of this file.
1 //
2 // Copyright 2024 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HD_LEGACY_TASK_FACTORY_H
8 #define PXR_IMAGING_HD_LEGACY_TASK_FACTORY_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
12 
13 #include "pxr/usd/sdf/path.h"
14 
15 #include <memory>
16 
18 
19 class HdSceneDelegate;
20 using HdTaskSharedPtr = std::shared_ptr<class HdTask>;
21 using HdLegacyTaskFactorySharedPtr = std::shared_ptr<class HdLegacyTaskFactory>;
22 
23 ///
24 /// \class HdLegacyTaskFactory
25 ///
26 /// An abstract base class to create implementations of HdTask.
27 ///
29 {
30 public:
31  virtual HdTaskSharedPtr Create(
32  HdSceneDelegate * delegate, const SdfPath &id) = 0;
33 
34  HD_API
35  virtual ~HdLegacyTaskFactory();
36 };
37 
38 template<typename T>
40 {
41 public:
43  HdSceneDelegate * const delegate, const SdfPath &id) override
44  {
45  return std::make_shared<T>(delegate, id);
46  }
47 };
48 
49 /// Given a subclass implementing HdTask, create a factory for that
50 /// subclass.
51 template<typename T>
53 {
54  return std::make_shared<HdLegacyTaskFactory_Impl<T>>();
55 }
56 
58 
59 #endif
#define HD_API
Definition: api.h:23
std::shared_ptr< class HdTask > HdTaskSharedPtr
HdLegacyTaskFactorySharedPtr HdMakeLegacyTaskFactory()
GLuint id
Definition: glcorearb.h:655
Definition: path.h:273
HdTaskSharedPtr Create(HdSceneDelegate *const delegate, const SdfPath &id) override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
virtual HD_API ~HdLegacyTaskFactory()
virtual HdTaskSharedPtr Create(HdSceneDelegate *delegate, const SdfPath &id)=0
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
std::shared_ptr< class HdLegacyTaskFactory > HdLegacyTaskFactorySharedPtr