#include <portattributes.h>
DerivedAttributeInterface stands for derived attributes of ports.
The public declaration as well as the access to values of derived attributes is the same as for non-derived attributes, namely with MAXON_ATTRIBUTE. However, the values of derived attributes can't be set directly, instead they are derived based on other values of a NodeSystem.
Public Types | |
enum class | KIND { NONE , INHERITED , SYNTHESIZED , COMPUTED , FILTERED , INDUCED_DEPENDENCIES , NODE_PRE , NODE_POST , DERIVED_MASK } |
enum class | DEPENDENCY { NONE , SELF , CHILDREN , PARENT , HAS_CHILDREN , SELF_INPUT , SELF_OUTPUT , VALUE_SOURCES , VALUE_TARGETS , DEP_SOURCES , DEP_TARGETS , VALUE_DEP_SOURCES , VALUE_DEP_TARGETS , SOURCES_MASK , TARGETS_MASK , SHORTCUT_SOURCES , SHORTCUT_TARGETS , INDUCED_SOURCES , INDUCED_TARGETS , CTX_SOURCES_DEEP , CTX_TARGETS_DEEP , SHORTCUT_SOURCES_MASK , SHORTCUT_TARGETS_MASK , SOURCES_ALL , TARGETS_ALL } |
Public Member Functions | |
enum maxon::nodes::DerivedAttributeInterface::KIND | MAXON_ENUM_FLAGS_CLASS (KIND) |
enum maxon::nodes::DerivedAttributeInterface::DEPENDENCY | MAXON_ENUM_FLAGS_CLASS (DEPENDENCY) |
MAXON_METHOD KIND | GetKind () const |
MAXON_METHOD Block< const Tuple< InternedId, DEPENDENCY > > | GetDependencies () const |
MAXON_METHOD Bool | ValuesEqual (const ConstDataPtr &newValue, const NodePath &port, const ConstDataPtr &oldValue, Int oldNesting) const |
MAXON_METHOD Result< Opt< Data > > | DeriveAttributeValue (const Block< const Port > &nesting) const |
MAXON_METHOD Result< ConstDataPtr > | ComputeAttributeValue (const GNode &node, const DataType &expectedType) const |
Private Member Functions | |
MAXON_INTERFACE (DerivedAttributeInterface, MAXON_REFERENCE_CONST, "net.maxon.node.interface.derivedattribute") | |
|
strong |
There are three kinds of derived attributes:
Enumerator | |
---|---|
NONE | |
INHERITED | The attribute is an inherited attribute whose value is derived from values at direct predecessor ports. |
SYNTHESIZED | The attribute is a synthesized attribute whose value is derived from the values at direct successor ports. |
COMPUTED | The attribute is computed on-the-fly whenever its value is requested. |
FILTERED | This flag has to be set for inherited or synthesized attributes which shall use the derivation filter for connections. |
INDUCED_DEPENDENCIES | This flag has to be set for inherited or synthesized attributes when the derivation needs induced dependencies as well (see GraphModelInterface::GET_CONNECTIONS_MODE::INDUCED_DEPENDENCIES). |
NODE_PRE | The attribute is a derived attribute for true nodes which has to be derived before ports. |
NODE_POST | The attribute is a derived attribute for true nodes which has to be derived after ports. |
DERIVED_MASK | Use this to test for derived port attributes (INHERITED or SYNTHESIZED). |
|
strong |
The flags of this enum tell on which ports (relative to the current port) a derived attribute depends.
|
private |
enum maxon::nodes::DerivedAttributeInterface::KIND MAXON_ENUM_FLAGS_CLASS | ( | KIND | ) |
enum maxon::nodes::DerivedAttributeInterface::DEPENDENCY MAXON_ENUM_FLAGS_CLASS | ( | DEPENDENCY | ) |
MAXON_METHOD KIND GetKind | ( | ) | const |
Returns the kind of this attribute, i.e., whether it is an inherited, synthesized or computed attribute.
MAXON_METHOD Block<const Tuple<InternedId, DEPENDENCY> > GetDependencies | ( | ) | const |
Returns the dependencies of this derived attribute as attribute/DEPENDENCY pairs. This has to include all other attributes which are needed for the derivation of this attribute.
MAXON_METHOD Bool ValuesEqual | ( | const ConstDataPtr & | newValue, |
const NodePath & | port, | ||
const ConstDataPtr & | oldValue, | ||
Int | oldNesting | ||
) | const |
Compares two derived attribute values for equality. Usually this is the same as {newValue == oldValue}, but there are derived attributes whose values have to be interpreted in the context of the enclosing nodes.
[in] | newValue | The newly derived attribute value for port. |
[in] | port | The port for which newValue has been derived. |
[in] | oldValue | The previously derived attribute value for port. |
[in] | oldNesting | The nesting depth of the port's node which derived oldValue in the current node system. |
Derives the value of this attribute (either a synthesized or an inherited attribute) for the port given by the last element of nesting. The derivation may use attribute values of
But the dependency of this attribute on the accessed attributes has to be properly reflected by GetDependencies.
[in] | nesting | The port for which the attribute value shall be derived (last element) and its enclosing ports. |
MAXON_METHOD Result<ConstDataPtr> ComputeAttributeValue | ( | const GNode & | node, |
const DataType & | expectedType | ||
) | const |
Computes the value of this computed attribute for the given node.
[in] | node | The g-node for which the attribute value shall be computed. |
[in] | expectedType | The expected type of the value. If this is non-null, the returned value has to be castable to that type. |