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  void removeScheduler(PDG_Scheduler* scheduler);
206 
207  /// Gets/sets schedulers referenced by this node, but not used by it
208  /// directly.
210  { return mySchedulerReferences; }
212  { mySchedulerReferences.insert(scheduler); }
214  { mySchedulerReferences.clear(); }
215 
216  /// Returns the graph context that owns the node
217  inline PDG_GraphContext* context() const
218  { return myContext; }
219 
220  /// Returns the loop dpeth of the node
221  inline int loopDepth() const
222  { return myLoopDepth; }
223 
224  /// Returns the loop block's service reset conditoon
226  { return myLoopResetWhen; }
227 
228  /// Returns the loop block's service reset type
230  { return myLoopResetType; }
231 
232  /// Returns true if the node is an error handler
233  inline bool isErrorHandler() const
234  { return myIsErrorHandler; }
235 
236  /// Returns true if the node is in an error handler branch
237  inline bool isErrorHandlerBranch() const
238  { return myIsErrorHandlerBranch; }
239 
240  /// Sets the error handler flag on this node
241  inline void setIsErrorHandler(bool error_handler)
242  {
243  myIsErrorHandler = error_handler;
244  myIsErrorHandlerBranch = error_handler;
245  }
246 
247  /// Sets the error handler branch flag on this node
248  inline void setIsErrorHandlerBranch(bool error_handler)
249  { myIsErrorHandlerBranch = error_handler; }
250 
251  /// Clears and checks the error flag
252  inline bool hasErrors() const
253  { return myHasError; }
254 
255 
256  /// Returns true if this node is generating. This occurs when the atomic
257  /// generation counter is > 0
258  inline bool isGenerating() const
259  { return myActiveGenerates.relaxedLoad() > 0; }
260 
261  /// Returns true if this node is dynamic for the current evaluation, e.g.
262  /// if it should have the dynamic badge set in the UI. This means either
263  /// this node or an upstream input is dynamic in some way.
264  inline bool isDynamicEval() const
265  { return myIsDynamicEval; }
266 
267  /// Returns true if this node itself is strictly dynamic, i.e. the work item
268  /// generation requires input items to be cooked
269  inline bool isDynamicGeneration() const
270  { return myIsDynamicGen; }
271 
272  /// Returns true if this node should propagate the dynamic generation
273  /// state to downstream processors
274  inline bool isDynamicProp() const
275  { return myIsDynamicProp; }
276 
277  /// Returns true if this node can possibly create work items, based on
278  /// its input configuration
279  inline bool canHaveWorkItems() const
280  { return myCanHaveWorkItems; }
281 
282  /// Returns the name of the service that this node should use to cook
283  /// work items. Returns empty string if no service has been specified
284  /// in the node configuration
286  { return myServiceName; }
287 
288  /// Returns true if the node is inheriting it's service from a parent
289  /// service block.
290  bool useServiceBlock() const
291  { return myUseServiceBlock; }
292 
293  /// Returns true if this node should run its automatic regeneration logic
294  /// on the next cook. If this node has a callback with a custom
295  /// onRegenerate implementation, that will always be run regardless of
296  /// this flag
298  { return myRegenerateReason; }
299 
300  /// Sets the regenerate flag, to be called when the node should consider
301  /// running automatic regeneration logic during the cook
303  { myRegenerateReason = reason; }
304 
305  /// Updates the regenerate flag, but only to mode that's higher in value
306  /// then the current one
308  {
309  if (reason > myRegenerateReason)
310  myRegenerateReason = reason;
311  }
312 
313  /// Sets the bypassed flag on this node
315  { myBypassState = state; }
316 
317  /// Updates the bypass flag of this node, if the new state is higher
319  {
320  if (state > myBypassState)
321  {
322  myBypassState = state;
323  return true;
324  }
325 
326  return false;
327  }
328 
329  // Returns the node's bypassed state
330  inline BypassState bypassState() const
331  { return myBypassState; }
332 
333  /// Returns true if the node is bypassed
334  inline bool isBypassed() const
335  { return (myBypassState != eBypassNone); }
336 
337  /// Returns true if the node is a leaf, i.e it has no descendant nodes
338  bool isLeaf() const;
339 
340  /// Returns true if the node is cooked, i.e. all wrappers and static items
341  /// are cooked.
342  bool isCooked() const;
343 
344 
345  /// Dirties the node by deleting all static and dynamic work items, and
346  /// dirtying (but not deleting) wrappers
347  void dirty(bool remove_outputs);
348 
349  /// Prepares a dirty operation that can be applied later
350  PDG_WorkItemDirty prepareDirty();
351 
352  /// Appends to an existing dirty operation
353  void appendDirty(PDG_WorkItemDirty* dirty_state);
354 
355 
356  /// Freezes all work items in the node and their associated attribute
357  /// data.
358  void freeze();
359 
360  /// Sets the work items in the node from the input list and freezes them
361  void freezeFrom(const PDG_WorkItemArray& work_items);
362 
363  /// Cooks the node. This is a utility method that calls the standard
364  /// cook logic on the the graph context
365  bool cook(bool blocking, UT_WorkBuffer& errors);
366 
367  /// Cancels any work items scheduled by this node
368  void cancel();
369 
370  /// Inserts a work item into the node after it has been deserialized. Based
371  /// on the type of the item, it will be added to the various structures
372  /// (wrapper list, partition maps, etc).
373  virtual bool deserializeWorkItem(PDG_WorkItem* work_item);
374 
375  /// Called after a work item is completely deserialized.
376  virtual void commitWorkItem(PDG_WorkItem* work_item);
377 
378  /// Returns the cache state of a work item in this node
379  virtual PDG_WorkItemCacheState
380  outputCacheState(
381  const PDG_WorkItem* work_item) const;
382 
383  /// Notifies the node that the specified work item has started cooking
384  void startWorkItem(PDG_WorkItem* work_item);
385 
386  /// Reserves a number of work item indices in a contiguous block, and
387  /// returns the first index value.
388  int reserveIndexBlock(int number);
389 
390 
391  /// Returns the node interface/template that describes the default
392  /// parameters and connections for the node
393  const PDG_NodeInterface* templateInterface() const override;
394 
395  /// Adds a custom/spare parameter to the node and returns a pointer to the
396  /// the parameter port.
397  PDG_Port* addCustomParameter(PDGT_Value::DataType type,
398  const UT_StringHolder& name,
399  const UT_StringHolder& label,
400  const UT_StringArray& tags,
401  int size);
402 
403  /// Returns node connectivity information
404  int connectionCount(
406  bool filter_bypassed=true,
407  bool filter_reference=true) const;
408  void connectedNodes(
409  PDG_NodeArray& nodes,
411  bool filter_bypassed=true,
412  bool filter_reference=true) const;
413  PDG_Node* firstConnectedNode(
415  bool filter_bypassed=true,
416  bool filter_reference=true) const;
417  void connectedAncestors(
418  PDG_NodeSet& nodes,
420  bool filter_bypassed=true,
421  bool filter_reference=true);
422 
423  /// Emits a node level error from the node as PDG_Event
424  void addError(
425  const UT_StringHolder& message)
426  const override;
427 
428  /// Emits a node level warning from the node as PDG_Event
429  void addWarning(
430  const UT_StringHolder& message)
431  const override;
432 
433  /// Handler for external dependencies, e.g. files. External dependencies
434  /// that are added to the node will be resolved just before a work item in
435  /// the node is cooked.
437  dependencies() const;
438  void addDependency(PDG_Dependency* dependency);
439  void removeDependency(PDG_Dependency* dependency);
440  void resolveDependencies();
441 
442 
443  /// Returns the underyling work item array. This method is not safe to call
444  /// from external code if a cook or dirty is in progress.
446  { return myWorkItems; }
447 
448  /// Returns the IDs of the work items in the node
449  void workItemIDs(
450  PDG_WorkItemIDArray& array,
451  bool include_batches) const;
452 
453  /// Returns a safe copy of the work item array
454  void workItemsCopy(
455  PDG_WorkItemArray& array,
456  bool include_batches) const;
457 
458  /// Returns a safe copy of the work item array with a filter. The filter
459  /// function is called for each work item, and can return false to indicate
460  /// that the work item shouldn't be included in the copied list
461  template <typename Filter>
463  PDG_WorkItemArray& array,
464  const Filter& filter) const
465  {
467  myWorkItemLock);
468  for (auto&& work_item : myWorkItems)
469  {
470  if (work_item && filter(work_item))
471  array.append(work_item);
472  }
473  }
474 
475  /// Returns a safe copy of the batch work item set
476  void batchItemsCopy(PDG_BatchWorkItemSet& set) const;
477 
478  /// Removes a list of work item from the node
479  void removeWorkItems(
480  const PDG_WorkItemConstArray& work_items);
481 
482  /// Aggregates output files from all work items. Safe to call from multiple
483  /// threads or during a cook, and will return false/empty result if the
484  /// serial lock cannot be acquired
485  bool outputFiles(PDG_File::Array& files,
486  bool localize) const;
487 
488  /// Builds evaluation dependencies to cook a specific set of work items
489  virtual void queueWorkItemDeps(
490  PDGE_Evaluator& evaluator,
491  PDG_NodeSet& visited_nodes,
492  PDG_WorkItemIDSet& visited_items,
493  PDG_Filter& filter);
494 
495  /// Runs precook logic for this node and recurses into input nodes.
496  bool preCook(PDG_NodeSet& dirty,
497  PDG_NodeSet& visited,
498  bool& save_scene,
499  bool has_filter);
500 
501 
502  /// Sets the loop depth and loop block reference on the node
503  int preCookLoop(PDG_NodeSet& visited);
504 
505 
506  /// Runs postcook logic for this node and recurses into input nodes.
507  void postCook(PDG_NodeSet& visited);
508 
509  /// Adds or updates an existing file cache entry with the specified cache
510  /// id. This will create an entry if one does not yet exist.
511  PDG_CacheID addOutputCacheEntry(const UT_StringHolder& file,
512  PDG_CacheID cache_id);
513 
514  /// Adds or updates the dependent file attribute cache, and returns a new
515  /// cache ID for the work itme based on the entry.
516  PDG_CacheID addModTimeCacheEntry(
517  const PDG_File& file,
518  const PDG_WorkItem* work_item);
519 
520  /// Serializes the work items in the node to the specified stream
521  bool saveJSON(std::ostream &os, bool binary);
522 
523  /// Serializes the work items in the node to the specified file
524  bool saveJSON(const UT_StringHolder& file_path);
525 
526  /// Writes the current parameter value configuration of this node
527  /// interface to JSON
528  bool asJSON(
529  UT_JSONWriter& writer,
530  bool skip_defaults) const;
531 
532  /// Reads and constructs a scheduler from JSON and returns the instance
533  static bool fromJSON(
534  const UT_JSONValue* value,
535  PDG_GraphContext* context,
536  PDG_NodePortMap& inputs,
537  UT_WorkBuffer& errors);
538 
539  /// Queues node dependencies for cooking with the evaluator
540  static void queueNodeDeps(PDGE_Evaluator& evaluator,
541  const PDG_NodeSet& leaf_nodes,
542  const PDG_NodeSet& error_handlers,
543  bool generate_only,
544  bool cook);
545 
546 protected:
547  /// Tracks generation state of the node over a particular scope, using
548  /// a counter since a node can be generating in multiple threads at a
549  /// time.
551  {
552  public:
553  ScopedGenerate(PDG_Node* node);
554  ~ScopedGenerate();
556  inline bool isFirstGenerate() const { return myIsFirstGenerate; }
557 
558  private:
559  PDG_Node* myNode;
560  fpreal myStartTime;
561  bool myIsFirstGenerate;
562  };
563 
564  /// Helper struct for validating and dirtying incomplete loop blocks. Each
565  /// node in a loop is passed a vector of infos for any loops that pass
566  /// through that node, which is usd to set the maximal loop depth and begin
567  /// block list for each node in a block.
568  struct LoopInfo
569  {
575  };
576 
577  /// Helper struct for tracking out of date files in file attributes with
578  /// the `transfer` flag set.
580  {
584  };
585 
586  /// Enumerations of cook conditions
587  enum CookWhen
588  {
589  /// Never queue work items in this node for cooking
591 
592  /// Queue work items in this node once the isGenerated dep reolves --
593  /// these items will cook eventually, but may wait for targeted
594  /// partitioners first.
596 
597  /// Queue work items for cooking immediately after they've been
598  /// generated.
600  };
601 
602  /// Enumeration of targeting conditions
604  {
605  /// No partitioner targets this node
606  eTargetedNone = 0x0,
607 
608  /// A partitioner set to generate when all items in this node are
609  /// generated
610  eTargetedAll = 0x1,
611 
612  /// A partitioner set to generate each time items in this node are
613  /// generated
614  eTargetedEach = 0x2,
615  };
616 
617 protected:
618  friend class PDG_BatchWorkItem;
619  friend class PDG_Mapper;
620  friend class PDG_Processor;
621  friend class PDG_Partitioner;
622  friend class PDG_WorkItem;
623  friend class PDG_WorkItemDirty;
624 
625  inline UT_RWLock& attributeLock() const
626  { return myAttributeLock; }
627 
629  { return &myCanGenerateDep; }
631  { return &myIsGeneratedDep; }
633  { return &myIsCookedDep; }
634 
636  { return &myPropagateGroup; }
637 
638  UT_StringHolder debugName() const override
639  { return name(); }
640 
641  void resetOwner() override;
642 
643  virtual int preCookLoop(
644  PDG_NodeSet& visited,
645  const UT_Array<LoopInfo>& begin_info);
646  virtual bool preCook(bool is_dirty, bool has_filter);
647  virtual void postCook();
648 
649  virtual void clearAllWorkItems();
650  virtual void clearWorkItem(const PDG_WorkItem* work_item);
651  virtual void addWorkItem(PDG_WorkItem* work_item);
652  virtual bool queueWorkItem(PDG_WorkItem* work_item)
653  { return false; }
654  virtual bool syncWorkItem(
655  PDG_WorkItem* work_item,
656  const PDG_WorkItem* parent,
657  const PDG_WorkItem* clone_target)
658  { return false; }
659  virtual bool cookWorkItem(
660  PDGE_Resolutions& resolutions,
661  PDG_WorkItem* work_item,
662  bool did_cook);
663 
665  { return PDG_WorkItemState::eUncooked; }
666 
667  virtual bool cacheBuiltinParms(
668  PDG_NodeSet& dirty,
669  int num_inputs,
670  bool dynamic_inputs);
671  virtual void addInputDeps(PDG_Node* input_node);
672  virtual void addCommonDeps();
673 
674  virtual bool requiresCookedInputs(bool cook) const;
675 
676  virtual bool shouldSchedule(
677  const PDG_WorkItem* work_item) const
678  { return false; }
679 
680  void injectDynamicWorkItem(PDG_WorkItem* work_item);
681 
682  void addPropagateDependencies(
683  const PDG_WorkItemArray& work_items);
684  void addWorkItems(
685  const PDG_WorkItemArray& work_items,
686  const PDG_BatchWorkItemSet& batches,
688  bool sort_items);
689 
690  void queueWorkItemResolutions(
691  PDGE_Resolutions& resolutions,
692  PDG_WorkItem* work_item,
693  PDGE_Dependency* can_cook_dep);
694  void queueBatchWorkItemResolutions(
695  PDGE_Resolutions& resolutions,
696  PDG_BatchWorkItem* batch_item,
697  PDGE_Dependency* can_cook_dep);
698 
699  void needsNodeCook(
700  UT_ArrayMap<PDG_Node*, bool>& needs_cook,
701  bool cook);
702  void queueNodeDeps(
703  PDGE_Evaluator& evaluator,
704  const UT_ArrayMap<PDG_Node*, bool>& needs_cook,
705  const PDG_NodeSet& error_handlers,
706  PDG_NodeSet& visited,
707  bool generate_only,
708  bool cook);
709 
710  void updateInputRegeneration();
711 
712  void applyDirty(bool remove_outputs);
713  void prepareDirtyAll(
714  PDG_WorkItemDirty& dirty_state,
715  bool remove_outputs);
716 
717  bool compactItems(bool reset_index=false);
718 
719  bool upstreamItems(
720  PDG_WorkItemArray& work_items,
721  bool skip_failed=false) const;
722  bool downstreamItems(
723  PDG_WorkItemArray& work_items) const;
724 
725  void clearOutputCache();
726  void updateModTimeCache();
727 
728  template <typename FieldType, typename EvalType=FieldType>
730  PDG_NodeSet& dirty,
731  const UT_StringHolder& parm_name,
732  FieldType& field,
733  const FieldType& default_value,
734  bool set_dirty = true)
735  {
736  FieldType field_value = default_value;
737  PDGT_Value* port_value =
738  paramValue(parm_name);
739 
740  if (port_value)
741  {
742  EvalType eval_value;
743  port_value->value(eval_value);
744  field_value =
745  (FieldType)(eval_value);
746  }
747 
748  if (field == field_value)
749  return;
750  field = field_value;
751 
752  if (set_dirty && myHasCachedParms)
753  dirty.insert(this);
754  }
755 
756 protected:
760 
765 
768 
772 
777 
779 
782 
784 
787 
789 
794 
798 
801 
804 
807 
812 
817 
819  mutable bool myHasError;
822 
825 
830 
832 };
833 
834 #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:334
const UT_StringHolder & serviceName() const
Definition: PDG_Node.h:285
SYS_AtomicCounter myActiveGenerates
Definition: PDG_Node.h:802
PDG_ServiceResetType myLoopResetType
Definition: PDG_Node.h:572
PDG_SortOptions mySortOptions
Definition: PDG_Node.h:759
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
PDGE_Dependency * isCookedDep()
Definition: PDG_Node.h:632
bool myHasCachedParms
Definition: PDG_Node.h:820
virtual bool queueWorkItem(PDG_WorkItem *work_item)
Definition: PDG_Node.h:652
bool myIsAllGeneration
Definition: PDG_Node.h:816
PDGE_Dependency myIsCookedDep
Definition: PDG_Node.h:763
PDGE_Dependency myIsGeneratedDep
Definition: PDG_Node.h:762
bool myIsErrorHandler
Definition: PDG_Node.h:823
std::pair< iterator, bool > insert(const value_type &value)
Definition: UT_ArraySet.h:1032
RegenerateReason
Regeneration reasons.
Definition: PDG_Node.h:69
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
bool myHasError
Definition: PDG_Node.h:819
RegenerateReason regenerateReason() const
Definition: PDG_Node.h:297
PDG_ServiceResetWhen myLoopResetWhen
Definition: PDG_Node.h:571
UT_Array< PDG_Dependency * > myDependencies
Definition: PDG_Node.h:771
PDG_ServiceResetType
virtual bool syncWorkItem(PDG_WorkItem *work_item, const PDG_WorkItem *parent, const PDG_WorkItem *clone_target)
Definition: PDG_Node.h:654
UT_TBBSpinLock myModTimeCacheLock
Definition: PDG_Node.h:811
UT_TBBSpinLock myOutputCacheLock
Definition: PDG_Node.h:810
The node is not bypassed.
Definition: PDG_Node.h:96
PDG_File::Hash myLastStat
Definition: PDG_Node.h:582
PDG_ServiceResetWhen loopResetWhen() const
Returns the loop block's service reset conditoon.
Definition: PDG_Node.h:225
bool myIsGenerated
Definition: PDG_Node.h:826
GLsizei const GLfloat * value
Definition: glcorearb.h:824
bool useServiceBlock() const
Definition: PDG_Node.h:290
void setIsErrorHandlerBranch(bool error_handler)
Sets the error handler branch flag on this node.
Definition: PDG_Node.h:248
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:603
State
Evaluation context state.
The item is uncooked and no cooked has been attempted yet.
bool canHaveWorkItems() const
Definition: PDG_Node.h:279
int myLoopDepth
Definition: PDG_Node.h:791
void addSchedulerReference(PDG_Scheduler *scheduler)
Definition: PDG_Node.h:211
void workItemsCopy(PDG_WorkItemArray &array, const Filter &filter) const
Definition: PDG_Node.h:462
bool myIsCooked
Definition: PDG_Node.h:828
PDG_GraphContext * context() const
Returns the graph context that owns the node.
Definition: PDG_Node.h:217
void setBypassState(BypassState state)
Sets the bypassed flag on this node.
Definition: PDG_Node.h:314
bool isGenerating() const
Definition: PDG_Node.h:258
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:209
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:237
UT_StringHolder debugName() const override
Definition: PDG_Node.h:638
PDG_NodeOptions myNodeOptions
Definition: PDG_Node.h:757
Definition: PDG_Node.h:579
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:786
bool myIsActive
Definition: PDG_Node.h:827
UT_StringHolder myServiceName
Definition: PDG_Node.h:788
UT_StringMap< ModTimeCacheEntry > myModTimeCache
Definition: PDG_Node.h:776
bool myHasNoGenerate
Definition: PDG_Node.h:818
GLuint buffer
Definition: glcorearb.h:660
PDG_WorkItemArray myWorkItems
Definition: PDG_Node.h:766
int myInputFilter
Definition: PDG_Node.h:793
UT_StringHolder myName
Definition: PDG_Node.h:778
PDGE_PropagateGroup * propagateGroup()
Definition: PDG_Node.h:635
bool updateBypassState(BypassState state)
Updates the bypass flag of this node, if the new state is higher.
Definition: PDG_Node.h:318
bool myIsDynamicEval
Definition: PDG_Node.h:814
PDG_NodeSet myStaticAncestors
Definition: PDG_Node.h:769
bool isDynamicEval() const
Definition: PDG_Node.h:264
PDG_NodeCallbackPtr myCallback
Definition: PDG_Node.h:780
PDG_NodeStats myNodeStats
Definition: PDG_Node.h:758
void clearSchedulerReferences()
Definition: PDG_Node.h:213
PDG_NodeType
Enumeration of node types in a PDG graph.
Definition: PDG_NodeTypes.h:95
PDG_NodeID myId
Definition: PDG_Node.h:805
int loopDepth() const
Returns the loop dpeth of the node.
Definition: PDG_Node.h:221
void updateBuiltinField(PDG_NodeSet &dirty, const UT_StringHolder &parm_name, FieldType &field, const FieldType &default_value, bool set_dirty=true)
Definition: PDG_Node.h:729
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:790
const PDG_Node * myBeginNode
Definition: PDG_Node.h:573
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
PDG_NodeArray myExtraInputs
Definition: PDG_Node.h:770
bool isDynamicGeneration() const
Definition: PDG_Node.h:269
int64 Hash
The file hash/modtime type.
Definition: PDG_File.h:39
RegenerateReason myRegenerateReason
Definition: PDG_Node.h:796
bool myIsDynamicProp
Definition: PDG_Node.h:815
bool isDynamicProp() const
Definition: PDG_Node.h:274
UT_RWLock & attributeLock() const
Definition: PDG_Node.h:625
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:241
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
constexpr auto set(type rhs) -> int
Definition: core.h:610
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:581
UT_StringHolder myServiceName
Definition: PDG_Node.h:570
#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:664
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:821
virtual int64 getMemoryUsage(bool inclusive) const
Returns the memory usage of this owner instance.
bool myIsFrozen
Definition: PDG_Node.h:829
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:803
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:767
exint append()
Definition: UT_Array.h:142
bool myUseServiceBlock
Definition: PDG_Node.h:831
Never queue work items in this node for cooking.
Definition: PDG_Node.h:590
BypassState
Bypass state for the node.
Definition: PDG_Node.h:93
PDG_WorkItemCacheState
PDG_GraphContext * myContext
Definition: PDG_Node.h:783
bool myIsErrorHandlerBranch
Definition: PDG_Node.h:824
GLsizeiptr size
Definition: glcorearb.h:664
BypassState bypassState() const
Definition: PDG_Node.h:330
virtual bool shouldSchedule(const PDG_WorkItem *work_item) const
Definition: PDG_Node.h:676
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
PDGE_Dependency * isGeneratedDep()
Definition: PDG_Node.h:630
bool hasErrors() const
Clears and checks the error flag.
Definition: PDG_Node.h:252
The node should regenerate work items.
Definition: PDG_Node.h:79
fpreal64 fpreal
Definition: SYS_Types.h:278
PDGE_PropagateGroup myPropagateGroup
Definition: PDG_Node.h:764
int PDG_NodeID
Node ID type.
Definition: PDG_NodeTypes.h:29
int myMaxIndex
Definition: PDG_Node.h:806
void setCallback(PDG_NodeCallbackPtr callback)
Definition: PDG_Node.h:199
UT_TBBSpinLock myWorkItemLock
Definition: PDG_Node.h:809
bool myIsDynamicGen
Definition: PDG_Node.h:813
UT_RWLock myAttributeLock
Definition: PDG_Node.h:808
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:99
const PDG_WorkItemArray & workItems() const
Definition: PDG_Node.h:445
PDG_NodeSubtype
Enumeration of node subtypes.
void updateRegenerateReason(RegenerateReason reason)
Definition: PDG_Node.h:307
PDG_ServiceResetType myLoopResetType
Definition: PDG_Node.h:800
PDGE_Dependency myCanGenerateDep
Definition: PDG_Node.h:761
PDG_ServiceResetType loopResetType() const
Returns the loop block's service reset type.
Definition: PDG_Node.h:229
PDG_CacheID myCacheId
Definition: PDG_Node.h:583
PDG_ServiceResetWhen myLoopResetWhen
Definition: PDG_Node.h:799
bool isErrorHandler() const
Returns true if the node is an error handler.
Definition: PDG_Node.h:233
const PDG_NodeCallbackType * myTypeObject
Definition: PDG_Node.h:781
No regeneration necessary.
Definition: PDG_Node.h:72
int myLoopBeginDepth
Definition: PDG_Node.h:792
Reader/Writer mutex class.
Definition: UT_RWLock.h:48
void setRegenerateReason(RegenerateReason reason)
Definition: PDG_Node.h:302
PDGE_Dependency * canGenerateDep()
Definition: PDG_Node.h:628
state
Definition: core.h:2289
CookWhen
Enumerations of cook conditions.
Definition: PDG_Node.h:587
PDG_Scheduler * myScheduler
Definition: PDG_Node.h:785
BypassState myBypassState
Definition: PDG_Node.h:797
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:774
CookWhen myCookWhen
Definition: PDG_Node.h:795
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