HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_WorkItemOptions.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef PDG_WORK_ITEM_OPTIONS_H
10 #define PDG_WORK_ITEM_OPTIONS_H
11 
12 #include "PDG_API.h"
13 #include "PDG_Types.h"
14 
15 #include <UT/UT_Optional.h>
16 #include <UT/UT_StringHolder.h>
17 
18 /**
19  * Options available to configure the construction of a PDG work item
20  */
22 {
23  /// Behavior that controls whether or not data is cloned when generating
24  /// a work item from a parent item
25  enum CloneMode
26  {
27  /// Uses the work item data type to determine whether or not data
28  /// should be cloned
30 
31  /// Always clones the upstream data regardless of the data type's
32  /// preference
34 
35  /// Never clones the data, regardless of the data type's
36  /// preference
37  eCloneNever
38  };
39 
40  /// Default initialization
42  : PDG_WorkItemOptions("", -1)
43  {
44  }
45 
46  /// Simple name/index initialization
48  : myName(name)
49  , myTypeName("")
50  , myCloneTarget(nullptr)
51  , myParent(nullptr)
52  , myParentArray(nullptr)
53  , myParentArrayOffset(0)
54  , myIndex(index)
55  , myCloneMode(eCloneDefault)
56  , myCookType(PDG_WorkItemCookType::eAutomatic)
57  , myBatchSize(0)
58  , myBatchOffset(0)
59  , myBatch(false)
60  , myInProcess(false)
61  , myIsNoGenerate(false)
62  , myPreserveDataType(false)
63  , myCloneOutputFiles(false)
64  , myIsServiceMode(false)
65  , myIsPartialCook(false)
66  , myIsDynamicBatch(false)
67  , myPriority()
68  {
69  }
70 
71  /// The name of the work item. This field is no longer used as work
72  /// items cannot have custom names.
74 
75  /// The name of the type name - if this is null/empty string, the
76  /// node's default work item data type is used
78 
79  /// The parent array, used when generating static items with a batch to hook
80  /// up dependencies between subitems and upstream items
82 
83  /// A locally stored version of the parent array, when the more efficient
84  /// reference-based version is not suitable.
86 
87  /// The parent item, only valid when generating static items when the parent
88  /// is not already determined
90 
91  /// The item from which data should be cloned. If this is null, defaults to
92  /// the parent as computed by the workitem holder.
94 
95  /// The parent array offset, used when adding dependencies from the parent
96  /// array. Batch sub item 0 goes with parent_array[parent_offset], and so
97  /// forth.
99 
100  /// The work items index. If this is < 0, the upstream item index is
101  /// used
102  int myIndex;
103 
104  /// The work item priority. By default it is 'unset' and will inherit the
105  /// parent priority. setPriority will cause the priority to override that
106  /// behavior. getPriority will return 0 when the value is unset.
107  int getPriority() const
108  { return myPriority.value_or(0); }
109  void setPriority(int priority)
110  { myPriority = priority; }
111  bool isPrioritySet() const
112  { return myPriority.has_value(); }
113 
114  /// Clone behavior
116 
117  /// Work item cook type
119 
120  /// Batch size, only used when Batch is true
122 
123  /// Batch offset, only used when Batch is true
125 
126  /// Indicates that this is a batch work item
127  bool myBatch;
128 
129  /// Indicates that this is an in-process work item
131 
132  /// Indicates that this item cannot be used for downstream generation
134 
135  /// Indicates that the data type should be preserved when cloning
137 
138  /// Indicates that output results should be copied when cloning
140 
141  // Indicates whether this work item will be cooked by a service
143 
144  /// Indicates whether or not the work item supports partial cooking of
145  /// batches. Only used when Batch is true.
147 
148  /// Indicates whether or not a batch work item can dynamically add sub
149  /// items while it cooks. Only used when Batch is true.
151 
152 private:
153  UT_Optional<int> myPriority;
154 };
155 
156 #endif
const PDG_WorkItem * myCloneTarget
UT_StringHolder myName
bool myCloneOutputFiles
Indicates that output results should be copied when cloning.
#define PDG_API
Definition: PDG_API.h:23
PDG_WorkItemArray myLocalParentArray
PDG_WorkItemCookType
Enumeration of work item cook types.
Definition: PDG_Types.h:486
PDG_WorkItemOptions()
Default initialization.
std::optional< T > UT_Optional
Definition: UT_Optional.h:26
PDG_WorkItemCookType myCookType
Work item cook type.
int myBatchSize
Batch size, only used when Batch is true.
CloneMode myCloneMode
Clone behavior.
const PDG_WorkItemArray * myParentArray
GLuint const GLchar * name
Definition: glcorearb.h:786
int myBatchOffset
Batch offset, only used when Batch is true.
Unspecified/automatic cook type.
bool myPreserveDataType
Indicates that the data type should be preserved when cloning.
GLuint index
Definition: glcorearb.h:786
bool myIsNoGenerate
Indicates that this item cannot be used for downstream generation.
UT_StringHolder myTypeName
bool myBatch
Indicates that this is a batch work item.
PDG_WorkItemOptions(const UT_StringHolder &name, int index)
Simple name/index initialization.
void setPriority(int priority)
bool myInProcess
Indicates that this is an in-process work item.