HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_DataMicroNode.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  * NAME: OP_DataMicroNode.h (OP Library, C++)
7  *
8  * COMMENTS: DEP_MicroNode subclass representing an OP_Node's output data.
9  */
10 
11 #ifndef __OP_DATAMICRONODE_H_INCLUDED__
12 #define __OP_DATAMICRONODE_H_INCLUDED__
13 
14 #include "OP_API.h"
15 #include "OP_Version.h"
16 #include <DEP/DEP_MicroNode.h>
17 #include <SYS/SYS_Math.h>
18 #include <SYS/SYS_Types.h>
19 
20 class OP_Node;
21 
23 {
24 public:
26 
27  const char * className() const override
28  { return "OP_DataMicroNode"; }
29 
30  void getParmInputs(DEP_MicroNodeList &inputs) const;
31  void getUsedDataInputs(DEP_MicroNodeList &inputs) const;
32 
33  bool inheritTimeDependentFromUsedDataInputs();
34  bool inheritTimeInterestedFromUsedDataInputs();
35 
36  void getInputs(DEP_MicroNodeList &inputs) const override;
37  void clearInputs() override;
38  void getOutputs(
39  DEP_MicroNodeList &outputs) const override;
40 
41  /// Like getInputs() but excludes wired OP_Node inputs
42  void getExtraInputs(DEP_MicroNodeList &inputs) const;
43 
44  /// Like getOutputs() but excludes wired OP_Node outputs. For parmlist
45  /// micronodes, this will exclude the its owner OP_Node.
46  void getExtraOutputs(DEP_MicroNodeList &outputs) const;
47 
48  /// update() is used by users of micro-nodes to mark this node as clean at
49  /// the given time t.
50  void update(fpreal t) override;
52  const DEP_ContextOptionsStack *optstack);
53 
54  /// requiresUpdate() specifies if the micro-node was dirtied, possibly
55  /// based on the time t.
56  bool requiresUpdate(fpreal t) const override;
57  bool requiresUpdate(
59  const DEP_ContextOptionsStack *optstack) const;
60 
61  /// Returns the options and values _used_ in the last cook of this data.
63  { return myLastUsedContextOptions; }
64  /// Returns all options and values provided to the last cook of this data.
66  { return myLastAllContextOptions; }
68  { return myLastUsedContextStack.get(); }
70  { return myLastMissingContextOptions; }
71 
72  /// Used to determine if a micronode is currently evaluating. If this
73  /// returns true, during dirty propagation, it will prevent dependencies
74  /// from being removed from it.
75  bool isEvaluating() const override;
76 
77  /// evaluateExports() is called after isExporting() is noted to be true
78  /// during a dirty propagation pass initiated by dirtySubtree().
79  void evaluateExports() override;
80 
81  /// Used to determine if a micronode requires its exports to be evaluated
82  /// during the propagation pass.
83  bool isExporting() const override;
84 
85  int64 getMemoryUsage(bool inclusive) const override;
86 
87  void dump(
88  std::ostream &os,
89  const char *prefix = 0,
90  int indent_level = 0) const override;
91 
92  OP_Node & ownerNode() const
93  { return myNode; }
94 
96  { myModVersion++; }
97  bool isModVersionOutdated() const
98  { return myModVersion != myLastModVersion; }
100  { return myModVersion; }
102  { return myLastModVersion; }
103 
105  { return myLastUpdateTime; }
106 
108  { return isSameTime(t, myLastUpdateTime); }
109 
111  const DEP_PropagateData &data) override;
112 
114  { myModVersion = v; }
115 
116 private:
117  OP_Node &myNode;
118  DEP_ContextOptionsHandle myLastUsedContextOptions;
119  UT_UniquePtr<DEP_ContextOptionsStack> myLastUsedContextStack;
120  DEP_ContextOptionsReadHandle myLastAllContextOptions;
121  UT_StringArray myLastMissingContextOptions;
122  // Bumped everytime the node gets dirty.
123  OP_VERSION myModVersion;
124  // Current version of the entire cache
125  OP_VERSION myLastModVersion;
126  fpreal myLastUpdateTime;
127 };
128 
129 #endif // __OP_DATAMICRONODE_H_INCLUDED__
virtual void getInputs(DEP_MicroNodeList &inputs) const
GLenum src
Definition: glew.h:2410
virtual void becameDirty(DEP_MicroNode &src, const DEP_PropagateData &propdata)
uint64 OP_VERSION
Definition: OP_Version.h:6
static SYS_FORCE_INLINE bool isSameTime(fpreal a, fpreal b)
virtual void update(fpreal t)
Definition: DEP_MicroNode.h:81
virtual int64 getMemoryUsage(bool inclusive) const
Obtain approximate memory usage.
virtual bool requiresUpdate(fpreal t) const
Definition: DEP_MicroNode.h:88
virtual bool isExporting() const
const GLdouble * v
Definition: glew.h:1391
virtual void clearInputs()
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:33
void setModVersion(OP_VERSION v)
OP_VERSION lastModVersion() const
DEP_ContextOptionsReadHandle getLastUsedContextOptions() const
Returns the options and values used in the last cook of this data.
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
const char * className() const override
virtual bool isEvaluating() const
OP_Node & ownerNode() const
long long int64
Definition: SYS_Types.h:116
bool isEqualToLastUpdateTime(fpreal t) const
const UT_StringArray & getLastMissingContextOptions() const
DEP_ContextOptionsStack * getLastUsedContextOptionsStack() const
virtual void evaluateExports()
OP_VERSION modVersion() const
fpreal64 fpreal
Definition: SYS_Types.h:277
#define OP_API
Definition: OP_API.h:10
virtual void dump(std::ostream &os, const char *prefix=0, int indent_level=0) const
Dump contents to output stream, strictly for debugging purposes.
Propagation info for a dep micro node.
Definition: DEP_MicroNode.h:36
virtual void getOutputs(DEP_MicroNodeList &outputs) const
bool isModVersionOutdated() const
const DEP_ContextOptionsReadHandle & getLastAllContextOptions() const
Returns all options and values provided to the last cook of this data.
GLdouble GLdouble t
Definition: glew.h:1398
fpreal lastUpdateTime() const