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 
344  /// Dirties the node by deleting all static and dynamic work items, and
345  /// dirtying (but not deleting) wrappers
346  void dirty(bool remove_outputs);
347 
348  /// Prepares a dirty operation that can be applied later
349  PDG_WorkItemDirty prepareDirty();
350 
351  /// Appends to an existing dirty operation
352  void appendDirty(PDG_WorkItemDirty* dirty_state);
353 
354 
355  /// Freezes all work items in the node and their associated attribute
356  /// data.
357  void freeze();
358 
359  /// Sets the work items in the node from the input list and freezes them
360  void freezeFrom(const PDG_WorkItemArray& work_items);
361 
362  /// Cooks the node. This is a utility method that calls the standard
363  /// cook logic on the the graph context
364  bool cook(bool blocking, UT_WorkBuffer& errors);
365 
366  /// Cancels any work items scheduled by this node
367  void cancel();
368 
369  /// Inserts a work item into the node after it has been deserialized. Based
370  /// on the type of the item, it will be added to the various structures
371  /// (wrapper list, partition maps, etc).
372  virtual bool deserializeWorkItem(PDG_WorkItem* work_item);
373 
374  /// Called after a work item is completely deserialized.
375  virtual void commitWorkItem(PDG_WorkItem* work_item);
376 
377  /// Returns the cache state of a work item in this node
378  virtual PDG_WorkItemCacheState
379  outputCacheState(
380  const PDG_WorkItem* work_item) const;
381 
382  /// Notifies the node that the specified work item has started cooking
383  void startWorkItem(PDG_WorkItem* work_item);
384 
385  /// Reserves a number of work item indices in a contiguous block, and
386  /// returns the first index value.
387  int reserveIndexBlock(int number);
388 
389 
390  /// Returns the node interface/template that describes the default
391  /// parameters and connections for the node
392  const PDG_NodeInterface* templateInterface() const override;
393 
394  /// Adds a custom/spare parameter to the node and returns a pointer to the
395  /// the parameter port.
396  PDG_Port* addCustomParameter(PDGT_Value::DataType type,
397  const UT_StringHolder& name,
398  const UT_StringHolder& label,
399  const UT_StringArray& tags,
400  int size);
401 
402  /// Returns node connectivity information
403  int connectionCount(
405  bool filter_bypassed=true,
406  bool filter_reference=true) const;
407  void connectedNodes(
408  PDG_NodeArray& nodes,
410  bool filter_bypassed=true,
411  bool filter_reference=true) const;
412  PDG_Node* firstConnectedNode(
414  bool filter_bypassed=true,
415  bool filter_reference=true) const;
416  void connectedAncestors(
417  PDG_NodeSet& nodes,
419  bool filter_bypassed=true,
420  bool filter_reference=true);
421 
422  /// Emits a node level error from the node as PDG_Event
423  void addError(
424  const UT_StringHolder& message)
425  const override;
426 
427  /// Emits a node level warning from the node as PDG_Event
428  void addWarning(
429  const UT_StringHolder& message)
430  const override;
431 
432  /// Handler for external dependencies, e.g. files. External dependencies
433  /// that are added to the node will be resolved just before a work item in
434  /// the node is cooked.
436  dependencies() const;
437  void addDependency(PDG_Dependency* dependency);
438  void removeDependency(PDG_Dependency* dependency);
439  void resolveDependencies();
440 
441 
442  /// Returns the underyling work item array. This method is not safe to call
443  /// from external code if a cook or dirty is in progress.
445  { return myWorkItems; }
446 
447  /// Returns the IDs of the work items in the node
448  void workItemIDs(
449  PDG_WorkItemIDArray& array,
450  bool include_batches) const;
451 
452  /// Returns a safe copy of the work item array
453  void workItemsCopy(
454  PDG_WorkItemArray& array,
455  bool include_batches) const;
456 
457  /// Returns a safe copy of the work item array with a filter. The filter
458  /// function is called for each work item, and can return false to indicate
459  /// that the work item shouldn't be included in the copied list
460  template <typename Filter>
462  PDG_WorkItemArray& array,
463  const Filter& filter) const
464  {
466  myWorkItemLock);
467  for (auto&& work_item : myWorkItems)
468  {
469  if (work_item && filter(work_item))
470  array.append(work_item);
471  }
472  }
473 
474  /// Returns a safe copy of the batch work item set
475  void batchItemsCopy(PDG_BatchWorkItemSet& set) const;
476 
477  /// Removes a list of work item from the node
478  void removeWorkItems(
479  const PDG_WorkItemConstArray& work_items);
480 
481  /// Aggregates output files from all work items. Safe to call from multiple
482  /// threads or during a cook, and will return false/empty result if the
483  /// serial lock cannot be acquired
484  bool outputFiles(PDG_File::Array& files,
485  bool localize) const;
486 
487  /// Builds evaluation dependencies to cook a specific set of work items
488  virtual void queueWorkItemDeps(
489  PDGE_Evaluator& evaluator,
490  PDG_NodeSet& visited_nodes,
491  PDG_WorkItemIDSet& visited_items,
492  PDG_Filter& filter);
493 
494  /// Runs precook logic for this node and recurses into input nodes.
495  bool preCook(PDG_NodeSet& dirty,
496  PDG_NodeSet& visited,
497  bool& save_scene,
498  bool has_filter);
499 
500 
501  /// Sets the loop depth and loop block reference on the node
502  int preCookLoop();
503 
504 
505  /// Runs postcook logic for this node and recurses into input nodes.
506  void postCook(PDG_NodeSet& visited);
507 
508  /// Adds or updates an existing file cache entry with the specified cache
509  /// id. This will create an entry if one does not yet exist.
510  PDG_CacheID addOutputCacheEntry(const UT_StringHolder& file,
511  PDG_CacheID cache_id);
512 
513  /// Adds or updates the dependent file attribute cache, and returns a new
514  /// cache ID for the work itme based on the entry.
515  PDG_CacheID addModTimeCacheEntry(
516  const PDG_File& file,
517  const PDG_WorkItem* work_item);
518 
519  /// Serializes the work items in the node to the specified stream
520  bool saveJSON(std::ostream &os, bool binary);
521 
522  /// Serializes the work items in the node to the specified file
523  bool saveJSON(const UT_StringHolder& file_path);
524 
525  /// Writes the current parameter value configuration of this node
526  /// interface to JSON
527  bool asJSON(
528  UT_JSONWriter& writer,
529  bool skip_defaults) const;
530 
531  /// Reads and constructs a scheduler from JSON and returns the instance
532  static bool fromJSON(
533  const UT_JSONValue* value,
534  PDG_GraphContext* context,
535  PDG_NodePortMap& inputs,
536  UT_WorkBuffer& errors);
537 
538  /// Queues node dependencies for cooking with the evaluator
539  static void queueNodeDeps(PDGE_Evaluator& evaluator,
540  const PDG_NodeSet& leaf_nodes,
541  const PDG_NodeSet& error_handlers,
542  bool generate_only,
543  bool cook);
544 
545 protected:
546  /// Tracks generation state of the node over a particular scope, using
547  /// a counter since a node can be generating in multiple threads at a
548  /// time.
550  {
551  public:
552  ScopedGenerate(PDG_Node* node);
553  ~ScopedGenerate();
555  inline bool isFirstGenerate() const { return myIsFirstGenerate; }
556 
557  private:
558  PDG_Node* myNode;
559  fpreal myStartTime;
560  bool myIsFirstGenerate;
561  };
562 
563  /// Helper struct for validating and dirtying incomplete loop blocks. Each
564  /// node in a loop is passed a vector of infos for any loops that pass
565  /// through that node, which is usd to set the maximal loop depth and begin
566  /// block list for each node in a block.
567  struct LoopInfo
568  {
574  };
575 
576  /// Helper struct for tracking out of date files in file attributes with
577  /// the `transfer` flag set.
579  {
583  };
584 
585  /// Enumerations of cook conditions
586  enum CookWhen
587  {
588  /// Never queue work items in this node for cooking
590 
591  /// Queue work items in this node once the isGenerated dep reolves --
592  /// these items will cook eventually, but may wait for targeted
593  /// partitioners first.
595 
596  /// Queue work items for cooking immediately after they've been
597  /// generated.
599  };
600 
601  /// Enumeration of targeting conditions
603  {
604  /// No partitioner targets this node
605  eTargetedNone = 0x0,
606 
607  /// A partitioner set to generate when all items in this node are
608  /// generated
609  eTargetedAll = 0x1,
610 
611  /// A partitioner set to generate each time items in this node are
612  /// generated
613  eTargetedEach = 0x2,
614  };
615 
616 protected:
617  friend class PDG_BatchWorkItem;
618  friend class PDG_Mapper;
619  friend class PDG_Processor;
620  friend class PDG_Partitioner;
621  friend class PDG_WorkItem;
622  friend class PDG_WorkItemDirty;
623 
624  inline UT_RWLock& attributeLock() const
625  { return myAttributeLock; }
626 
628  { return &myCanGenerateDep; }
630  { return &myIsGeneratedDep; }
632  { return &myIsCookedDep; }
633 
635  { return &myPropagateGroup; }
636 
637  UT_StringHolder debugName() const override
638  { return name(); }
639 
640  void resetOwner() override;
641 
642  virtual int preCookLoop(
643  const UT_Array<LoopInfo>& begin_info);
644  virtual bool preCook(bool is_dirty, bool has_filter);
645  virtual void postCook();
646 
647  virtual void clearAllWorkItems();
648  virtual void clearWorkItem(const PDG_WorkItem* work_item);
649  virtual void addWorkItem(PDG_WorkItem* work_item);
650  virtual bool queueWorkItem(PDG_WorkItem* work_item)
651  { return false; }
652  virtual bool syncWorkItem(PDG_WorkItem* work_item,
653  const PDG_WorkItem* clone_target)
654  { return false; }
655  virtual bool cookWorkItem(
656  PDGE_Resolutions& resolutions,
657  PDG_WorkItem* work_item,
658  bool did_cook);
659 
661  { return PDG_WorkItemState::eUncooked; }
662 
663  virtual bool cacheBuiltinParms(PDG_NodeSet& dirty,
664  bool dynamic_inputs);
665  virtual void addInputDeps(PDG_Node* input_node);
666  virtual void addCommonDeps();
667 
668  virtual bool requiresCookedInputs(bool cook) const;
669 
670  virtual bool shouldSchedule(
671  const PDG_WorkItem* work_item) const
672  { return false; }
673 
674  void injectDynamicWorkItem(PDG_WorkItem* work_item);
675 
676  void addPropagateDependencies(
677  const PDG_WorkItemArray& work_items);
678  void addWorkItems(
679  const PDG_WorkItemArray& work_items,
680  const PDG_BatchWorkItemSet& batches,
682  bool sort_items);
683 
684  void queueWorkItemResolutions(
685  PDGE_Resolutions& resolutions,
686  PDG_WorkItem* work_item,
687  PDGE_Dependency* can_cook_dep);
688  void queueBatchWorkItemResolutions(
689  PDGE_Resolutions& resolutions,
690  PDG_BatchWorkItem* batch_item,
691  PDGE_Dependency* can_cook_dep);
692 
693  void needsNodeCook(
694  UT_ArrayMap<PDG_Node*, bool>& needs_cook,
695  bool generate_only,
696  bool cook);
697  void queueNodeDeps(
698  PDGE_Evaluator& evaluator,
699  const UT_ArrayMap<PDG_Node*, bool>& needs_cook,
700  const PDG_NodeSet& error_handlers,
701  PDG_NodeSet& visited,
702  bool generate_only,
703  bool cook);
704 
705  void updateInputRegeneration();
706 
707  void applyDirty(bool remove_outputs);
708  void prepareDirtyAll(
709  PDG_WorkItemDirty& dirty_state,
710  bool remove_outputs);
711 
712  bool compactItems(bool reset_index=false);
713 
714  bool upstreamItems(
715  PDG_WorkItemArray& work_items,
716  bool skip_failed=false) const;
717  bool downstreamItems(
718  PDG_WorkItemArray& work_items) const;
719 
720  void clearOutputCache();
721  void updateModTimeCache();
722 
723  template <typename FieldType, typename EvalType=FieldType>
725  PDG_NodeSet& dirty,
726  const UT_StringHolder& parm_name,
727  FieldType& field,
728  const FieldType& default_value,
729  bool set_dirty = true)
730  {
731  FieldType field_value = default_value;
732  PDGT_Value* port_value =
733  paramValue(parm_name);
734 
735  if (port_value)
736  {
737  EvalType eval_value;
738  port_value->value(eval_value);
739  field_value =
740  (FieldType)(eval_value);
741  }
742 
743  if (field == field_value)
744  return;
745  field = field_value;
746 
747  if (set_dirty && myHasCachedParms)
748  dirty.insert(this);
749  }
750 
751 protected:
755 
760 
763 
767 
772 
774 
777 
779 
782 
784 
788 
792 
795 
798 
801 
806 
811 
813  mutable bool myHasError;
816 
819 
824 
826 };
827 
828 #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:796
PDG_ServiceResetType myLoopResetType
Definition: PDG_Node.h:571
PDG_SortOptions mySortOptions
Definition: PDG_Node.h:754
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
PDGE_Dependency * isCookedDep()
Definition: PDG_Node.h:631
bool myHasCachedParms
Definition: PDG_Node.h:814
virtual bool queueWorkItem(PDG_WorkItem *work_item)
Definition: PDG_Node.h:650
bool myIsAllGeneration
Definition: PDG_Node.h:810
PDGE_Dependency myIsCookedDep
Definition: PDG_Node.h:758
PDGE_Dependency myIsGeneratedDep
Definition: PDG_Node.h:757
bool myIsErrorHandler
Definition: PDG_Node.h:817
std::pair< iterator, bool > insert(const value_type &value)
Definition: UT_ArraySet.h:972
RegenerateReason
Regeneration reasons.
Definition: PDG_Node.h:69
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
bool myHasError
Definition: PDG_Node.h:813
RegenerateReason regenerateReason() const
Definition: PDG_Node.h:296
PDG_ServiceResetWhen myLoopResetWhen
Definition: PDG_Node.h:570
UT_Array< PDG_Dependency * > myDependencies
Definition: PDG_Node.h:766
PDG_ServiceResetType
UT_TBBSpinLock myModTimeCacheLock
Definition: PDG_Node.h:805
UT_TBBSpinLock myOutputCacheLock
Definition: PDG_Node.h:804
The node is not bypassed.
Definition: PDG_Node.h:96
PDG_File::Hash myLastStat
Definition: PDG_Node.h:581
PDG_ServiceResetWhen loopResetWhen() const
Returns the loop block's service reset conditoon.
Definition: PDG_Node.h:224
bool myIsGenerated
Definition: PDG_Node.h:820
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:602
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:786
void addSchedulerReference(PDG_Scheduler *scheduler)
Definition: PDG_Node.h:210
void workItemsCopy(PDG_WorkItemArray &array, const Filter &filter) const
Definition: PDG_Node.h:461
bool myIsCooked
Definition: PDG_Node.h:822
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:637
PDG_NodeOptions myNodeOptions
Definition: PDG_Node.h:752
Definition: PDG_Node.h:578
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:781
bool myIsActive
Definition: PDG_Node.h:821
UT_StringHolder myServiceName
Definition: PDG_Node.h:783
UT_StringMap< ModTimeCacheEntry > myModTimeCache
Definition: PDG_Node.h:771
bool myHasNoGenerate
Definition: PDG_Node.h:812
PDG_WorkItemArray myWorkItems
Definition: PDG_Node.h:761
int myInputFilter
Definition: PDG_Node.h:787
UT_StringHolder myName
Definition: PDG_Node.h:773
PDGE_PropagateGroup * propagateGroup()
Definition: PDG_Node.h:634
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:808
PDG_NodeSet myStaticAncestors
Definition: PDG_Node.h:764
bool isDynamicEval() const
Definition: PDG_Node.h:263
PDG_NodeCallbackPtr myCallback
Definition: PDG_Node.h:775
PDG_NodeStats myNodeStats
Definition: PDG_Node.h:753
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:799
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:724
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:785
const PDG_Node * myBeginNode
Definition: PDG_Node.h:572
PDG_NodeArray myExtraInputs
Definition: PDG_Node.h:765
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:790
Definition: core.h:760
bool myIsDynamicProp
Definition: PDG_Node.h:809
bool isDynamicProp() const
Definition: PDG_Node.h:273
UT_RWLock & attributeLock() const
Definition: PDG_Node.h:624
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:580
UT_StringHolder myServiceName
Definition: PDG_Node.h:569
#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:660
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:815
virtual int64 getMemoryUsage(bool inclusive) const
Returns the memory usage of this owner instance.
bool myIsFrozen
Definition: PDG_Node.h:823
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:797
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:762
exint append()
Definition: UT_Array.h:142
bool myUseServiceBlock
Definition: PDG_Node.h:825
Never queue work items in this node for cooking.
Definition: PDG_Node.h:589
virtual bool syncWorkItem(PDG_WorkItem *work_item, const PDG_WorkItem *clone_target)
Definition: PDG_Node.h:652
BypassState
Bypass state for the node.
Definition: PDG_Node.h:93
PDG_WorkItemCacheState
PDG_GraphContext * myContext
Definition: PDG_Node.h:778
bool myIsErrorHandlerBranch
Definition: PDG_Node.h:818
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:670
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
PDGE_Dependency * isGeneratedDep()
Definition: PDG_Node.h:629
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:759
int PDG_NodeID
Node ID type.
Definition: PDG_NodeTypes.h:29
int myMaxIndex
Definition: PDG_Node.h:800
void setCallback(PDG_NodeCallbackPtr callback)
Definition: PDG_Node.h:199
UT_TBBSpinLock myWorkItemLock
Definition: PDG_Node.h:803
bool myIsDynamicGen
Definition: PDG_Node.h:807
UT_RWLock myAttributeLock
Definition: PDG_Node.h:802
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:99
const PDG_WorkItemArray & workItems() const
Definition: PDG_Node.h:444
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:794
PDGE_Dependency myCanGenerateDep
Definition: PDG_Node.h:756
PDG_ServiceResetType loopResetType() const
Returns the loop block's service reset type.
Definition: PDG_Node.h:228
PDG_CacheID myCacheId
Definition: PDG_Node.h:582
PDG_ServiceResetWhen myLoopResetWhen
Definition: PDG_Node.h:793
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:776
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:627
type
Definition: core.h:1059
CookWhen
Enumerations of cook conditions.
Definition: PDG_Node.h:586
PDG_Scheduler * myScheduler
Definition: PDG_Node.h:780
BypassState myBypassState
Definition: PDG_Node.h:791
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:769
CookWhen myCookWhen
Definition: PDG_Node.h:789
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