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

#include <PDGE_Evaluator.h>

+ Inheritance diagram for PDGE_Evaluator:

Public Types

enum  State {
  eUninitialized, eEvaluating, eCanceling, eCompleted,
  eInvalid
}
 The state of the evaluator object. More...
 
- Public Types inherited from PDGE_DependencyOwner
using Array = UT_Array< PDGE_DependencyOwner * >
 
using Set = UT_ArraySet< PDGE_DependencyOwner * >
 

Public Member Functions

 PDGE_Evaluator ()
 
 ~PDGE_Evaluator () noexceptoverride
 
int64 getMemoryUsage (bool inclusive) const override
 Returns the memory usage of this object. More...
 
State evaluationState () const
 
const PDGE_EvaluationOptionsevaluationOptions () const
 Returns the evaluation options used for the current cook. More...
 
void evaluate (const PDGE_EvaluationOptions &options)
 
void cancelEvaluator ()
 
void resetEvaluator ()
 
void invalidateEvaluator ()
 
void addRootDependency (PDGE_Dependency *dependency)
 
bool hasRootDependency (PDGE_Dependency *root) const
 Returns true if this evaluator depends on the specified dependency. More...
 
void queueInitial (PDGE_Dependency *dependency)
 
void queueResolve (PDGE_Resolutions &resolutions)
 
void resolve (const PDGE_Resolutions &resolutions)
 
void partial (PDGE_Resolutions &resolutions)
 
UT_StringHolder debugName () const override
 Returns the debug name for this evaluator object. More...
 
PDGE_Dependency::State evalResolve (PDGE_Resolutions &resolutions, const PDGE_Evaluator &evaluator, PDGE_Dependency *dependency) override
 
template<typename WrappedFunction , typename... Args>
void runFunctor (Args &&...args)
 
- Public Member Functions inherited from PDGE_DependencyOwner
 PDGE_DependencyOwner ()
 Constructs a new dependency owner, which must have a string name. More...
 
virtual ~PDGE_DependencyOwner ()
 
virtual void resetOwner ()
 Resets the owner. More...
 
virtual UT_StringHolder debugGroup () const
 

Protected Member Functions

bool preEvaluate ()
 
void postEvaluate ()
 
virtual bool preEvaluation ()
 
virtual bool tickEvaluation ()
 
virtual void postEvaluation (State state, bool canceled)
 
- Protected Member Functions inherited from PDGE_DependencyOwner
virtual int evalUnresolve (PDGE_Dependency::Array &, PDGE_Dependency *)
 
virtual PDGE_Dependency::State evalPartial (PDGE_Resolutions &, const PDGE_Evaluator &, PDGE_Dependency *, const Array &)
 
const PDGE_Dependency::SetpropagateSet ()
 Returns the propagate set for this owner. More...
 
void addPropagate (PDGE_Dependency *dependency)
 Adds an entry to the propagate set. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from PDGE_DependencyOwner
template<typename T >
static void cast (UT_Array< T > &out, const Array &in)
 Converts an owner array to an array of the specified type. More...
 
template<typename T >
static void cast (Array &out, const UT_Array< T > &in)
 Converts an array of the specified type to an owner array. More...
 

Detailed Description

Definition at line 54 of file PDGE_Evaluator.h.

Member Enumeration Documentation

The state of the evaluator object.

Enumerator
eUninitialized 

The evaluator is uninitialize and evaluation has not yet begun.

eEvaluating 

The evaluator is evaluating.

eCanceling 

The evaluator is canceling the current evaluation.

eCompleted 

The evaluator has completed, either because it ran normally or because it was canceled.

eInvalid 

This object is invalid because it was cleaned up during shutdown.

Definition at line 58 of file PDGE_Evaluator.h.

Constructor & Destructor Documentation

PDGE_Evaluator::PDGE_Evaluator ( )
PDGE_Evaluator::~PDGE_Evaluator ( )
overridenoexcept

Member Function Documentation

void PDGE_Evaluator::addRootDependency ( PDGE_Dependency dependency)

Adds a root dependency – a dependency that must be completed before this evaluator can be marked as a Completed.

void PDGE_Evaluator::cancelEvaluator ( )

