HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_Node.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_NODE_H__
10 #define __PDG_NODE_H__
11 
12 #include "PDG_API.h"
13 
14 #include "PDG_EvaluationContext.h"
15 #include "PDG_EventEmitter.h"
16 #include "PDG_EventTypes.h"
17 #include "PDG_File.h"
18 #include "PDG_LogUtils.h"
19 #include "PDG_NodeInterface.h"
20 #include "PDG_NodeOptions.h"
21 #include "PDG_NodeStats.h"
22 #include "PDG_SchedulerTypes.h"
23 #include "PDG_ServiceTypes.h"
24 #include "PDG_SortOptions.h"
25 #include "PDG_WorkItemDirty.h"
26 #include "PDG_WorkItemTypes.h"
27 
28 #include <PDGE/PDGE_Dependency.h>
31 
32 #include <PDGT/PDGT_Value.h>
33 
34 #include <UT/UT_ArrayMap.h>
35 #include <UT/UT_ArrayStringMap.h>
36 #include <UT/UT_NonCopyable.h>
37 #include <UT/UT_RWLock.h>
38 #include <UT/UT_StringArray.h>
39 #include <UT/UT_StringHolder.h>
40 #include <UT/UT_StringMap.h>
41 #include <UT/UT_TBBSpinLock.h>
42 
43 #include <SYS/SYS_AtomicInt.h>
44 
45 class PDG_BatchWorkItem;
46 class PDG_Dependency;
47 class PDG_Filter;
48 class PDG_GraphContext;
49 struct PDG_MemoryInfo;
50 class PDG_NodeCallback;
52 class PDG_Scheduler;
53 class PDG_WorkItemHolder;
54 class PDG_WorkItem;
55 
56 class UT_JSONWriter;
57 
58 /**
59  * Base class for all nodes that keeps track of work items and helper
60  * data structures needed by sub classes. Defines several virtual methods
61  * that are implemented in concrete node subclasses.
62  */
64  public PDG_EventEmitter,
66 {
67 public:
68  /// Regeneration reasons
70  {
71  /// No regeneration necessary
73 
74  /// The node should regenerate work items because of a node option
75  /// that indicates it always regenerates.
77 
78  /// The node should regenerate work items
80 
81  /// The node should regenerate work items, and any downstream nodes
82  /// that try to cook will also inherit the state from this node
84 
85  /// The node will be dirtied.
87 
88  /// The node will be dirtied and caches invalidated
90  };
91 
92  /// Bypass state for the node
94  {
95  /// The node is not bypassed
97 
98  /// The node is in a bypassed subnetwork
100 
101  /// The node itself is bypassed
102  eBypassNode
103  };
104 
105  /// The key for the node name when writing the node to JSON
107 
108  /// The key for the node type when writing the node to JSON
110 
111  /// The key for the scheduler name when writing the node to JSON
113 
114  /// The key for the input nodes when writing the node to JSON
116 
117  /// The key for the parameters when writing the node to JSON
119 
120 public:
121  PDG_Node(
122  PDG_GraphContext* context,
123  const UT_StringHolder& name,
124  const PDG_NodeCallbackType* type_object,
125  PDG_NodeID id = -1);
126 
127  ~PDG_Node() override;
128 
129  /// Returns the list of supported event types
130  const PDG_EventFilter& supportedEventTypes() const override;
131 
132  /// Returns the total memory usage of the node, including any work items
133  /// owned by it.
134  int64 getMemoryUsage(bool inclusive) const override;
135 
136  /// Returns the memory usage as a PDG_MemoryInfo struct
137  virtual void memoryInfo(PDG_MemoryInfo& memory_info,
138  bool inclusive) const;
139 
140  /// Returns the memory used by all work items in this node. Pass true
141  /// indicate that only attribute data should be counted.
142  int64 workItemMemory(bool attribs_only=false) const;
143 
144 
145  /// Returns this node's id, it matches the TOP node id
146  inline PDG_NodeID getId() const
147  { return myId; }
148 
149  /// Returns the node's unique name
150  const UT_StringHolder& name() const
151  { return myName; }
152 
153  /// Renames the node. No uniqueness validation is done on the new name -
154  /// a unique name should be acquired from the graph.
155  void rename(const UT_StringHolder& new_name);
156 
157  /// Returns the performance event path for the node. Returns true if the
158  /// path already includes work item information.
159  bool performancePath(
161  const UT_StringHolder& event_name,
162  const PDG_WorkItem* work_item) const;
163 
164 
165  /// Returns the node's type object
166  const PDG_NodeCallbackType* typeObject() const;
167 
168  /// Returns the node type, e.g. processor, mapper, etc
169  PDG_NodeType nodeType() const;
170 
171  /// Returns the sub type, e.g. normal, foreach begin, foreach end, etd
172  PDG_NodeSubtype nodeSubtype() const;
173 
174  /// Returns the current state of the node
175  PDG_NodeState nodeState() const;
176 
177  /// Returns the current cook progress of the node
178  fpreal nodeProgress() const;
179 
180  /// Returns the node's info object, which contains cook count and
181  /// description information.
182  const PDG_NodeOptions& nodeOptions(bool do_update);
183 
184  /// Returns the node's sort options struct
186  { return mySortOptions; }
187 
188  /// Returns the node's stat object
189  const PDG_NodeStats& stats() const
190  { return myNodeStats; }
192  { return myNodeStats; }
193 
194  /// Gets/sets the node callback - the underlying object used to implement
195  /// most of the node functionality. Can be a user defined C++ or Python
196  /// instance.
197  inline PDG_NodeCallback* callback() const
198  { return myCallback.get(); }
199  inline void setCallback(PDG_NodeCallbackPtr callback)
200  { myCallback = callback; }
201 
202  /// Gets/sets the per-node scheduler override
203  PDG_Scheduler* scheduler() const;
204  void setScheduler(PDG_Scheduler* scheduler);
205 
206  /// Gets/sets schedulers referenced by this node, but not used by it
207  /// directly.
209  { return mySchedulerReferences; }
211  { mySchedulerReferences.insert(scheduler); }
213  { mySchedulerReferences.clear(); }
214 
215  /// Returns the graph context that owns the node
216  inline PDG_GraphContext* context() const
217  { return myContext; }
218 
219  /// Returns the loop dpeth of the node
220  inline int loopDepth() const
221  { return myLoopDepth; }
222 
223  /// Returns the loop block's service reset conditoon
225  { return myLoopResetWhen; }
226 
227  /// Returns the loop block's service reset type
229  { return myLoopResetType; }
230 
231  /// Returns true if the node is an error handler
232  inline bool isErrorHandler() const
233  { return myIsErrorHandler; }
234 
235  /// Returns true if the node is in an error handler branch
236  inline bool isErrorHandlerBranch() const
237  { return myIsErrorHandlerBranch; }
238 
239  /// Sets the error handler flag on this node
241  {
242  myIsErrorHandler = error_handler;
243  myIsErrorHandlerBranch = error_handler;
244  }
245 
246  /// Sets the error handler branch flag on this node
248  { myIsErrorHandlerBranch = error_handler; }
249 
250  /// Clears and checks the error flag
251  inline bool hasErrors() const
252  { return myHasError; }
253 
254 
255  /// Returns true if this node is generating. This occurs when the atomic
256  /// generation counter is > 0
257  inline bool isGenerating() const
258  { return myActiveGenerates.relaxedLoad() > 0; }
259 
260  /// Returns true if this node is dynamic for the current evaluation, e.g.
261  /// if it should have the dynamic badge set in the UI. This means either
262  /// this node or an upstream input is dynamic in some way.
263  inline bool isDynamicEval() const
264  { return myIsDynamicEval; }
265 
266  /// Returns true if this node itself is strictly dynamic, i.e. the work item
267  /// generation requires input items to be cooked
268  inline bool isDynamicGeneration() const
269  { return myIsDynamicGen; }
270 
271  /// Returns true if this node should propagate the dynamic generation
272  /// state to downstream processors
273  inline bool isDynamicProp() const
274  { return myIsDynamicProp; }
275 
276  /// Returns true if this node can possibly create work items, based on
277  /// its input configuration
278  inline bool canHaveWorkItems() const
279  { return myCanHaveWorkItems; }
280 
281  /// Returns the name of the service that this node should use to cook
282  /// work items. Returns empty string if no service has been specified
283  /// in the node configuration
285  { return myServiceName; }
286 
287  /// Returns true if the node is inheriting it's service from a parent
288  /// service block.
289  bool useServiceBlock() const
290  { return myUseServiceBlock; }
291 
292  /// Returns true if this node should run its automatic regeneration logic
293  /// on the next cook. If this node has a callback with a custom
294  /// onRegenerate implementation, that will always be run regardless of
295  /// this flag
297  { return myRegenerateReason; }
298 
299  /// Sets the regenerate flag, to be called when the node should consider
300  /// running automatic regeneration logic during the cook
302  { myRegenerateReason = reason; }
303 
304  /// Updates the regenerate flag, but only to mode that's higher in value
305  /// then the current one
307  {
308  if (reason > myRegenerateReason)
309  myRegenerateReason = reason;
310  }
311 
312  /// Sets the bypassed flag on this node
313  inline void setBypassState(BypassState state)
314  { myBypassState = state; }
315 
316  /// Updates the bypass flag of this node, if the new state is higher
317  inline bool updateBypassState(BypassState state)
318  {
319  if (state > myBypassState)
320  {
321  myBypassState = state;
322  return true;
323  }
324 
325  return false;
326  }
327 
328  // Returns the node's bypassed state
329  inline BypassState bypassState() const
330  { return myBypassState; }
331 
332  /// Returns true if the node is bypassed
333  inline bool isBypassed() const
334  { return (myBypassState != eBypassNone); }
335 
336  /// Returns true if the node is a leaf, i.e it has no descendant nodes
337  bool isLeaf() const;
338 
339  /// Returns true if the node is cooked, i.e. all wrappers and static items
340  /// are cooked.
341  bool isCooked() const;
342 
343  /// Dirties the node by deleting all static and dynamic work items, and
344  /// dirtying (but not deleting) wrappers
345  void dirty(bool remove_outputs);
346 
347  /// Prepares a dirty operation that can be applied later
348  PDG_WorkItemDirty prepareDirty();
349 
350 
351  /// Freezes all work items in the node and their associated attribute
352  /// data.
353  void freeze();
354 
355  /// Sets the work items in the node from the input list and freezes them
356  void freezeFrom(const PDG_WorkItemArray& work_items);
357 
358  /// Cooks the node. This is a utility method that calls the standard
359  /// cook logic on the the graph context
360  bool cook(bool blocking, UT_WorkBuffer& errors);
361 
362  /// Cancels any work items scheduled by this node
363  void cancel();
364 
365  /// Inserts a work item into the node after it has been deserialized. Based
366  /// on the type of the item, it will be added to the various structures
367  /// (wrapper list, partition maps, etc).
368  virtual bool deserializeWorkItem(PDG_WorkItem* work_item);
369 
370  /// Called after a work item is completely deserialized.
371  virtual void commitWorkItem(PDG_WorkItem* work_item);
372 
373  /// Returns the cache state of a work item in this node
374  virtual PDG_WorkItemCacheState
375  outputCacheState(
376  const PDG_WorkItem* work_item) const;
377 
378  /// Notifies the node that the specified work item has started cooking
379  void startWorkItem(PDG_WorkItem* work_item);
380 
381  /// Reserves a number of work item indices in a contiguous block, and
382  /// returns the first index value.
383  int reserveIndexBlock(int number);
384 
385 
386  /// Returns the node interface/template that describes the default
387  /// parameters and connections for the node
388  const PDG_NodeInterface* templateInterface() const override;
389 
390  /// Adds a custom/spare parameter to the node and returns a pointer to the
391  /// the parameter port.
392  PDG_Port* addCustomParameter(PDGT_Value::DataType type,
393  const UT_StringHolder& name,
394  const UT_StringHolder& label,
395  const UT_StringArray& tags,
396  int size);
397 
398  /// Returns node connectivity information
399  int connectionCount(
401  bool filter_bypassed=true,
402  bool filter_reference=true) const;
403  void connectedNodes(
404  PDG_NodeArray& nodes,
406  bool filter_bypassed=true,
407  bool filter_reference=true) const;
408  PDG_Node* firstConnectedNode(
410  bool filter_bypassed=true,
411  bool filter_reference=true) const;
412  void connectedAncestors(
413  PDG_NodeSet& nodes,
415  bool filter_bypassed=true,
416  bool filter_reference=true);
417 
418  /// Emits a node level error from the node as PDG_Event
419  void addError(
420  const UT_StringHolder& message)
421  const override;
422 
423  /// Emits a node level warning from the node as PDG_Event
424  void addWarning(
425  const UT_StringHolder& message)
426  const override;
427 
428  /// Handler for external dependencies, e.g. files. External dependencies
429  /// that are added to the node will be resolved just before a work item in
430  /// the node is cooked.
432  dependencies() const;
433  void addDependency(PDG_Dependency* dependency);
434  void removeDependency(PDG_Dependency* dependency);
435  void resolveDependencies();
436 
437 
438  /// Returns the underyling work item array. This method is not safe to call
439  /// from external code if a cook or dirty is in progress.
441  { return myWorkItems; }
442 
443  /// Returns the IDs of the work items in the node
444  void workItemIDs(
445  PDG_WorkItemIDArray& array,
446  bool include_batches) const;
447 
448  /// Returns a safe copy of the work item array
449  void workItemsCopy(
450  PDG_WorkItemArray& array,
451  bool include_batches) const;
452 
453  /// Returns a safe copy of the work item array with a filter. The filter
454  /// function is called for each work item, and can return false to indicate
455  /// that the work item shouldn't be included in the copied list
456  template <typename Filter>
458  PDG_WorkItemArray& array,
459  const Filter& filter) const
460  {
462  myWorkItemLock);
463  for (auto&& work_item : myWorkItems)
464  {
465  if (work_item && filter(work_item))
466  array.append(work_item);
467  }
468  }
469 
470  /// Returns a safe copy of the batch work item set
471  void batchItemsCopy(PDG_BatchWorkItemSet& set) const;
472 
473  /// Removes a list of work item from the node
474  void removeWorkItems(
475  const PDG_WorkItemConstArray& work_items);
476 
477  /// Aggregates output files from all work items. Safe to call from multiple
478  /// threads or during a cook, and will return false/empty result if the
479  /// serial lock cannot be acquired
480  bool outputFiles(PDG_File::Array& files,
481  bool localize) const;
482 
483  /// Builds evaluation dependencies to cook a specific set of work items
484  void queueWorkItemDeps(
485  PDGE_Evaluator& evaluator,
486  PDG_NodeSet& visited_nodes,
487  PDG_WorkItemIDSet& visited_items,
488  PDG_Filter& filter);
489 
490  /// Runs precook logic for this node and recurses into input nodes.
491  bool preCook(PDG_NodeSet& dirty,
492  PDG_NodeSet& visited,
493  bool& save_scene,
494  bool has_filter);
495 
496 
497  /// Sets the loop depth and loop block reference on the node
498  int preCookLoop();
499 
500 
501  /// Runs postcook logic for this node and recurses into input nodes.
502  void postCook(PDG_NodeSet& visited);
503 
504  /// Adds or updates an existing file cache entry with the specified cache
505  /// id. This will create an entry if one does not yet exist.
506  PDG_CacheID addOutputCacheEntry(const UT_StringHolder& file,
507  PDG_CacheID cache_id);
508 
509  /// Adds or updates the dependent file attribute cache, and returns a new
510  /// cache ID for the work itme based on the entry.
511  PDG_CacheID addModTimeCacheEntry(
512  const PDG_File& file,
513  const PDG_WorkItem* work_item);
514 
515  /// Serializes the work items in the node to the specified stream
516  bool saveJSON(std::ostream &os, bool binary);
517 
518  /// Serializes the work items in the node to the specified file
519  bool saveJSON(const UT_StringHolder& file_path);
520 
521  /// Writes the current parameter value configuration of this node
522  /// interface to JSON
523  bool asJSON(
524  UT_JSONWriter& writer,
525  bool skip_defaults) const;
526 
527  /// Reads and constructs a scheduler from JSON and returns the instance
528  static bool fromJSON(
529  const UT_JSONValue* value,
530  PDG_GraphContext* context,
531  PDG_NodePortMap& inputs,
532  UT_WorkBuffer& errors);
533 
534  /// Queues node dependencies for cooking with the evaluator
535  static void queueNodeDeps(PDGE_Evaluator& evaluator,
536  const PDG_NodeSet& leaf_nodes,
537  const PDG_NodeSet& error_handlers,
538  bool generate_only,
539  bool cook);
540 
541 protected:
542  /// Tracks generation state of the node over a particular scope, using
543  /// a counter since a node can be generating in multiple threads at a
544  /// time.
546  {
547  public:
548  ScopedGenerate(PDG_Node* node);
549  ~ScopedGenerate();
551  inline bool isFirstGenerate() const { return myIsFirstGenerate; }
552 
553  private:
554  PDG_Node* myNode;
555  fpreal myStartTime;
556  bool myIsFirstGenerate;
557  };
558 
559  /// Helper struct for validating and dirtying incomplete loop blocks. Each
560  /// node in a loop is passed a vector of infos for any loops that pass
561  /// through that node, which is usd to set the maximal loop depth and begin
562  /// block list for each node in a block.
563  struct LoopInfo
564  {
570  };
571 
572  /// Helper struct for tracking out of date files in file attributes with
573  /// the `transfer` flag set.
575  {
579  };
580 
581  /// Enumerations of cook conditions
582  enum CookWhen
583  {
584  /// Never queue work items in this node for cooking
586 
587  /// Queue work items in this node once the isGenerated dep reolves --
588  /// these items will cook eventually, but may wait for targeted
589  /// partitioners first.
591 
592  /// Queue work items for cooking immediately after they've been
593  /// generated.
595  };
596 
597  /// Enumeration of targeting conditions
599  {
600  /// No partitioner targets this node
601  eTargetedNone = 0x0,
602 
603  /// A partitioner set to generate when all items in this node are
604  /// generated
605  eTargetedAll = 0x1,
606 
607  /// A partitioner set to generate each time items in this node are
608  /// generated
609  eTargetedEach = 0x2,
610  };
611 
612 protected:
613  friend class PDG_BatchWorkItem;
614  friend class PDG_Mapper;
615  friend class PDG_Processor;
616  friend class PDG_Partitioner;
617  friend class PDG_WorkItem;
618  friend class PDG_WorkItemDirty;
619 
620  inline UT_RWLock& attributeLock() const
621  { return myAttributeLock; }
622 
624  { return &myCanGenerateDep; }
626  { return &myIsGeneratedDep; }
628  { return &myIsCookedDep; }
629 
631  { return &myPropagateGroup; }
632 
633  UT_StringHolder debugName() const override
634  { return name(); }
635 
636  void resetOwner() override;
637 
638  virtual int preCookLoop(
639  const UT_Array<LoopInfo>& begin_info);
640  virtual bool preCook(bool is_dirty, bool has_filter);
641  virtual void postCook();
642 
643  virtual void clearAllWorkItems();
644  virtual void clearWorkItem(const PDG_WorkItem* work_item);
645  virtual void addWorkItem(PDG_WorkItem* work_item);
646  virtual bool queueWorkItem(PDG_WorkItem* work_item)
647  { return false; }
648  virtual bool syncWorkItem(PDG_WorkItem* work_item,
649  const PDG_WorkItem* clone_target)
650  { return false; }
651  virtual bool cookWorkItem(
652  PDGE_Resolutions& resolutions,
653  PDG_WorkItem* work_item,
654  bool did_cook);
655 
657  { return PDG_WorkItemState::eUncooked; }
658 
659  virtual bool cacheBuiltinParms(PDG_NodeSet& dirty,
660  bool dynamic_inputs);
661  virtual void addInputDeps(PDG_Node* input_node);
662  virtual void addCommonDeps();
663 
664  virtual bool requiresCookedInputs(bool cook) const;
665 
666  virtual bool shouldSchedule(
667  const PDG_WorkItem* work_item) const
668  { return false; }
669 
670  void injectDynamicWorkItem(PDG_WorkItem* work_item);
671 
672  void addPropagateDependencies(
673  const PDG_WorkItemArray& work_items);
674  void addWorkItems(
675  const PDG_WorkItemArray& work_items,
676  const PDG_BatchWorkItemSet& batches,
678  bool sort_items);
679 
680  void queueWorkItemResolutions(
681  PDGE_Resolutions& resolutions,
682  PDG_WorkItem* work_item,
683  PDGE_Dependency* can_cook_dep);
684  void queueBatchWorkItemResolutions(
685  PDGE_Resolutions& resolutions,
686  PDG_BatchWorkItem* batch_item,
687  PDGE_Dependency* can_cook_dep);
688 
689  void needsNodeCook(
690  UT_ArrayMap<PDG_Node*, bool>& needs_cook,
691  bool generate_only,
692  bool cook);
693  void queueNodeDeps(
694  PDGE_Evaluator& evaluator,
695  const UT_ArrayMap<PDG_Node*, bool>& needs_cook,
696  const PDG_NodeSet& error_handlers,
697  PDG_NodeSet& visited,
698  bool generate_only,
699  bool cook);
700 
701  void updateInputRegeneration();
702 
703  void applyDirty(bool remove_outputs);
704  void prepareDirtyAll(
705  PDG_WorkItemDirty& dirty_state,
706  bool remove_outputs);
707 
708  bool compactItems(bool reset_index=false);
709 
710  bool upstreamItems(
711  PDG_WorkItemArray& work_items,
712  bool skip_failed=false) const;
713  bool downstreamItems(
714  PDG_WorkItemArray& work_items) const;
715 
716  void clearOutputCache();
717  void updateModTimeCache();
718 
719  template <typename FieldType, typename EvalType=FieldType>
721  PDG_NodeSet& dirty,
722  const UT_StringHolder& parm_name,
723  FieldType& field,
724  const FieldType& default_value,
725  bool set_dirty = true)
726  {
727  FieldType field_value = default_value;
728  PDGT_Value* port_value =
729  paramValue(parm_name);
730 
731  if (port_value)
732  {
733  EvalType eval_value;
734  port_value->value(eval_value);
735  field_value =
736  (FieldType)(eval_value);
737  }
738 
739  if (field == field_value)
740  return;
741  field = field_value;
742 
743  if (set_dirty && myHasCachedParms)
744  dirty.insert(this);
745  }
746 
747 protected:
751 
756 
759 
763 
768 
770 
773 
775 
778 
780 
784 
788 
791 
794 
797 
802 
807 
809  mutable bool myHasError;
812 
815 
820 
822 };
823 
824 #endif /* __PDG_NODE_H__ */
static const UT_StringHolder theNameKey
The key for the node name when writing the node to JSON.
Definition: PDG_Node.h:106
bool isBypassed() const
Returns true if the node is bypassed.
Definition: PDG_Node.h:333
const UT_StringHolder & serviceName() const
Definition: PDG_Node.h:284
SYS_AtomicCounter myActiveGenerates
Definition: PDG_Node.h:792
PDG_ServiceResetType myLoopResetType
Definition: PDG_Node.h:567
PDG_SortOptions mySortOptions
Definition: PDG_Node.h:750
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
PDGE_Dependency * isCookedDep()
Definition: PDG_Node.h:627
bool myHasCachedParms
Definition: PDG_Node.h:810
virtual bool queueWorkItem(PDG_WorkItem *work_item)
Definition: PDG_Node.h:646
bool myIsAllGeneration
Definition: PDG_Node.h:806
PDGE_Dependency myIsCookedDep
Definition: PDG_Node.h:754
PDGE_Dependency myIsGeneratedDep
Definition: PDG_Node.h:753
bool myIsErrorHandler
Definition: PDG_Node.h:813
std::pair< iterator, bool > insert(const value_type &value)
Definition: UT_ArraySet.h:964
RegenerateReason
Regeneration reasons.
Definition: PDG_Node.h:69
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
bool myHasError
Definition: PDG_Node.h:809
RegenerateReason regenerateReason() const
Definition: PDG_Node.h:296
PDG_ServiceResetWhen myLoopResetWhen
Definition: PDG_Node.h:566
UT_Array< PDG_Dependency * > myDependencies
Definition: PDG_Node.h:762
PDG_ServiceResetType
UT_TBBSpinLock myModTimeCacheLock
Definition: PDG_Node.h:801
UT_TBBSpinLock myOutputCacheLock
Definition: PDG_Node.h:800
The node is not bypassed.
Definition: PDG_Node.h:96
PDG_File::Hash myLastStat
Definition: PDG_Node.h:577
PDG_ServiceResetWhen loopResetWhen() const
Returns the loop block's service reset conditoon.
Definition: PDG_Node.h:224
bool myIsGenerated
Definition: PDG_Node.h:816
bool useServiceBlock() const
Definition: PDG_Node.h:289
void setIsErrorHandlerBranch(bool error_handler)
Sets the error handler branch flag on this node.
Definition: PDG_Node.h:247
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
#define PDG_API
Definition: PDG_API.h:23
TargetedBy
Enumeration of targeting conditions.
Definition: PDG_Node.h:598
State
Evaluation context state.
The item is uncooked and no cooked has been attempted yet.
bool canHaveWorkItems() const
Definition: PDG_Node.h:278
int myLoopDepth
Definition: PDG_Node.h:782
void addSchedulerReference(PDG_Scheduler *scheduler)
Definition: PDG_Node.h:210
void workItemsCopy(PDG_WorkItemArray &array, const Filter &filter) const
Definition: PDG_Node.h:457
bool myIsCooked
Definition: PDG_Node.h:818
PDG_GraphContext * context() const
Returns the graph context that owns the node.
Definition: PDG_Node.h:216
void setBypassState(BypassState state)
Sets the bypassed flag on this node.
Definition: PDG_Node.h:313
bool isGenerating() const
Definition: PDG_Node.h:257
const UT_StringHolder & name() const
Returns the node's unique name.
Definition: PDG_Node.h:150
const PDG_SchedulerSet & schedulerReferences() const
Definition: PDG_Node.h:208
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
bool isErrorHandlerBranch() const
Returns true if the node is in an error handler branch.
Definition: PDG_Node.h:236
UT_StringHolder debugName() const override
Definition: PDG_Node.h:633
PDG_NodeOptions myNodeOptions
Definition: PDG_Node.h:748
Definition: PDG_Node.h:574
virtual void addWarning(const UT_StringHolder &message) const
Adds a warning to the node interface – implemented in subclasses.
PDG_SchedulerSet mySchedulerReferences
Definition: PDG_Node.h:777
bool myIsActive
Definition: PDG_Node.h:817
UT_StringHolder myServiceName
Definition: PDG_Node.h:779
UT_StringMap< ModTimeCacheEntry > myModTimeCache
Definition: PDG_Node.h:767
bool myHasNoGenerate
Definition: PDG_Node.h:808
PDG_WorkItemArray myWorkItems
Definition: PDG_Node.h:757
int myInputFilter
Definition: PDG_Node.h:783
UT_StringHolder myName
Definition: PDG_Node.h:769
PDGE_PropagateGroup * propagateGroup()
Definition: PDG_Node.h:630
bool updateBypassState(BypassState state)
Updates the bypass flag of this node, if the new state is higher.
Definition: PDG_Node.h:317
bool myIsDynamicEval
Definition: PDG_Node.h:804
PDG_NodeSet myStaticAncestors
Definition: PDG_Node.h:760
bool isDynamicEval() const
Definition: PDG_Node.h:263
PDG_NodeCallbackPtr myCallback
Definition: PDG_Node.h:771
PDG_NodeStats myNodeStats
Definition: PDG_Node.h:749
void clearSchedulerReferences()
Definition: PDG_Node.h:212
PDG_NodeType
Enumeration of node types in a PDG graph.
Definition: PDG_NodeTypes.h:95
PDG_NodeID myId
Definition: PDG_Node.h:795
int loopDepth() const
Returns the loop dpeth of the node.
Definition: PDG_Node.h:220
void updateBuiltinField(PDG_NodeSet &dirty, const UT_StringHolder &parm_name, FieldType &field, const FieldType &default_value, bool set_dirty=true)
Definition: PDG_Node.h:720
const PDG_SortOptions & sortOptions() const
Returns the node's sort options struct.
Definition: PDG_Node.h:185
const PDG_NodeStats & stats() const
Returns the node's stat object.
Definition: PDG_Node.h:189
UT_SharedPtr< PDG_NodeCallback > PDG_NodeCallbackPtr
Definition: PDG_NodeTypes.h:26
PDG_NodeStats & stats()
Definition: PDG_Node.h:191
int myTargetedBy
Definition: PDG_Node.h:781
const PDG_Node * myBeginNode
Definition: PDG_Node.h:568
PDG_NodeArray myExtraInputs
Definition: PDG_Node.h:761
bool isDynamicGeneration() const
Definition: PDG_Node.h:268
int64 Hash
The file hash/modtime type.
Definition: PDG_File.h:39
RegenerateReason myRegenerateReason
Definition: PDG_Node.h:786
Definition: core.h:760
bool myIsDynamicProp
Definition: PDG_Node.h:805
bool isDynamicProp() const
Definition: PDG_Node.h:273
UT_RWLock & attributeLock() const
Definition: PDG_Node.h:620
PDG_NodeID getId() const
Returns this node's id, it matches the TOP node id.
Definition: PDG_Node.h:146
void value(fpreal &value) const
void setIsErrorHandler(bool error_handler)
Sets the error handler flag on this node.
Definition: PDG_Node.h:240
PDG_WorkItemState
Enum of possible work item states.
static const UT_StringHolder theParametersKey
The key for the parameters when writing the node to JSON.
Definition: PDG_Node.h:118
static const UT_StringHolder theSchedulerKey
The key for the scheduler name when writing the node to JSON.
Definition: PDG_Node.h:112
PDG_File myFile
Definition: PDG_Node.h:576
UT_StringHolder myServiceName
Definition: PDG_Node.h:565
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
PDG_ServiceResetWhen
When service clients should be reset.
virtual void addError(const UT_StringHolder &message) const
Adds an error to the node interface – implemented in subclasses.
virtual PDG_WorkItemState updateOutputCache(PDG_WorkItem *work_item) const
Definition: PDG_Node.h:656
long long int64
Definition: SYS_Types.h:116
PDG_NodeState
Node state, used for UI/progress reporting.
Definition: PDG_NodeTypes.h:68
void applyDirty(bool remove_outputs)
Applies the stored dirty operation.
bool myCanHaveWorkItems
Definition: PDG_Node.h:811
virtual int64 getMemoryUsage(bool inclusive) const
Returns the memory usage of this owner instance.
bool myIsFrozen
Definition: PDG_Node.h:819
The node is in a bypassed subnetwork.
Definition: PDG_Node.h:99
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual const PDG_NodeInterface * templateInterface() const
The node will be dirtied and caches invalidated.
Definition: PDG_Node.h:89
The node will be dirtied.
Definition: PDG_Node.h:86
SYS_AtomicCounter myTotalGenerates
Definition: PDG_Node.h:793
static const UT_StringHolder theInputsKey
The key for the input nodes when writing the node to JSON.
Definition: PDG_Node.h:115
PDG_BatchWorkItemSet myBatchItems
Definition: PDG_Node.h:758
exint append()
Definition: UT_Array.h:142
bool myUseServiceBlock
Definition: PDG_Node.h:821
Never queue work items in this node for cooking.
Definition: PDG_Node.h:585
virtual bool syncWorkItem(PDG_WorkItem *work_item, const PDG_WorkItem *clone_target)
Definition: PDG_Node.h:648
BypassState
Bypass state for the node.
Definition: PDG_Node.h:93
PDG_WorkItemCacheState
PDG_GraphContext * myContext
Definition: PDG_Node.h:774
bool myIsErrorHandlerBranch
Definition: PDG_Node.h:814
GLsizeiptr size
Definition: glcorearb.h:664
BypassState bypassState() const
Definition: PDG_Node.h:329
virtual bool shouldSchedule(const PDG_WorkItem *work_item) const
Definition: PDG_Node.h:666
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
PDGE_Dependency * isGeneratedDep()
Definition: PDG_Node.h:625
bool hasErrors() const
Clears and checks the error flag.
Definition: PDG_Node.h:251
The node should regenerate work items.
Definition: PDG_Node.h:79
fpreal64 fpreal
Definition: SYS_Types.h:277
PDGE_PropagateGroup myPropagateGroup
Definition: PDG_Node.h:755
int PDG_NodeID
Node ID type.
Definition: PDG_NodeTypes.h:29
int myMaxIndex
Definition: PDG_Node.h:796
void setCallback(PDG_NodeCallbackPtr callback)
Definition: PDG_Node.h:199
UT_TBBSpinLock myWorkItemLock
Definition: PDG_Node.h:799
bool myIsDynamicGen
Definition: PDG_Node.h:803
UT_RWLock myAttributeLock
Definition: PDG_Node.h:798
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:99
const PDG_WorkItemArray & workItems() const
Definition: PDG_Node.h:440
Definition: core.h:1131
PDG_NodeSubtype
Enumeration of node subtypes.
void updateRegenerateReason(RegenerateReason reason)
Definition: PDG_Node.h:306
PDG_ServiceResetType myLoopResetType
Definition: PDG_Node.h:790
PDGE_Dependency myCanGenerateDep
Definition: PDG_Node.h:752
PDG_ServiceResetType loopResetType() const
Returns the loop block's service reset type.
Definition: PDG_Node.h:228
PDG_CacheID myCacheId
Definition: PDG_Node.h:578
PDG_ServiceResetWhen myLoopResetWhen
Definition: PDG_Node.h:789
bool isErrorHandler() const
Returns true if the node is an error handler.
Definition: PDG_Node.h:232
const PDG_NodeCallbackType * myTypeObject
Definition: PDG_Node.h:772
No regeneration necessary.
Definition: PDG_Node.h:72
Reader/Writer mutex class.
Definition: UT_RWLock.h:48
void setRegenerateReason(RegenerateReason reason)
Definition: PDG_Node.h:301
PDGE_Dependency * canGenerateDep()
Definition: PDG_Node.h:623
type
Definition: core.h:1059
CookWhen
Enumerations of cook conditions.
Definition: PDG_Node.h:582
PDG_Scheduler * myScheduler
Definition: PDG_Node.h:776
BypassState myBypassState
Definition: PDG_Node.h:787
static const UT_StringHolder theTypeKey
The key for the node type when writing the node to JSON.
Definition: PDG_Node.h:109
UT_ArrayStringMap< PDG_CacheID > myOutputCache
Definition: PDG_Node.h:765
CookWhen myCookWhen
Definition: PDG_Node.h:785
PDG_PortType
Enumeration of node port types.
virtual const PDG_EventFilter & supportedEventTypes() const =0
Returns the list of supported event types for this emitter.
int PDG_CacheID
Definition: PDG_NodeTypes.h:30
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297
PDG_NodeCallback * callback() const
Definition: PDG_Node.h:197