HDK
|
#include <PDGE_Dependency.h>
Public Types | |
enum | State : uint8 { eSucceeded = 0x00, eCanceled = 0x01, eFailed = 0x02, eReset = 0x04, eClear = 0x08 } |
using | Set = UT_ArraySet< PDGE_Dependency * > |
using | Array = UT_Array< PDGE_Dependency * > |
using | Map = UT_ArrayMap< PDGE_Dependency *, PDGE_Dependency * > |
using | OwnerArray = UT_Array< PDGE_DependencyOwner * > |
using | PartialPair = std::pair< PDGE_Dependency *, OwnerArray > |
using | Partial = UT_Array< PartialPair > |
Public Member Functions | |
PDGE_Dependency (const char *name, PDGE_DependencyOwner *owner) | |
virtual | ~PDGE_Dependency () |
Destroys this dependency object. More... | |
int64 | getMemoryUsage (bool inclusive) const |
Returns the memory usage of this object. More... | |
bool | addDependency (PDGE_Dependency *dependency, bool partial=false, PDGE_Dependency *propagate=nullptr, bool is_any=false) |
bool | hasDependencies () const |
Returns true if this object has any dependencies. More... | |
bool | hasDependents () const |
Returns true if this object has any dependents. More... | |
bool | hasDependency (PDGE_Dependency *dependency) const |
Returns true if this object has the specifed dependency. More... | |
bool | isPartialSrc () const |
bool | isPartialDst () const |
bool | isResolved () const |
bool | isHeavy () const |
Returns true if this dependency has a heavy-weight evaluation routine. More... | |
uint8 | state () const |
Returns the current state value of the dependency. More... | |
bool | hasState (State state) const |
Returns true if the current state value is set. More... | |
void | updateState (State state) |
ORs the state value into the current state. More... | |
PDGE_DependencyOwner * | owner () const |
Returns the object that owns this dependency. More... | |
const Set & | dependencies () const |
Returns the set of all dependencies. More... | |
const Array & | dependents () const |
Returns the array of all dependents. More... | |
UT_TBBSpinLock & | edgeLock () const |
Returns the edge lock for this dependency object. More... | |
void | reset (int initial_count=0, bool is_heavy=false) |
void | unresolve () |
bool | tryResolve (int count=1) |
void | increment (int count=1) |
UT_StringHolder | debugName (bool as_dot=false) const |
Friends | |
class | PDGE_Resolutions |
Base class for dependencies types. Stores a Set of dependencies and a vector of dependents. Dependencies are added using the addDependency method, which ensures that no duplicate entries are added and adds back references on the dependent this object.
A dependency relationship can optionally be marked as "partial" – by default the partial flag is false. A partial dependency means that the dependent/child is interested in partial resolution updates from the dependency/parent it is attached to. When one of the parent's dependencies is resolved, it passes on that information to all dependents/children that are interested in partial updates.
Once a dependency's resolution count reaches 0, it is marked as resolved and all dependents are inspected to see if they too have reached 0. A resolved dependency cannot be put back to the unresolved state unless it is reset. Resetting is not thread safe nor is it safe to do while a graph is being evalauated. It should only be done after an evaluation has completed.
If PDGE_DEBUG_ENABLE_NAMES is defined, this class also stores a string name for the dependency for debug output.
Definition at line 53 of file PDGE_Dependency.h.
using PDGE_Dependency::Array = UT_Array<PDGE_Dependency*> |
Definition at line 57 of file PDGE_Dependency.h.
Definition at line 58 of file PDGE_Dependency.h.
Definition at line 60 of file PDGE_Dependency.h.
using PDGE_Dependency::Partial = UT_Array<PartialPair> |
Definition at line 62 of file PDGE_Dependency.h.
using PDGE_Dependency::PartialPair = std::pair<PDGE_Dependency*, OwnerArray> |
Definition at line 61 of file PDGE_Dependency.h.
using PDGE_Dependency::Set = UT_ArraySet<PDGE_Dependency*> |
Definition at line 56 of file PDGE_Dependency.h.
enum PDGE_Dependency::State : uint8 |
Dependency resolve state, passed back from the PDGE_DependencyOwner when doing a full or partial resolve. The state has no impact on the resolution of the dependency itself, but it propagate to dependents.
Definition at line 67 of file PDGE_Dependency.h.
PDGE_Dependency::PDGE_Dependency | ( | const char * | name, |
PDGE_DependencyOwner * | owner | ||
) |
Constructs a new dependency from a name and dependency owner. The name is only stored if PDGE_DEBUG_ENABLE_NAMES is enabled.
|
virtual |
Destroys this dependency object.
bool PDGE_Dependency::addDependency | ( | PDGE_Dependency * | dependency, |
bool | partial = false , |
||
PDGE_Dependency * | propagate = nullptr , |
||
bool | is_any = false |
||
) |
Adds a dependency if it does not already exist. This method locks both this object and the dependency. Returns true if the dependency was added, else false.
UT_StringHolder PDGE_Dependency::debugName | ( | bool | as_dot = false | ) | const |
Returns the debug full name, which includes the name of this object and its owner. The as_dot argument indicates whether or not the name is going to be used for dot graph output.
|
inline |
Returns the set of all dependencies.
Definition at line 164 of file PDGE_Dependency.h.
|
inline |
Returns the array of all dependents.
Definition at line 168 of file PDGE_Dependency.h.
|
inline |
Returns the edge lock for this dependency object.
Definition at line 172 of file PDGE_Dependency.h.
int64 PDGE_Dependency::getMemoryUsage | ( | bool | inclusive | ) | const |
Returns the memory usage of this object.
|
inline |
Returns true if this object has any dependencies.
Definition at line 109 of file PDGE_Dependency.h.
|
inline |
Returns true if this object has the specifed dependency.
Definition at line 117 of file PDGE_Dependency.h.
|
inline |
Returns true if this object has any dependents.
Definition at line 113 of file PDGE_Dependency.h.
|
inline |
Returns true if the current state value is set.
Definition at line 150 of file PDGE_Dependency.h.
Increments the ref count on this dependency by one, for manual contorl over the ref count
|
inline |
Returns true if this dependency has a heavy-weight evaluation routine.
Definition at line 141 of file PDGE_Dependency.h.
|
inline |
Returns true if this dependency is interested in receiving partial resolve calls, when one of its dependencies is partially resolved.
Definition at line 132 of file PDGE_Dependency.h.
|
inline |
Returns true if this dependency is a partial source, i.e. it emits partial resolve calls when one of its dependencies is resolved
Definition at line 127 of file PDGE_Dependency.h.
|
inline |
Returns true if this dependency has been resolved. Resolves dependencies can only go back to being unresolved when calling reset().
Definition at line 137 of file PDGE_Dependency.h.
|
inline |
Returns the object that owns this dependency.
Definition at line 160 of file PDGE_Dependency.h.
Resets this dependecy object back to its default state. The initial count determines the starting value of the unresolved counter.
|
inline |
Returns the current state value of the dependency.
Definition at line 146 of file PDGE_Dependency.h.
|
inline |
Decrements the ref count on this dependency by one. Should be used when this dependency is reset with a non-0 initial count, for adding an N+1 dependency.
Definition at line 192 of file PDGE_Dependency.h.
void PDGE_Dependency::unresolve | ( | ) |
Unresolves a dependency and all of its dependents. This is different than a reset because its non-destructive, and propgates state to dependents. It is also threadsafe with other internal operations and will interrupt and clear any resolutions that are already in progress. It will not, however, be able to interrupt calls into the dependency owner that may be changing state on that object.
ORs the state value into the current state.
Definition at line 154 of file PDGE_Dependency.h.
|
friend |
Definition at line 205 of file PDGE_Dependency.h.