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

#include <PDG_NodeCallback.h>

+ Inheritance diagram for PDG_NodeCallback:

Public Types

enum  GenerationType { eStaticGenerate = 0, eDynamicGenerate = 1, eStaticRegenerate = 2, eDynamicRegenerate = 3 }
 Work item generation type. More...
 
enum  CallbackType {
  eGenerate = 0x0001, eRegenerate = 0x0002, eAddInternalDependencies = 0x0004, ePartition = 0x0008,
  eMapStatic = 0x0010, eMapDynamic = 0x0020, ePreCook = 0x0040, ePostCook = 0x0080,
  ePrepareTask = 0x0100, eCookTask = 0x0200, ePostCookTask = 0x0400, eSelectTask = 0x0800,
  eDeselectTask = 0x1000, eConfigureNode = 0x2000, eProcessorBits = eGenerate | eRegenerate | eConfigureNode, ePartitionerBits = ePartition,
  eMapperBits = eMapStatic | eMapDynamic
}
 
- Public Types inherited from PDGT_TypeInstance< EnumType >
using BaseType = PDGT_BaseType< EnumType >
 

Public Member Functions

 PDG_NodeCallback (const PDG_BaseType *type, const PDGT_ValueArgs &extra_args, PDG_Node *node)
 
 ~PDG_NodeCallback () override
 
int64 getMemoryUsage (bool inclusive) const override
 Returns the memory usage of this callback. More...
 
bool hasCallback (CallbackType callback_type) const
 
void enableCallback (CallbackType callback_type)
 Enables a specific node callback. More...
 
bool reloadInstance (UT_WorkBuffer &errors) override
 Resets this node callback to match changes to the type object. More...
 
PDG_CallbackResult postInvoke (PDG_CallbackResult invoke_result) const
 
virtual PDG_CallbackResult onGenerate (PDG_WorkItemHolder *, const PDG_WorkItemArray &, GenerationType generation_type)
 Generates static items via a work item holder. Called on processors. More...
 
virtual PDG_CallbackResult onRegenerate (PDG_WorkItemHolder *, const PDG_WorkItemArray &, const PDG_WorkItemArray &, GenerationType generation_type)
 
virtual PDG_CallbackResult onAddInternalDependencies (PDG_DependencyHolder *, const PDG_WorkItemArray &, bool is_static)
 
virtual PDG_CallbackResult onPartition (PDG_PartitionHolder *, const PDG_WorkItemArray &, const PDG_WorkItem *)
 
virtual PDG_CallbackResult onMapStatic (PDG_DependencyHolder *holder, const PDG_WorkItemArray &downstream_items, const PDG_WorkItemArray &upstream_items)
 
virtual PDG_CallbackResult onMapDynamic (PDG_DependencyHolder *holder, const PDG_WorkItemArray &downstream_items, const PDG_WorkItemArray &upstream_items)
 
virtual PDG_CallbackResult onPreCook ()
 
virtual PDG_CallbackResult onPostCook ()
 Called on each node in the graph after the cook finishes. More...
 
virtual PDG_CallbackResult onPrepareTask (PDG_WorkItem *work_item)
 
virtual PDG_CallbackResult onCookTask (PDG_WorkItem *work_item)
 
virtual PDG_CallbackResult onPostCookTask (PDG_WorkItem *work_item)
 Called when a work item has completed cooking. More...
 
virtual PDG_CallbackResult onSelectTask (PDG_WorkItem *work_item)
 Called when a work item is selected by TOPs. More...
 
virtual PDG_CallbackResult onDeselectTask (PDG_WorkItem *work_item)
 Called when a work item is deselcted. More...
 
virtual PDG_CallbackResult onConfigureNode (PDG_NodeOptions *node_options)
 Called when the node should describe itself for the UI. More...
 
PDG_Nodenode () const
 Returns the node associated with this callback. More...
 
template<typename T >
bool evaluate (T &result, const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int index=0, int multi=-1) const
 Convenience method for evaluating a parameter on the underlying node. More...
 
template<typename T >
bool evaluateArray (T &result, const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int multi=-1) const
 
UT_StringHolder evaluateS (const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int index=0, int multi=-1) const
 
UT_StringHolder evaluateRaw (const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int index=0, int multi=-1) const
 
fpreal evaluateF (const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int index=0, int multi=-1) const
 
exint evaluateI (const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int index=0, int multi=-1) const
 
bool evaluateB (const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int index=0, int multi=-1) const
 
template<typename T >
T evaluateT (const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int index=0, int multi=-1) const
 
