HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEP_MicroNode Class Reference

#include <DEP_MicroNode.h>

+ Inheritance diagram for DEP_MicroNode:

Public Types

typedef std::function< void(DEP_MicroNode
&, DEP_MicroNode &) > 
Visitor
 
typedef std::function< bool(const
DEP_MicroNode &, const
DEP_MicroNode &) > 
TraverseVisitor
 
typedef bool(DEP_MicroNode::* GetFlag )() const
 
typedef void(DEP_MicroNode::* SetFlag )(bool flag)
 

Public Member Functions

 DEP_MicroNode ()
 
virtual ~DEP_MicroNode ()
 
virtual const char * className () const
 
virtual void getInputs (DEP_MicroNodeList &inputs) const
 
virtual void clearInputs ()
 
virtual void getOutputs (DEP_MicroNodeList &outputs) const
 
virtual void update (fpreal t)
 
virtual bool requiresUpdate (fpreal t) const
 
void propagateDirty (Visitor client_visit, bool only_outputs=false)
 
virtual void becameDirty (DEP_MicroNode &src, const DEP_PropagateData &propdata)
 
void traverseAncestorInputs (const TraverseVisitor &visitor) const
 Traverse all ancestor inputs of this micronode. More...
 
bool markVisitPass (int pass)
 
int lastVisitPass () const
 
virtual int64 getMemoryUsage (bool inclusive) const
 Obtain approximate memory usage. More...
 
virtual void dump (std::ostream &os, const char *prefix=0, int indent_level=0) const
 Dump contents to output stream, strictly for debugging purposes. More...
 
void dumpAsDOT (std::ostream &os, const char *prefix=0, int indent_level=0) const
 Dump the contents is a manner more suitable for DOT. More...
 
bool inheritTimeDependentFromExplicitInputs ()
 
bool inheritTimeInterestedFromExplicitInputs ()
 
bool inheritContextOptionDepsFromExplicitInputs (const UT_StringArray &ignore_deps)
 
void addExplicitInput (DEP_MicroNode &inp, bool check_dup)
 Methods for manipulating explicit edges. More...
 
void addExplicitInput (DEP_MicroNode &inp)
 Add an input that this micronode depends on. More...
 
void getExplicitInputs (DEP_MicroNodeList &inputs) const
 Get list of all non-null explicit inputs. More...
 
int getNumExplicitInputs () const
 Get the number of non-null inputs. More...
 
void getExplicitOutputs (DEP_MicroNodeList &outputs) const
 Get list of all non-null explicit outputs. More...
 
int getNumExplicitOutputs () const
 Get the number of non-null outputs. More...
 
bool isDirty () const
 Flag accessors. More...
 
void setDirty (bool flag, bool allow_clear=true)
 Flag accessors. More...
 
bool isTimeDependent () const
 Flag accessors. More...
 
void setTimeDependent (bool time_dependent)
 Flag accessors. More...
 
bool isTimeInterested () const
 Flag accessors. More...
 
void setTimeInterested (bool time_interested)
 Flag accessors. More...
 
bool hasContextOptionDeps () const
 Flag accessors. More...
 
const DEP_ContextOptionDepsgetContextOptionDeps () const
 Flag accessors. More...
 
void addContextOptionDeps (const DEP_ContextOptionDeps &opts)
 Flag accessors. More...
 
void addContextOptionDep (const UT_StringHolder &opt)
 Flag accessors. More...
 
void clearContextOptionDeps ()
 Flag accessors. More...
 
bool isOpDataMicroNode () const
 Flag accessors. More...
 

Static Public Member Functions

static bool canClearDependencies ()
 Global control whether dependencies can be cleared. More...
 
static bool canEvaluateExports ()
 Global control whether we can evaluate exports. More...
 
static SYS_FORCE_INLINE bool isSameTime (fpreal a, fpreal b)
 
- Static Public Member Functions inherited from UT_SmallObject< UT_NonCopyable >
static voidoperator new (size_t size)
 Regular new/delete operators. More...
 
