#include <nodesystem.h>
This class template contains the functions of a general g-node which shall also be available on Result<NODE>.
Public Member Functions | |
Bool | IsPort () const |
const PortSelector< BASE::MUTABLE > & | ToPort () const |
Result< void > | GetValues (GraphAttribute::FLAGS mask, GraphAttributeMap &attribs, Bool includeInherited=true, Bool includeRemoved=false) const |
Result< ConstDataPtr > | GetValue (const InternedId &attr, const DataType &expectedType) const |
Result< ConstDataPtr > | GetValue (const InternedId &attr, const DataType &expectedType, Int &nesting, Bool negativeRootNesting=false) const |
template<typename T > | |
Result< Opt< const T & > > | GetValue (const InternedId &attr) const |
template<typename ATTR > | |
Result< Opt< const typename ATTR::ValueType & > > | GetValue (const ATTR &attr) const |
template<typename ATTR > | |
Result< Opt< const typename ATTR::ValueType & > > | GetValue () const |
template<typename ATTR > | |
Result< Opt< const typename ATTR::ValueType & > > | GetValue (const ATTR &attr, Int &nesting) const |
Result< Bool > | GetBaseValues (const InternedId &attr, const DataType &expectedType, const ValueReceiver< const ConstDataPtr &, Int > &receiver) const |
template<typename T > | |
Result< const T & > | GetDefaultValue (const T &def=maxon::NullValue< const T & >()) const |
template<typename T > | |
Result< const T & > | GetConstantValue (const T &def=maxon::NullValue< const T & >()) const |
Result< Bool > | GetAttributeModificationsSince (TimeStamp stamp, const ValueReceiver< InternedId, ConstDataPtr > &receiver) const |
TimeStamp | GetAttributeStamp (const InternedId &attr) const |
Result< NodeSelector< BASE::MUTABLE > > | GetNode () const |
Result< GNodeSelector< BASE::MUTABLE > > | GetParent () const |
Result< GNodeSelector< BASE::MUTABLE > > | FindChild (const InternedId &name, NODE_KIND mask) const |
template<typename NODE > | |
Result< typename NODE::template Selector< BASE::MUTABLE > > | FindInnerNode (const PathBlock &relativePath) const |
Result< Bool > | GetInnerNodes (NODE_KIND mask, Bool includeThis, const ValueReceiver< const GNodeSelector< BASE::MUTABLE > & > &receiver) const |
const NodeSystem & | GetBase () const |
const Block< const NodeSystem > & | GetBases () const |
Result< Bool > | GetAllBases (const ValueReceiver< const NodeSystem & > &receiver) const |
const NodeTemplate & | GetTemplate () const |
Result< Bool > | GetAllTemplates (const ValueReceiver< const NodeTemplate & > &receiver) const |
const NodeSystemDerivationHandler & | GetDerivationHandler () const |
Protected Types | |
using | Super = BASE |
|
protected |
Bool IsPort | ( | void | ) | const |
const PortSelector<BASE::MUTABLE>& ToPort | ( | ) | const |
Downcasts this reference to a port reference. This function may only be invoked if this reference really points to a port and not just to a port list (see IsPort()), otherwise the behaviour is undefined.
Result<void> GetValues | ( | GraphAttribute::FLAGS | mask, |
GraphAttributeMap & | attribs, | ||
Bool | includeInherited = true , |
||
Bool | includeRemoved = false |
||
) | const |
Collects all attribute values which are defined for this g-node in #attribs. This includes values which are set at the node itself, but also values which are inherited from a base node unless they have been marked as removed by MutableGNode::RemoveValue().
[in] | mask | A mask to filter the attributes which shall be added to attribs. The mask filter is split into two parts: You have to set at least one of the flags from GraphAttribute::FLAGS::TYPE_MASK to determine which attribute types shall be taken into account at all. Optionally you can add further flags, then these have to be matched too. |
[in] | attribs | The map to write the values to. |
[in] | includeInherited | Use true if attributes inherited from base node systems shall be added (the default). |
[in] | includeRemoved | Use true if removed attributes shall be added, too (false by default, the corresponding attribute value to signal a removed attribute is empty). |
Result<ConstDataPtr> GetValue | ( | const InternedId & | attr, |
const DataType & | expectedType | ||
) | const |
Returns a pointer to the value of #attr at this g-node. The value may be defined at this node itself or at one of its bases. If no value is found or the found value doesn't match the expectedType, nullptr is returned.
[in] | attr | The attribute whose value shall be obtained. |
[in] | expectedType | The expected type of the value. May be nullptr, then no type-check is done. |
Result<ConstDataPtr> GetValue | ( | const InternedId & | attr, |
const DataType & | expectedType, | ||
Int & | nesting, | ||
Bool | negativeRootNesting = false |
||
) | const |
Returns a pointer to the value of #attr at this g-node. The value may be defined at this node itself or at one of its bases. If no value is found or the found value doesn't match the expectedType, nullptr is returned.
Compared to the basic GetValue function this function has an additional output parameter nesting. If a value is found, the nesting of the node system which contained the value is written to nesting. For example if the attribute value is defined at a node system which is a child of the root node system, the nesting is 1. If it's a child of a child the nesting is 2. However if the root node system overrides an attribute value for a g-node of a child, then the nesting is 0, or -1 when negativeRootNesting is true.
[in] | attr | The attribute whose value shall be obtained. |
[in] | expectedType | The expected type of the value. May be nullptr, then no type-check is done. |
[out] | nesting | If a value is found, the nesting of the node system which contained the value is written to nesting. |
[in] | negativeRootNesting | If this is true #nesting will be set to -1 if the value is defined at the root node system. This allows to distinguish between values which are set at the root and those which are inherited from a base (they will report a nesting of 0). |
Result<Opt<const T&> > GetValue | ( | const InternedId & | attr | ) | const |
Returns a pointer to the value of #attr at this g-node. The value may be defined at this node itself or at one of its bases. If no value is found or the found value doesn't match the expected type T, nullptr is returned.
[in] | attr | The attribute whose value shall be obtained. |
T | The expected type of the value. |
Returns a pointer to the value of #attr at this g-node. The value may be defined at this node itself or at one of its bases. If no value is found or the found value doesn't match the expected type of the attribute, nullptr is returned.
[in] | attr | The attribute whose value shall be obtained. |
Returns a pointer the value of #ATTR at this g-node. The value may be defined at this node itself or at one of its bases. If no value is found, nullptr is returned.
ATTR | The attribute whose value shall be obtained. |
Returns a pointer the value of #attr at this g-node. The value may be defined at this node itself or at one of its bases. If no value is found, nullptr is returned.
[in] | attr | The attribute whose value shall be obtained. |
[out] | nesting | If a value is found, the nesting of the node system which contained the value is written to nesting, see GetValue(InternedId, DataType, Int). |
Result<Bool> GetBaseValues | ( | const InternedId & | attr, |
const DataType & | expectedType, | ||
const ValueReceiver< const ConstDataPtr &, Int > & | receiver | ||
) | const |
Yields all values which are stored for attr at this g-node and its bases. While the normal getter functions only return the outmost value (which overrides the inner ones) this function allows to obtain also the hidden values.
The found values are reported together with their nesting in ascending order of the nesting. The nesting is defined as for GetValue(InternedId, DataType, Int) with one exception: A value which is stored at the root node system itself has a nesting of -1 instead of 0. This allows to distinguish between such values and values stored at a base of the root node system (which have a nesting of 0).
[in] | attr | The attribute whose values shall be obtained. |
[in] | expectedType | The expected type of the attribute. May be nullptr, then no type-check is done. |
[in] | receiver | A callback which receives the attribute values and their nestings. |
Result<const T&> GetDefaultValue | ( | const T & | def = maxon::NullValue<const T&>() | ) | const |
Returns the default value of this port. This is the value of the DefaultValue attribute, which in turn is synthesized from DESCRIPTION::DATA::BASE::DEFAULTVALUE: Default values are derived from right to left along connections.
T | The type to return. |
[in] | def | The default value to use when there is no value for DefaultValue (or the type didn't match). |
Result<const T&> GetConstantValue | ( | const T & | def = maxon::NullValue<const T&>() | ) | const |
Returns the constant value of this port. The constant value is set whenever the graph implementation is able to determine a constant value for the port, either because the default value has been set directly at the port, or because it is possible to compute the value from connected ports and nodes.
T | The type to return. |
[in] | def | The value to return when there is no constant value of matching type. |
Result<Bool> GetAttributeModificationsSince | ( | TimeStamp | stamp, |
const ValueReceiver< InternedId, ConstDataPtr > & | receiver | ||
) | const |
Reports all attribute modifications which have been made for this g-node since the given stamp to the receiver. Only stored attributes will be reported, so to also check for new values of computed attributes you should use GraphAttributeInterface::IsComputedFrom().
[in] | stamp | A reference time stamp. Only modifications newer than this stamp are reported. |
[in] | receiver | Modifications are reported to this receiver as a pair of the attribute identifier and the current value. |
TimeStamp GetAttributeStamp | ( | const InternedId & | attr | ) | const |
Returns the modification stamp of the given attribute for this g-node. This is the value of the node system's time stamp (see NodeSystemInterface::GetModificationStamp) at the time when the attribute value has been set last for this g-node, or a null value if it hasn't been set at all.
[in] | attr | An attribute. |
Result<NodeSelector<BASE::MUTABLE> > GetNode | ( | ) | const |
Returns the enclosing (true) node to which this g-node belongs. If this g-node is already a node, then it is returned itself.
Result<GNodeSelector<BASE::MUTABLE> > GetParent | ( | ) | const |
Returns the parent node of this node. If this node is null or a root node, a null reference is returned.
Result<GNodeSelector<BASE::MUTABLE> > FindChild | ( | const InternedId & | name, |
NODE_KIND | mask | ||
) | const |
Finds a child with the given name or kind. If name is given, this returns the first direct child of this node which has the identifier name and whose kind matches the mask. If name is empty, the function returns the first direct child with matching kind (in this case children whose identifiers start with a dot are ignored).
[in] | name | The identifier to look for. |
[in] | mask | A mask for the node kind. |
Result<typename NODE::template Selector<BASE::MUTABLE> > FindInnerNode | ( | const PathBlock & | relativePath | ) | const |
Finds the inner child of this g-node with the given relative path. If no such child can be found, a null node is returned.
NODE | The expected node type (such as Node or MutablePort). |
[in] | relativePath | The relative path of the child to find, starting at this node. |
Result<Bool> GetInnerNodes | ( | NODE_KIND | mask, |
Bool | includeThis, | ||
const ValueReceiver< const GNodeSelector< BASE::MUTABLE > & > & | receiver | ||
) | const |
Yields all inner nodes of this g-node matching #mask in pre-order. The recursive traversal stops at nodes which don't match #mask.
[in] | mask | Mask to filter the tree traversal. Only nodes matching this mask are considered. The node on which GetInnerNodes is called isn't checked for mask. |
[in] | includeThis | If true, the node on which GetInnerNodes is called is yielded to #receiver too. |
[in] | receiver | Inner nodes are reported to this value receiver. |
const NodeSystem& GetBase | ( | ) | const |
Returns the base node system of this node (or in other words, the node system of which this node is an instance).
B
is A
and the base of E
is D
. A
, C
and D
have no bases.n
of C
, m/n
of D
as well as m/n
of E
is B
. The base node system of the node m
of D
and of E
is C
.@graph +-D-----------—+ +-E-----------—+ +-C-------—+ | +-m-------—+ | | +-m-------—+ | +-A---—+ +-B---—+ | +-n---—+ | | | +-n---—+ | | | | +-n---—+ | | | |<- - -| |<- - - -| | |<- - - -| | | | |<- - -| | | | | | +-----—+ +-----—+ | +-----—+ | | | +-----—+ | | | | +-----—+ | | +---------—+ | +---------—+ | | +---------—+ | +-------------—+ +-------------—+ @endgraph If this node is not a true node but a port or port list, the base of the enclosing true node is returned.
const Block<const NodeSystem>& GetBases | ( | ) | const |
Returns the base node systems of which this node is an instance. The entry at index 0 refers to the node system of which this node has been created as instance by CreateInstance(), this will be a null reference if the node systems hasn't been created this way. It's the same as the node system returned by GetBase(). The remaining entries list the bases which have been added by AddBase().
Result<Bool> GetAllBases | ( | const ValueReceiver< const NodeSystem & > & | receiver | ) | const |
Recursively finds all the bases of the node.
[in] | receiver | ValueReceiver or Array that will receive all the base NodeSystem found. |
const NodeTemplate& GetTemplate | ( | ) | const |
Returns the NodeTemplate which instantiated this node. For a root node, this is the template of the root's node system. Otherwise it is the template of the base of this node.
Result<Bool> GetAllTemplates | ( | const ValueReceiver< const NodeTemplate & > & | receiver | ) | const |
Returns the NodeTemplate which instantiated this node also those from all the bases.
[in] | receiver | ValueReceiver or Array that will receive all the NodeTemplate found. |
const NodeSystemDerivationHandler& GetDerivationHandler | ( | ) | const |
Returns the derivation handler of this node.