- Public Member Functions inherited from PDGT_TypeInstance< EnumType >
 PDGT_TypeInstance ()
 
 PDGT_TypeInstance (const PDGT_BaseType< EnumType > *base_type, const PDGT_ValueArgs &extra_args)
 
virtual ~PDGT_TypeInstance ()
 
const BaseTypetype () const
 
const UT_StringHoldertypeName () const
 
const PDGT_ValueArgsextraArgs () const
 
bool compareType (const BaseType *other_type, bool deep=true) const
 
void setReloading (bool is_reloading)
 
bool isReloading () const
 

Protected Attributes

PDG_NodemyNode
 
int myCallbackBits
 
- Protected Attributes inherited from PDGT_TypeInstance< EnumType >
const BaseTypemyBaseType
 
PDGT_ValueArgs myExtraArgs
 
bool myReloading
 

Detailed Description

Examples:
PDG/PDG_PartitionByParity.h, and PDG/PDG_ProcessorRandom.h.

Definition at line 77 of file PDG_NodeCallback.h.

Member Enumeration Documentation

Enumeration of node callbacks. These enum values are a power of 2 since they go into a bit vector for checking the presence of callbacks

Enumerator
eGenerate 
eRegenerate 
eAddInternalDependencies 
ePartition 
eMapStatic 
eMapDynamic 
ePreCook 
ePostCook 
ePrepareTask 
eCookTask 
ePostCookTask 
eSelectTask 
eDeselectTask 
eConfigureNode 
eProcessorBits 
ePartitionerBits 
eMapperBits 

Definition at line 93 of file PDG_NodeCallback.h.

Work item generation type.

Enumerator
eStaticGenerate 
eDynamicGenerate 
eStaticRegenerate 
eDynamicRegenerate 

Definition at line 81 of file PDG_NodeCallback.h.

Constructor & Destructor Documentation

PDG_NodeCallback::PDG_NodeCallback ( const PDG_BaseType type,
const PDGT_ValueArgs extra_args,
PDG_Node node 
)
PDG_NodeCallback::~PDG_NodeCallback ( )
override

Member Function Documentation

void PDG_NodeCallback::enableCallback ( CallbackType  callback_type)

Enables a specific node callback.

template<typename T >
bool PDG_NodeCallback::evaluate ( T result,
const UT_StringHolder name,
const PDG_WorkItem work_item = nullptr,
int  index = 0,
int  multi = -1 
) const
inline

Convenience method for evaluating a parameter on the underlying node.

Definition at line 232 of file PDG_NodeCallback.h.

template<typename T >
bool PDG_NodeCallback::evaluateArray ( T result,
const UT_StringHolder name,
const PDG_WorkItem work_item = nullptr,
int  multi = -1 
) const
inline

Convenience method for evaluating a parameter as an array on the underlying node

Definition at line 245 of file PDG_NodeCallback.h.

bool PDG_NodeCallback::evaluateB ( const UT_StringHolder name,
const PDG_WorkItem work_item = nullptr,
int  index = 0,
int  multi = -1 
) const
inline

Evaluates a parameter as a boolean and returns the value back, instead of an error code.

Definition at line 308 of file PDG_NodeCallback.h.

fpreal PDG_NodeCallback::evaluateF ( const UT_StringHolder name,
const PDG_WorkItem work_item = nullptr,
int  index = 0,
int  multi = -1 
) const
inline

Evaluates a parameter as a float and returns the value back, instead of an error code.

Definition at line 282 of file PDG_NodeCallback.h.

exint PDG_NodeCallback::evaluateI ( const UT_StringHolder name,
const PDG_WorkItem work_item = nullptr,
int  index = 0,
int  multi = -1 
) const
inline

Evaluates a parameter as an integer and returns the value back, instead of an error code.

Definition at line 295 of file PDG_NodeCallback.h.

UT_StringHolder PDG_NodeCallback::evaluateRaw ( const UT_StringHolder name,
const PDG_WorkItem work_item = nullptr,
int  index = 0,
int  multi = -1 
) const
inline

Evaluates a parameter as a raw string and returns the value back, instead of an error code.

Definition at line 269 of file PDG_NodeCallback.h.

UT_StringHolder PDG_NodeCallback::evaluateS ( const UT_StringHolder name,
const PDG_WorkItem work_item = nullptr,
int  index = 0,
int  multi = -1 
) const
inline

Evaluates a parameter as a string and returns the value back, instead of an error code.

Definition at line 256 of file PDG_NodeCallback.h.

template<typename T >
T PDG_NodeCallback::evaluateT ( const UT_StringHolder name,
const PDG_WorkItem work_item = nullptr,
int  index = 0,
int  multi = -1 
) const
inline