static void operator delete (void *p, size_t size)
 Regular new/delete operators. More...
 
static voidoperator new (size_t, void *p)
 
static void operator delete (void *, void *)
 

Protected Member Functions

void setIsOpDataMicroNode (bool b)
 
virtual bool isEvaluating () const
 
virtual void evaluateExports ()
 
virtual bool isExporting () const
 

Friends

class dep_Visitor
 
class DEP_KeepDependenciesScope
 
class DEP_BlockEvaluateExportsScope
 

Detailed Description

Represent an atomic unit of computation for dependency tracking.

DEP_MicroNode's form a dependency graph that are connected both implicitly and explicitly. The base class maintains the explicit edges while subclasses maintain the implicit edges by overriding the getInputs()/getOutputs() methods.

Definition at line 55 of file DEP_MicroNode.h.

Member Typedef Documentation

typedef bool(DEP_MicroNode::* DEP_MicroNode::GetFlag)() const

Definition at line 189 of file DEP_MicroNode.h.

typedef void(DEP_MicroNode::* DEP_MicroNode::SetFlag)(bool flag)

Definition at line 190 of file DEP_MicroNode.h.

typedef std::function< bool (const DEP_MicroNode & , const DEP_MicroNode & ) > DEP_MicroNode::TraverseVisitor

Definition at line 133 of file DEP_MicroNode.h.

typedef std::function< void (DEP_MicroNode & , DEP_MicroNode & ) > DEP_MicroNode::Visitor

Definition at line 129 of file DEP_MicroNode.h.

Constructor & Destructor Documentation

DEP_MicroNode::DEP_MicroNode ( )
virtual DEP_MicroNode::~DEP_MicroNode ( )
virtual

Member Function Documentation

void DEP_MicroNode::addContextOptionDep ( const UT_StringHolder opt)
inline

Flag accessors.

Definition at line 244 of file DEP_MicroNode.h.

void DEP_MicroNode::addContextOptionDeps ( const DEP_ContextOptionDeps opts)
inline

Flag accessors.

Definition at line 237 of file DEP_MicroNode.h.

void DEP_MicroNode::addExplicitInput ( DEP_MicroNode inp,
bool  check_dup 
)

Methods for manipulating explicit edges.

Add an input that this micronode depends on, with control on whether to check for duplicates.

void DEP_MicroNode::addExplicitInput ( DEP_MicroNode inp)
inline

Add an input that this micronode depends on.

Definition at line 105 of file DEP_MicroNode.h.

virtual void DEP_MicroNode::becameDirty ( DEP_MicroNode src,
const DEP_PropagateData propdata 
)
inlinevirtual

Callbacks for what to do when the micronode becomes dirty. Derived micronodes can override this. Note that it requires knowledge of who made it dirty as they may behave differently. Currently used by OP_Node::propagateDirtyMicroNode

Reimplemented in OP_DataMicroNode, VOP_SnippetMicroNode, SIM_SimulationMicroNode, OP_ParmMicroNode, and OP_EventMicroNode.

Definition at line 153 of file DEP_MicroNode.h.

static bool DEP_MicroNode::canClearDependencies ( )
inlinestatic

Global control whether dependencies can be cleared.

Definition at line 260 of file DEP_MicroNode.h.

static bool DEP_MicroNode::canEvaluateExports ( )
inlinestatic

Global control whether we can evaluate exports.

Definition at line 264 of file DEP_MicroNode.h.

void DEP_MicroNode::clearContextOptionDeps ( )
inline

Flag accessors.

Definition at line 250 of file DEP_MicroNode.h.

virtual void DEP_MicroNode::clearInputs ( )
inlinevirtual

Clear all inputs, including any state data related to them. Default implementation just calls clearExplicitInputs() and setTimeDependent(false).

Reimplemented in GusdOP_ParmChangeMicroNode, PRM_ParmMicroNode, OP_DataMicroNode, and VOP_ErrorMicroNode.