Cancels the current evaluation. If this object is not evaluating, this method does nothing.

UT_StringHolder PDGE_Evaluator::debugName ( ) const
overridevirtual

Returns the debug name for this evaluator object.

Implements PDGE_DependencyOwner.

PDGE_Dependency::State PDGE_Evaluator::evalResolve ( PDGE_Resolutions resolutions,
const PDGE_Evaluator evaluator,
PDGE_Dependency dependency 
)
overridevirtual

Called when all dependencies on this object's root dependency have resolved. This indicates that the cook is complete.

Reimplemented from PDGE_DependencyOwner.

void PDGE_Evaluator::evaluate ( const PDGE_EvaluationOptions options)

Evaluates the dependency graph. If blocking is true, this method waits until the evaluation is completed. When blocking the functors created by the evaluator will be created in a task scope that is parented to the calling code's current task scope. Otherwise, if the cook is not blocking, an empty task scope will be used and evaluating dependencies will be unable to share task locks held by the calling code.

const PDGE_EvaluationOptions& PDGE_Evaluator::evaluationOptions ( ) const
inline

Returns the evaluation options used for the current cook.

Definition at line 92 of file PDGE_Evaluator.h.

State PDGE_Evaluator::evaluationState ( ) const
inline

Returns the current state of the evaluator. This method is not thread- safe when called off the main thread if the main thread may be calling cancel().

Definition at line 87 of file PDGE_Evaluator.h.

int64 PDGE_Evaluator::getMemoryUsage ( bool  inclusive) const
overridevirtual

Returns the memory usage of this object.

Reimplemented from PDGE_DependencyOwner.

bool PDGE_Evaluator::hasRootDependency ( PDGE_Dependency root) const
inline

Returns true if this evaluator depends on the specified dependency.

Definition at line 123 of file PDGE_Evaluator.h.

void PDGE_Evaluator::invalidateEvaluator ( )

Sets this evaluator as invalid, which disables any additional work creation. It also waits for the contained task group to finish any pending work, so that it can be cleanly destroyed.

void PDGE_Evaluator::partial ( PDGE_Resolutions resolutions)

Immediately processes partial evaluations in a dependency resolution array on the calling thread. Adds additional non-partial resolutions that become unblocked to the array.

void PDGE_Evaluator::postEvaluate ( )
protected
virtual void PDGE_Evaluator::postEvaluation ( State  state,
bool  canceled 
)
inlineprotectedvirtual

Reimplemented in PDG_GraphContext.

Definition at line 188 of file PDGE_Evaluator.h.

bool PDGE_Evaluator::preEvaluate ( )
protected
virtual bool PDGE_Evaluator::preEvaluation ( )
inlineprotectedvirtual

Reimplemented in PDG_GraphContext.

Definition at line 184 of file PDGE_Evaluator.h.

void PDGE_Evaluator::queueInitial ( PDGE_Dependency dependency)

Adds an initial dependency resolution, which will be processed as soon as evaluation begins.

void PDGE_Evaluator::queueResolve ( PDGE_Resolutions resolutions)

Queues a dependency resolution array, which will be processed in the background with the task group owned by this object.. This method should be used when queueing resolutions from a different TBB task or a thread that is NOT already being run through the task group associated with this evaluator object.

void PDGE_Evaluator::resetEvaluator ( )

Resets the object back to its default state. This method cannot be called unless the evaluator is the Completed or Uninitialized state.

void PDGE_Evaluator::resolve ( const PDGE_Resolutions resolutions)

Immediately processes a dependency resolution array on the calling thread. This should only be called within the task hierarchy of the task group associated with the evaluator object. Otherwise, for external code that wishes to dynamically submit additional work, the queueResolve method should be used instead.

template<typename WrappedFunction , typename... Args>
void PDGE_Evaluator::runFunctor ( Args &&...  args)
inline

Runs a functor with the evaluator's task group and returns immediately. The functor will eventually run in the background.

Definition at line 162 of file PDGE_Evaluator.h.

virtual bool PDGE_Evaluator::tickEvaluation ( )
inlineprotectedvirtual

Reimplemented in PDG_GraphContext.

Definition at line 186 of file PDGE_Evaluator.h.


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