Evaluates a parameter as an arbitrary type and returns the value back, instad of an error code.

Definition at line 322 of file PDG_NodeCallback.h.

int64 PDG_NodeCallback::getMemoryUsage ( bool  inclusive) const
overridevirtual

Returns the memory usage of this callback.

Reimplemented from PDGT_TypeInstance< EnumType >.

bool PDG_NodeCallback::hasCallback ( CallbackType  callback_type) const

Returns true if the node callback has the specified callback installed, else returns false

PDG_Node* PDG_NodeCallback::node ( ) const

Returns the node associated with this callback.

virtual PDG_CallbackResult PDG_NodeCallback::onAddInternalDependencies ( PDG_DependencyHolder ,
const PDG_WorkItemArray ,
bool  is_static 
)
virtual

Adds dependencies between newly created work items. Called on processors.

virtual PDG_CallbackResult PDG_NodeCallback::onConfigureNode ( PDG_NodeOptions node_options)
virtual

Called when the node should describe itself for the UI.

virtual PDG_CallbackResult PDG_NodeCallback::onCookTask ( PDG_WorkItem work_item)
virtual

Called when a work item wants to cook in-process, but does not have its own cook implementation

virtual PDG_CallbackResult PDG_NodeCallback::onDeselectTask ( PDG_WorkItem work_item)
virtual

Called when a work item is deselcted.

virtual PDG_CallbackResult PDG_NodeCallback::onGenerate ( PDG_WorkItemHolder ,
const PDG_WorkItemArray ,
GenerationType  generation_type 
)
virtual

Generates static items via a work item holder. Called on processors.

virtual PDG_CallbackResult PDG_NodeCallback::onMapDynamic ( PDG_DependencyHolder holder,
const PDG_WorkItemArray downstream_items,
const PDG_WorkItemArray upstream_items 
)
virtual

Adds dependencies between dynamic items above a mapper and static items below the mapper.

virtual PDG_CallbackResult PDG_NodeCallback::onMapStatic ( PDG_DependencyHolder holder,
const PDG_WorkItemArray downstream_items,
const PDG_WorkItemArray upstream_items 
)
virtual

Adds dependencies between static itrems below a mapper node and static ancestors above. Called on mapper nodes.

virtual PDG_CallbackResult PDG_NodeCallback::onPartition ( PDG_PartitionHolder ,
const PDG_WorkItemArray ,
const PDG_WorkItem  
)
virtual

Groups upstream work items into partitions that can be non-disjoint and do not necessarily cover the set of all items. Called on partitioner nodes.

virtual PDG_CallbackResult PDG_NodeCallback::onPostCook ( )
virtual

Called on each node in the graph after the cook finishes.

virtual PDG_CallbackResult PDG_NodeCallback::onPostCookTask ( PDG_WorkItem work_item)
virtual

Called when a work item has completed cooking.

virtual PDG_CallbackResult PDG_NodeCallback::onPreCook ( )
virtual

Called before the graph begins cooking. This is only called on nodes that are on the active cook path, and is guaranteed to be called on each node before any threaded cooking begins. If a Failure result is returned from any of the nodes, the cook is aborted

virtual PDG_CallbackResult PDG_NodeCallback::onPrepareTask ( PDG_WorkItem work_item)
virtual

Called when a work item has all of its dependencies satisfied, and will be submitted to the scheduler or cooked in-process shortly.

virtual PDG_CallbackResult PDG_NodeCallback::onRegenerate ( PDG_WorkItemHolder ,
const PDG_WorkItemArray ,
const PDG_WorkItemArray ,
GenerationType  generation_type 
)
virtual

Regenerates static items, only called when items already exist. The callback can add new items, or dirty/delete existing items.

virtual PDG_CallbackResult PDG_NodeCallback::onSelectTask ( PDG_WorkItem work_item)
virtual

Called when a work item is selected by TOPs.

PDG_CallbackResult PDG_NodeCallback::postInvoke ( PDG_CallbackResult  invoke_result) const

Performs post callback invocation logic and returns a final callback result

bool PDG_NodeCallback::reloadInstance ( UT_WorkBuffer errors)
overridevirtual

Resets this node callback to match changes to the type object.

Reimplemented from PDGT_TypeInstance< EnumType >.

Member Data Documentation

int PDG_NodeCallback::myCallbackBits
protected

Definition at line 335 of file PDG_NodeCallback.h.

PDG_Node* PDG_NodeCallback::myNode
protected

Definition at line 334 of file PDG_NodeCallback.h.


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