Definition at line 71 of file DEP_MicroNode.h.

virtual void DEP_MicroNode::dump ( std::ostream &  os,
const char *  prefix = 0,
int  indent_level = 0 
) const
virtual

Dump contents to output stream, strictly for debugging purposes.

Reimplemented in OP_DataMicroNode, PRM_ParmMicroNode, and OP_ParmMicroNode.

void DEP_MicroNode::dumpAsDOT ( std::ostream &  os,
const char *  prefix = 0,
int  indent_level = 0 
) const

Dump the contents is a manner more suitable for DOT.

virtual void DEP_MicroNode::evaluateExports ( )
inlineprotectedvirtual

evaluateExports() is called after isExporting() is noted to be true during a dirty propagation pass initiated by dirtySubtree().

Reimplemented in OP_DataMicroNode.

Definition at line 286 of file DEP_MicroNode.h.

const DEP_ContextOptionDeps& DEP_MicroNode::getContextOptionDeps ( ) const
inline

Flag accessors.

Definition at line 234 of file DEP_MicroNode.h.

void DEP_MicroNode::getExplicitInputs ( DEP_MicroNodeList inputs) const

Get list of all non-null explicit inputs.

void DEP_MicroNode::getExplicitOutputs ( DEP_MicroNodeList outputs) const

Get list of all non-null explicit outputs.

virtual void DEP_MicroNode::getInputs ( DEP_MicroNodeList inputs) const
virtual

Get list of all our non-null inputs, both implicit and explicit. The base class returns the list of explicit inputs.

Reimplemented in VIS_MountMicroNode, VIS_ParmsMicroNode, OP_DataMicroNode, VOP_ErrorMicroNode, VOP_ExportedParmLayoutMicroNode, and VOP_ParmDSMicroNode.

virtual int64 DEP_MicroNode::getMemoryUsage ( bool  inclusive) const
virtual

Obtain approximate memory usage.

Reimplemented in OP_DataMicroNode, and PRM_ParmMicroNode.

int DEP_MicroNode::getNumExplicitInputs ( ) const
inline

Get the number of non-null inputs.

Definition at line 113 of file DEP_MicroNode.h.

int DEP_MicroNode::getNumExplicitOutputs ( ) const
inline

Get the number of non-null outputs.

Definition at line 121 of file DEP_MicroNode.h.

virtual void DEP_MicroNode::getOutputs ( DEP_MicroNodeList outputs) const
virtual

Get list of all our non-null outputs, both implicit and explicit. The base class returns the list of explicit outputs.

Reimplemented in VIS_MountMicroNode, VIS_ParmsMicroNode, OP_DataMicroNode, OP_ParmMicroNode, VOP_ErrorMicroNode, VOP_ParmDSMicroNode, and VOP_DataMicroNode.

bool DEP_MicroNode::hasContextOptionDeps ( ) const
inline

Flag accessors.

Definition at line 231 of file DEP_MicroNode.h.

bool DEP_MicroNode::inheritContextOptionDepsFromExplicitInputs ( const UT_StringArray ignore_deps)

Inherit extra dependencies from all explicit inputs. The ignore_deps string array MUST BE SORTED. Returns true if any extra dependencies are found.

bool DEP_MicroNode::inheritTimeDependentFromExplicitInputs ( )

Set time dependent flag if any explicit inputs are set. Returns true if any explicit inputs are true.

bool DEP_MicroNode::inheritTimeInterestedFromExplicitInputs ( )

Set time interested flag if any explicit inputs are set. Returns true if any explicit inputs are true.

bool DEP_MicroNode::isDirty ( ) const
inline

Flag accessors.

Definition at line 208 of file DEP_MicroNode.h.

virtual bool DEP_MicroNode::isEvaluating ( ) const
inlineprotectedvirtual

These methods are overriden by subclasses to be used by the dirty propagation algorithm.Used to determine if a micronode is currently evaluating. If this returns true, during dirty propagation, it will prevent dependencies from being removed from it.

