HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_Types.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_TYPES_H__
10 #define __PDG_TYPES_H__
11 
12 #include <PDGT/PDGT_BaseType.h>
14 #include <PDGT/PDGT_TypeInstance.h>
15 
16 #include <UT/UT_Array.h>
17 #include <UT/UT_ArrayMap.h>
18 #include <UT/UT_ArraySet.h>
19 #include <UT/UT_ArrayStringMap.h>
20 #include <UT/UT_Map.h>
21 #include <UT/UT_Set.h>
22 #include <UT/UT_SharedPtr.h>
23 #include <UT/UT_Optional.h>
24 #include <UT/UT_UniquePtr.h>
25 
26 #include <SYS/SYS_Types.h>
27 
28 #include <utility>
29 
30 class PDG_BatchWorkItem;
31 class PDG_Dependency;
32 class PDG_Node;
33 class PDG_NodeCallback;
34 class PDG_Port;
35 class PDG_Scheduler;
36 class PDG_Service;
37 class PDG_WorkItem;
38 class PDG_WorkItemData;
39 
40 /// Type defs for registered type objects
46 
47 /// Type defs for unique work item IDs
52 
53 /// Array, set and map of work items
62 
63 /// Pair and array of work item pairs
64 using PDG_WorkItemPair = std::pair<PDG_WorkItem*, PDG_WorkItem*>;
66 
67 /// Array and set of batch work items
70 
71 /// Array, set and map of nodes
74 
78 
79 /// Array of input/output/parameter ports
81 
82 /// Set of schedulers
85 
87 
88 /// Enumeration of supported platforms, for work item command line array
89 enum class PDG_Platform
90 {
91  /// No specified platform
92  eUndefined = -1,
93 
94  /// The linux platform index
95  eLinux = 0,
96 
97  /// The mac platform index
98  eMac = 1,
99 
100  /// The windows platform index
101  eWindows = 2,
102 };
103 
104 /// Enumeration of activiation modes for the batch, i.e. the condition under
105 /// which the batch item is first submitted to the scheduler
107 {
108  /// The batch is scheduled once any of the subitems are ready to cook
109  eAny,
110 
111  /// The batch is scheduled once the first sub item is ready to cook
112  eFirst,
113 
114  /// The batch is scheduled once all of the subitems are ready to cook
115  eAll,
116 
117  /// The batch is scheduled once a specific number of subitems are ready
118  /// to cook
119  eFixed
120 };
121 
122 /// Enumeration of callback return types
124 {
125  /// The callback failed to execute
126  eFailure,
127 
128  /// The callback executed successfully
129  eSuccess,
130 
131  /// The callback is missing or undefined
132  eMissing,
133 
134  /// Special "None" case -- the callback took no action or returned no
135  /// results
136  eNone,
137 
138  /// Special "All" case -- the callback returned all results
139  eAll,
140 };
141 
142 /// Enumeration of service block cook modes
144 {
145  /// Work items will never cook using the service associated with the
146  /// parent block
147  eNever,
148 
149  /// Work items will cook the parent block's service if it matches the
150  /// service name for the node
151  eMatch,
152 
153  /// Work items will always use the parent block's service
154  eAlways,
155 };
156 
157 /// When service clients should be reset
159 {
160  /// The service client is not reset
161  eNone = 0x0,
162 
163  /// The service client is reset at the start of a work item or block cook
164  eBeforeCook = 0x1,
165 
166  /// The service client is reset at the end of a work item or block cook
167  eAfterCook = 0x2,
168 
169  /// The service is reset at the beginning and end of a cook
170  eBoth = 0x3
171 };
172 
173 /// Service client reset operation, performed each time work items acquire a
174 /// new client.
176 {
177  /// The service client is not reset
178  eNone,
179 
180  /// The service client is sent the "reset" command
181  eReset,
182 
183  /// The service client process is restarted
184  eRestart
185 };
186 
187 /// Enumeration of the different types of service owner
189 {
190  /// The service is owned by a scheduler, which means it will be tied to
191  /// the lifetime of the scheduler node(s).
192  eScheduler,
193 
194  /// The service is owned by the session, which means it will be stopped
195  /// only if stopped by the user or Houdini is closed.
196  eSession
197 };
198 
199 /// Enumeration of the different states that a service can be in
201 {
202  // The service is not running
203  eStopped,
204 
205  // The service is in the process of stopping. The service will remain in
206  // this state until the MQ Server and all of the service clients have
207  // been issued a command to shutdown.
208  eStopping,
209 
210  // The service is in the process of starting. The service will remain in
211  // this state until all of the service clients have fully started up.
212  eStarting,
213 
214  // The service is fully running and all clients are available.
215  eRunning,
216 
217  // The service is in an unrecoverable error state
218  eError
219 };
220 
221 /// Enumeration of service log types
223 {
224  /// The service does not do any logging -- stdout is routed to
225  /// /dev/null
226  eNone,
227 
228  /// The service logs to stdout
229  eStdout,
230 
231  /// The service logs to a file on disk
232  eFile
233 };
234 
235 /// Enumeration of possible result values from starting a service
237 {
238  /// An error occured and the service was not started
239  eError,
240 
241  /// The service was successfully started
242  eSuccess,
243 
244  /// The service was already running
245  eRunning,
246 
247  /// The service clients are connecting in the background
249 };
250 
251 /// Node state, used for UI/progress reporting.
252 enum class PDG_NodeState
253 {
254  /// The node is uncooked, either because it wasn't on the cook path or
255  /// because it chose to generate no items
256  eUncooked,
257 
258  /// The node is actively cooking work items
259  eCooking,
260 
261  /// The node is completely cooked
262  eCooked,
263 
264  /// One or more work items failed during the cook
265  eFailed,
266 
267  /// One or more work items were canceled during the cook
268  eCanceled,
269 
270  /// The node is waiting on upstream nodes to make progress
271  eWaiting,
272 
273  /// The node is partially cooked, and likely won't make any progress
274  /// during the rest of the active cook
276 };
277 
278 /// Enumeration of node types in a PDG graph
279 enum class PDG_NodeType
280 {
281  /// Mapper nodes -- add dependencies between upstream and downstream
282  /// work items [Deprecated]
283  eMapper,
284 
285  /// Partitioner nodes -- group multiple upstream work items into
286  /// partitions with a common property
287  ePartitioner,
288 
289  /// Processor nodes -- generate zero more more new work items from
290  /// upstream work items that perform real work
291  eProcessor,
292 
293  /// Scheduler nodes -- submits work items to some sort of scheduling
294  /// or farm system
295  eScheduler,
296 
297  /// Placeholder/undefined node type
298  eUndefined
299 };
300 
301 /// Enumeration of node subtypes
302 enum class PDG_NodeSubtype
303 {
304  /// A regular node -- default value
305  eRegular,
306 
307  /// A feedback begin node -- part of a feedback block
309 
310  /// A feedback end node -- part of a feedback block
311  eFeedbackEnd,
312 
313  /// A utility node, such as a null or switch
314  eUtility,
315 
316  /// Placeholder/undefined node subtype
317  eUndefined
318 };
319 
320 /// Enumeration of node port display type, e.g. menus or toggles, for
321 /// parameters
323 {
324  /// Default display type
325  eDefault = 0x0,
326 
327  /// Dropdown menu display
328  eMenu = 0x01,
329 
330  /// Toggle display
331  eToggle = 0x02,
332 
333  /// Join-next display
334  eJoin = 0x04,
335 
336  /// Separator display
337  eSeparator = 0x08,
338 
339  /// No label display
340  eNoLabel = 0x10,
341 
342  /// Operator path display
343  eOperator = 0x20,
344 };
345 
346 /// Enumeration of node port types
347 enum class PDG_PortType
348 {
349  /// Input connection
350  eInput,
351 
352  /// Output connection
353  eOutput,
354 
355  /// Parameter
356  eParameter,
357 
358  /// Port type guard/count
359  eCount
360 };
361 
362 /// Enumeration of evaluation states that a work item can be in. Used when
363 /// checking if the subitem is able to evaluate yet.
365 {
366  /// The work item is blocked on a dependency
367  eEvalBlocked,
368 
369  /// The work item is ready to cook
370  eEvalReady,
371 
372  /// The work item has a failed dependency
373  eEvalFailed,
374 };
375 
376 /// Enumeration of work item log message types
378 {
379  /// Error log message
380  eLogError,
381 
382  /// Warning log message
383  eLogWarning,
384 
385  /// Plain log message
386  eLogMessage,
387 
388  /// Raw log data
389  eLogRaw,
390 };
391 
392 /// Enumeration of sort order types, currently used by the partitionItems
393 /// method
395 {
396  /// Explicitly chosen no sorting
397  eSortNone,
398 
399  /// Index based sorting
400  eSortIndex,
401 
402  /// Input ordering
404 
405  /// Order by a specific attribute value
407 
408  /// Order by the work item's frame value
409  eSortFrame,
410 };
411 
412 /// Enum of possible work item states
414 {
415  /// Undefined state, e.g. for uninitialized data. Work items should never
416  /// actually have this state
417  eUndefined,
418 
419  /// The item is uncooked and no cooked has been attempted yet
420  eUncooked,
421 
422  /// The item is uncooked and waiting on its dependencies to finish
423  /// cooking
424  eWaiting,
425 
426  /// The item has been sent to the scheduler(s), but might not yet
427  /// be executing
428  eScheduled,
429 
430  /// The item is cooking
431  eCooking,
432 
433  /// The item has finished cooking and succeeded
435 
436  /// The item has was marked as successfully cooked because it a cached
437  /// file was found on disk
438  eCookedCache,
439 
440  /// The item has finished cooking and failed
441  eCookedFail,
442 
443  /// The item has finished cooking by cancellation
445 
446  /// The item was dirty; it may have been cooked before, but not
447  /// necessarily. This is effectively the same as uncooked, but it
448  /// gives an indication that item may need additional cleanup or
449  /// repartitioning.
450  eDirty,
451 
452  /// The number of states
453  eStateCount,
454 };
455 
456 /// Enum of work item types
458 {
459  /// A static or dynamic work item that does real work, and has one
460  /// upstream parent
461  eRegular,
462 
463  /// A batch item, which consists of one or more subitems that are
464  /// Regular type items
465  eBatch,
466 
467  /// A partition, which has a list of upstream components
468  ePartition,
469 };
470 
471 /// Enum of work item runtime types
473 {
474  /// A regular work item, with normal running time
475  eRegular,
476 
477  /// A long running work item that's process may outlive the cooking state
478  /// of the work item
479  eLongRunning,
480 
481  /// A work item that cleans up another long running item
482  eCleanup
483 };
484 
485 /// Enumeration of work item cook types
487 {
488  /// The work item does its processing during the generation stage,
489  /// and doesn't "cook" in the traditional sense.
490  eGenerate,
491 
492  /// The work item cooks in process
493  eInProcess,
494 
495  /// The work item cooks out of process
497 
498  /// The work item cooks as a service
499  eService,
500 
501  /// Unspecified/automatic cook type
502  eAutomatic
503 };
504 
505 /// Enumeration of entities that can be registered with PDG_TypeRegistry
507 {
508  /// Custom external dependency
509  eDependency,
510 
511  /// Custom node definition
512  eNode,
513 
514  /// Custom scheduler definition
515  eScheduler,
516 
517  /// Custom work item data definition
518  eWorkItem,
519 
520  /// Custom service defintion
521  eService,
522 
523  eCount
524 };
525 
526 /// Enumeration of merge strategies for handling collisions when
527 /// deserializing attributes into a map with existing attributes
529 {
530  /// The existing attribute is kept and the deserialized attribute is
531  /// discarded
532  eKeep,
533 
534  /// The existing attribute is replaced with the deserialized attribute
535  eReplace,
536 
537  /// Deserialization fails when an existing attribute is found with the
538  /// same name as the one being deserialized
539  eError
540 };
541 
543 {
547 };
548 
549 /// Base type for types registered using PDG_TypeRegistry
551 
552 /// Specialization type which encapsulates the produced class and
553 /// construction args, for a type registered in the registry
554 template <typename Class,
555  typename Pointer,
557  typename... Args>
559  Class, Pointer, PDG_RegistrationType, type, Args...>;
560 
561 /// Base class for a concrete instance of a type created by the
562 /// registry
564 
565 #endif /* __PDG_TYPES_H__ */
PDG_ServiceStartResult
Enumeration of possible result values from starting a service.
Definition: PDG_Types.h:236
The service logs to a file on disk.
UT_SharedPtr< PDG_NodeCallback > PDG_NodeCallbackPtr
Definition: PDG_Types.h:42
PDG_CommandType
Definition: PDG_Types.h:542
The service clients are connecting in the background.
Custom work item data definition.
UT_SharedPtr< PDG_Service > PDG_ServicePtr
Definition: PDG_Types.h:44
PDG_NodeSubtype
Enumeration of node subtypes.
Definition: PDG_Types.h:302
Output connection.
UT_SharedPtr< PDG_Scheduler > PDG_SchedulerPtr
Definition: PDG_Types.h:43
The batch is scheduled once all of the subitems are ready to cook.
One or more work items failed during the cook.
The service is reset at the beginning and end of a cook.
No specified platform.
Placeholder/undefined node type.
The number of states.
PDG_NodeType
Enumeration of node types in a PDG graph.
Definition: PDG_Types.h:279
The service client is reset at the start of a work item or block cook.
The work item is blocked on a dependency.
The node is completely cooked.
The batch is scheduled once any of the subitems are ready to cook.
int64 exint
Definition: SYS_Types.h:125
The service logs to stdout.
Custom node definition.
Order by a specific attribute value.
The service client is sent the "reset" command.
The work item is ready to cook.
UT_Optional< fpreal > OptionalFrame
Definition: PDG_Types.h:86
A feedback end node – part of a feedback block.
A feedback begin node – part of a feedback block.
PDG_WorkItemCookType
Enumeration of work item cook types.
Definition: PDG_Types.h:486
Operator path display.
PDG_ServiceState
Enumeration of the different states that a service can be in.
Definition: PDG_Types.h:200
std::pair< PDG_WorkItem *, PDG_WorkItem * > PDG_WorkItemPair
Pair and array of work item pairs.
Definition: PDG_Types.h:64
std::optional< T > UT_Optional
Definition: UT_Optional.h:26
UT_UniquePtr< PDG_Node > PDG_NodePtr
Array, set and map of nodes.
Definition: PDG_Types.h:72
Custom external dependency.
Dropdown menu display.
A work item that cleans up another long running item.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
The batch is scheduled once the first sub item is ready to cook.
The work item cooks in process.
unsigned char uint8
Definition: SYS_Types.h:36
The mac platform index.
UT_SharedPtr< PDG_WorkItemData > PDG_WorkItemDataPtr
Definition: PDG_Types.h:45
PDG_WorkItemSortOrder
Definition: PDG_Types.h:394
The windows platform index.
PDG_ServiceBlockCookType
Enumeration of service block cook modes.
Definition: PDG_Types.h:143
The item has finished cooking and succeeded.
The callback is missing or undefined.
The work item has a failed dependency.
PDG_BatchActivation
Definition: PDG_Types.h:106
Input connection.
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
PDG_RegistrationType
Enumeration of entities that can be registered with PDG_TypeRegistry.
Definition: PDG_Types.h:506
The callback failed to execute.
A utility node, such as a null or switch.
PDG_WorkItemLogType
Enumeration of work item log message types.
Definition: PDG_Types.h:377
The service client process is restarted.
PDG_ServiceOwner
Enumeration of the different types of service owner.
Definition: PDG_Types.h:188
The work item cooks as a service.
PDG_WorkItemExecutionType
Enum of work item runtime types.
Definition: PDG_Types.h:472
PDG_PortType
Enumeration of node port types.
Definition: PDG_Types.h:347
PDG_NodeState
Node state, used for UI/progress reporting.
Definition: PDG_Types.h:252
The item has finished cooking and failed.
PDG_ServiceResetType
Definition: PDG_Types.h:175
PDG_WorkItemState
Enum of possible work item states.
Definition: PDG_Types.h:413
PDG_CallbackResult
Enumeration of callback return types.
Definition: PDG_Types.h:123
Placeholder/undefined node subtype.
PDG_Platform
Enumeration of supported platforms, for work item command line array.
Definition: PDG_Types.h:89
Work items will always use the parent block's service.
The service client is reset at the end of a work item or block cook.
Default display type.
PDG_WorkItemEvalState
Definition: PDG_Types.h:364
PDG_AttributeCollision
Definition: PDG_Types.h:528
Unspecified/automatic cook type.
Order by the work item's frame value.
Port type guard/count.
Join-next display.
A partition, which has a list of upstream components.
The item has finished cooking by cancellation.
PDG_ServiceResetWhen
When service clients should be reset.
Definition: PDG_Types.h:158
No cast error occured (success)
PDG_WorkItemType
Enum of work item types.
Definition: PDG_Types.h:457
UT_SharedPtr< PDG_Dependency > PDG_DependencyPtr
Type defs for registered type objects.
Definition: PDG_Types.h:41
The node is actively cooking work items.
PDG_PortDisplayType
Definition: PDG_Types.h:322
The node is waiting on upstream nodes to make progress.
exint PDG_WorkItemID
Type defs for unique work item IDs.
Definition: PDG_Types.h:48
PDG_ServiceLogType
Enumeration of service log types.
Definition: PDG_Types.h:222
The work item cooks out of process.
type
Definition: core.h:1059
The existing attribute is replaced with the deserialized attribute.
The linux platform index.
One or more work items were canceled during the cook.
A regular node – default value.
Explicitly chosen no sorting.