Reimplemented in OP_DataMicroNode.

Definition at line 281 of file DEP_MicroNode.h.

virtual bool DEP_MicroNode::isExporting ( ) const
inlineprotectedvirtual

Used to determine if a micronode requires its exports to be evaluated during the propagation pass.

Reimplemented in OP_DataMicroNode.

Definition at line 290 of file DEP_MicroNode.h.

bool DEP_MicroNode::isOpDataMicroNode ( ) const
inline

Flag accessors.

Definition at line 255 of file DEP_MicroNode.h.

static SYS_FORCE_INLINE bool DEP_MicroNode::isSameTime ( fpreal  a,
fpreal  b 
)
inlinestatic

One true method to compare equality of time values for caching. This particular form originates from what OP_Node::cook() did from the dawn of time.

Definition at line 270 of file DEP_MicroNode.h.

bool DEP_MicroNode::isTimeDependent ( ) const
inline

Flag accessors.

Definition at line 221 of file DEP_MicroNode.h.

bool DEP_MicroNode::isTimeInterested ( ) const
inline

Flag accessors.

Definition at line 226 of file DEP_MicroNode.h.

int DEP_MicroNode::lastVisitPass ( ) const
inline

Definition at line 172 of file DEP_MicroNode.h.

bool DEP_MicroNode::markVisitPass ( int  pass)
inline

Mark this micronode as having seen the given global dirty counter. Returns false if we've already seen it.

Definition at line 164 of file DEP_MicroNode.h.

void DEP_MicroNode::propagateDirty ( Visitor  client_visit,
bool  only_outputs = false 
)

Mark this micronode and all its dependents as dirty. The global dirty counter will be incremented once for each call to propagateDirty().

Parameters
client_visitCalled for each micronode that is dirtied
only_outputsIf true, then *this is ommitted from being dirtied
Note
This method is NOT thread-safe with any operation on any micronode. Only call this when no other micronode operations are running.
virtual bool DEP_MicroNode::requiresUpdate ( fpreal  t) const
inlinevirtual

requiresUpdate() specifies if the micro-node was dirtied, possibly based on the time t. By default, it returns isDirty() but subclasses override this to handle other conditions that make this micro-node requiring an update.

Reimplemented in OP_DataMicroNode, and DEP_TimedMicroNode.

Definition at line 92 of file DEP_MicroNode.h.

void DEP_MicroNode::setDirty ( bool  flag,
bool  allow_clear = true 
)
inline

Flag accessors.

Definition at line 210 of file DEP_MicroNode.h.

void DEP_MicroNode::setIsOpDataMicroNode ( bool  b)
inlineprotected

Definition at line 295 of file DEP_MicroNode.h.

void DEP_MicroNode::setTimeDependent ( bool  time_dependent)
inline

Flag accessors.

Definition at line 223 of file DEP_MicroNode.h.

void DEP_MicroNode::setTimeInterested ( bool  time_interested)
inline

Flag accessors.

Definition at line 228 of file DEP_MicroNode.h.

void DEP_MicroNode::traverseAncestorInputs ( const TraverseVisitor visitor) const

Traverse all ancestor inputs of this micronode.

virtual void DEP_MicroNode::update ( fpreal  t)
inlinevirtual

update() is used by users of micro-nodes to mark this node as clean at the given time t. By default, it simply marks it as no longer dirty but subclasses override this to do more work.

Reimplemented in GusdOP_ParmChangeMicroNode, OP_DataMicroNode, and DEP_TimedMicroNode.

Definition at line 85 of file DEP_MicroNode.h.

Friends And Related Function Documentation

friend class DEP_BlockEvaluateExportsScope
friend

Definition at line 354 of file DEP_MicroNode.h.

friend class DEP_KeepDependenciesScope
friend

Definition at line 353 of file DEP_MicroNode.h.

friend class dep_Visitor
friend

Definition at line 352 of file DEP_MicroNode.h.


The documentation for this class was generated from the following file: