GraphNodeFunctions< BASE > Class Template Reference

#include <graph.h>

Inheritance diagram for GraphNodeFunctions< BASE >:

Detailed Description

template<typename BASE>
class maxon::GraphNodeFunctions< BASE >

Base class of GraphNode and Result<GraphNode> which implements most GraphNode functions.

Public Member Functions

 GraphNodeFunctions ()=default
 
template<typename ARG >
 GraphNodeFunctions (ARG &&arg)
 
Result< void > Remove () const
 
Result< BoolGetChildren (const ValueReceiver< const GraphNode & > &callback, NODE_KIND mask=NODE_KIND::ALL_MASK) const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeGetParent () const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeGetAncestor (NODE_KIND mask) const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeGetInputs () const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeGetOutputs () const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeGetPortList (PORT_DIR dir) const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeFindChild (const InternedId &name) const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeFindChild (const Id &name) const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeFindChild (NODE_KIND mask) const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeFindPort (const InternedId &name) const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeFindInnerNode (const PathBlock &relativePath) const
 
Result< BoolGetInnerNodes (NODE_KIND mask, Bool includeThis, const ValueReceiver< const GraphNode & > &receiver) const
 
Result< typename SFINAEHelper< GraphNode, BASE >::typeAddPort (const Id &name) const
 
Result< BaseArray< typename SFINAEHelper< GraphNode, BASE >::type > > AddPorts (Int index, Int count) const
 
Result< void > RemovePorts (const Block< const InternedId > &ports) const
 
Result< BoolGetConnections (PORT_DIR dir, const ValueReceiver< const GraphConnection & > &conns, Wires mask=Wires::All(), GraphModelInterface::GET_CONNECTIONS_MODE mode=GraphModelInterface::GET_CONNECTIONS_MODE::CONNECTIONS) const
 
Result< WiresGetWires (const GraphNode &target) const
 
Result< BoolGetConnectionValues (const GraphNode &target, const ValueReceiver< CONNECTION_POSITION, InternedId, const ConstDataPtr & > &receiver) const
 
Result< ConstDataPtrGetConnectionValue (const GraphNode &target, CONNECTION_POSITION position, const InternedId &attr, const DataType &expectedType, Bool reverse=false) const
 
template<typename T >
Result< Opt< const T & > > GetConnectionValue (const GraphNode &target, CONNECTION_POSITION position, const InternedId &attr, Bool reverse=false) const
 
template<typename ATTR >
Result< Opt< const typename ATTR::ValueType & > > GetConnectionValue (const GraphNode &target, CONNECTION_POSITION position, const ATTR &attr, Bool reverse=false) const
 
Result< BoolSetConnectionValue (const GraphNode &target, CONNECTION_POSITION position, const InternedId &attr, ForwardingDataPtr &&value) const
 
template<typename ATTR >
Result< BoolSetConnectionValue (const GraphNode &target, CONNECTION_POSITION position, const ATTR &attr, const typename ATTR::ValueType &value) const
 
template<typename ATTR >
Result< BoolSetConnectionValue (const GraphNode &target, CONNECTION_POSITION position, const ATTR &attr, typename ATTR::ValueType &&value) const
 
Result< void > Connect (const GraphNode &target, Wires modes=WIRE_MODE::CONNECT_DEFAULT, Bool reverse=false) const
 
Result< void > Connect (const Result< typename SFINAEHelper< GraphNode, BASE >::type > &target, Wires modes=WIRE_MODE::CONNECT_DEFAULT, Bool reverse=false) const
 
Result< void > RemoveConnections (PORT_DIR dir, Wires mask=Wires::All(WIRE_MODE::FULL_MASK)) const
 
Result< BoolIsConnectable (const GraphNode &target) const
 
Result< void > GetValues (GraphAttributeInterface::FLAGS mask, GraphAttributeMap &map) const
 
Result< BoolRemoveValue (const InternedId &attr) const
 
Result< BoolInheritValue (const InternedId &attr) const
 
Result< ConstDataPtrGetValue (const InternedId &attr, const DataType &expectedType) const
 
Result< ConstDataPtrGetStoredValue (const InternedId &attr, const DataType &expectedType) const
 
Result< BoolGetBaseValues (const InternedId &attr, const DataType &expectedType, const ValueReceiver< const ConstDataPtr &, Int > &valueReceiver) const
 
template<typename T >
Result< Opt< const T & > > GetValue (const InternedId &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) const
 
template<typename ATTR >
Result< Opt< const typename ATTR::ValueType & > > GetStoredValue () const
 
template<typename ATTR >
Result< Opt< const typename ATTR::ValueType & > > GetStoredValue (const ATTR &attr) const
 
Result< BoolSetValue (const InternedId &attr, ForwardingDataPtr &&value, Bool checkAndInvalidate=true) const
 
template<typename ATTR >
Result< BoolSetValue (const ATTR &attr, const typename ATTR::ValueType &value) const
 
template<typename ATTR >
Result< BoolSetValue (const ATTR &attr, typename ATTR::ValueType &&value) const
 
template<typename ATTR >
Result< BoolSetValue (const typename ATTR::ValueType &value) const
 
template<typename ATTR >
Result< BoolSetValue (typename ATTR::ValueType &&value) const
 
Result< void > TouchValue (const InternedId &attr) const
 
Result< void > ChangeValue (const InternedId &attr, const SubDataOperation &op, const SubDataPathBlock &path, ForwardingDataPtr &&value)
 
template<typename T >
Result< BoolSetDefaultValue (T &&value) 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< BoolGetAttributeModificationsSince (TimeStamp stamp, const ValueReceiver< InternedId, ConstDataPtr > &receiver) const
 
Result< TimeStampGetAttributeStamp (const InternedId &attr) const
 
Result< TimeStampGetConnectionStamp (PORT_DIR direction) const
 
Result< void > CopyValuesFrom (const GraphNode &source, Bool includeInner) const
 
Result< void > CopyConnectionsFrom (const GraphNode &source, PORT_DIR direction, Bool includeInner) const
 
Result< GraphAttribute::FLAGS > GetMessageFlags (const InternedId &attr) const
 
Result< BoolGetMessages (const InternedId &attr, const ValueReceiver< const GraphMessage & > &receiver) const
 

Constructor & Destructor Documentation

◆ GraphNodeFunctions() [1/2]

GraphNodeFunctions ( )
default

◆ GraphNodeFunctions() [2/2]

GraphNodeFunctions ( ARG &&  arg)
explicit

Member Function Documentation

◆ Remove()

Result<void> Remove ( ) const

Removes this node from the graph. This will also remove all nested nodes as well as connections of this node and its nested ports.

Returns
OK on success.

◆ GetChildren()

Result<Bool> GetChildren ( const ValueReceiver< const GraphNode & > &  callback,
NODE_KIND  mask = NODE_KIND::ALL_MASK 
) const

Gets all children of this node. For a true node this will be its child nodes as well as a single input port list and a single output port list. Otherwise, the children are ports.

Parameters
[in]callbackThis callback will receive all children.
Returns
false if callback cancelled further evaluation, true otherwise.

◆ GetParent()

Result<typename SFINAEHelper<GraphNode, BASE>::type> GetParent ( ) const

Returns the parent of this node.

Returns
Parent node of this node, or a null node if this node is the root node.

◆ GetAncestor()

Result<typename SFINAEHelper<GraphNode, BASE>::type> GetAncestor ( NODE_KIND  mask) const

Returns the closest ancestor node of this node (possibly this node itself) whose kind matches the given #mask. I.e., the function goes upwards in the hierarchy until it finds a matching node.

Parameters
[in]maskMask for the kind of node to look for.
Returns
Closest ancestor of this node matching the given #mask, may be this node itself or a null node.

◆ GetInputs()

Result<typename SFINAEHelper<GraphNode, BASE>::type> GetInputs ( ) const

Returns the input port list of this node. All top-level input ports of a node can be found as children of its input port list.

Returns
Input port list of this node.

◆ GetOutputs()

Result<typename SFINAEHelper<GraphNode, BASE>::type> GetOutputs ( ) const

Returns the output port list of this node. All top-level output ports of a node can be found as children of its output port list.

Returns
Output port list of this node.

◆ GetPortList()

Result<typename SFINAEHelper<GraphNode, BASE>::type> GetPortList ( PORT_DIR  dir) const

Returns the input or output port list of this node, depending on dir.

Parameters
[in]dirPORT_DIR::INPUT to return the input port list, PORT_DIR::OUTPUT to return the output port list.
Returns
Port list of this node.

◆ FindChild() [1/3]

Result<typename SFINAEHelper<GraphNode, BASE>::type> FindChild ( const InternedId name) const

Finds a child with the given id. This searches all direct children (whether nodes, port lists or ports) of this node for a child which has the identifier name. The first found child is returned.

Parameters
[in]nameThe identifier to look for.
Returns
The first direct child whose id is name, or a null node.

◆ FindChild() [2/3]

Result<typename SFINAEHelper<GraphNode, BASE>::type> FindChild ( const Id name) const

Finds a child with the given id. This searches all direct children (whether nodes, port lists or ports) of this node for a child which has the identifier name. The first found child is returned.

Parameters
[in]nameThe identifier to look for.
Returns
The first direct child whose id is name, or a null node.

◆ FindChild() [3/3]

Result<typename SFINAEHelper<GraphNode, BASE>::type> FindChild ( NODE_KIND  mask) const

Finds the child of this node whose kind matches the given #mask. If no such child can be found, a null node is returned. If there is more than one matching child, an error is returned.

Parameters
[in]maskKind mask to look for.
Returns
A direct child of this node which matches the given #mask, or a null node if no such child exists.

◆ FindPort()

Result<typename SFINAEHelper<GraphNode, BASE>::type> FindPort ( const InternedId name) const

Finds a child port with the given id. This searches all direct children of this node for a child which is a port and has the identifier name. The first found child is returned.

Parameters
[in]nameThe identifier to look for.
Returns
The first direct child port whose id is name, or a null node.

◆ FindInnerNode()

Result<typename SFINAEHelper<GraphNode, BASE>::type> FindInnerNode ( const PathBlock relativePath) const

Finds the inner child of this node with the given relative path. If no such child can be found, a null node is returned.

Parameters
[in]relativePathThe relative path of the child to find, starting at this node.
Returns
The inner child of this node with the given relativePath, or a null node if no such child exists.

◆ GetInnerNodes()

Result<Bool> GetInnerNodes ( NODE_KIND  mask,
Bool  includeThis,
const ValueReceiver< const GraphNode & > &  receiver 
) const

Yields all inner nodes of this node matching #mask in pre-order. The recursive traversal stops at nodes which don't match #mask.

Parameters
[in]maskMask 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]includeThisIf true, the node on which GetInnerNodes is called is yielded to #receiver too.
[in]receiverInner nodes are reported to this value receiver.
Returns
false if #receiver cancelled further evaluation, true otherwise.

◆ AddPort()

Result<typename SFINAEHelper<GraphNode, BASE>::type> AddPort ( const Id name) const

Adds a port to this node with the given id. This node has to be a port list or a port itself.

Parameters
[in]nameThe identifier for the new port.
Returns
The added port.

◆ AddPorts()

Result<BaseArray<typename SFINAEHelper<GraphNode, BASE>::type> > AddPorts ( Int  index,
Int  count 
) const

Adds a number of variadic port instances to this variadic port. This is more efficient than a repeated call to AddPort(). It is an error if this GraphNode is no variadic port.

Parameters
[in]indexThe index within the current list of variadic port instances where the new instances shall be added.
[in]countThe number of instances to add.
Returns
The newly added port instances as an array.

◆ RemovePorts()

Result<void> RemovePorts ( const Block< const InternedId > &  ports) const

Removes a number of variadic port instances from this variadic port. This is more efficient than a repeated call to Remove() on each of the instances. It is an error if this GraphNode is no variadic port.

Parameters
[in]portsThe identifiers of the port instances which shall be removed.

◆ GetConnections()

Yields all connections of this port for the given direction #dir. Depending on the graph model implementation, this may include implicit wires due to connections between enclosing ports. The latter are marked with WIRE_MODE::IMPLICIT.

Parameters
[in]dirWhether to yield incoming or outgoing connections.
[in]connsThe receiver for the found connections.
[in]maskOnly yield connections whose wires match this mask.
[in]modeMode for GetConnections.
Returns
false if #conns cancelled further evaluation, true otherwise.

◆ GetWires()

Result<Wires> GetWires ( const GraphNode target) const

Returns the Wires from this node to #target. Depending on the graph model implementation, this may include implicit wires due to connections between enclosing nodes. The latter are marked with WIRE_MODE::IMPLICIT.

Parameters
[in]targetAnother graph node.
Returns
Wires between from this node to #target.

◆ GetConnectionValues()

Result<Bool> GetConnectionValues ( const GraphNode target,
const ValueReceiver< CONNECTION_POSITION, InternedId, const ConstDataPtr & > &  receiver 
) const

Gets all attribute values of the connection from this port to target.

Parameters
[in]targetThe other end of the connection.
[out]receiverAll attribute values of the connection will be reported to the receiver.
Returns
false if #receiver cancelled further evaluation, true otherwise.

◆ GetConnectionValue() [1/3]

Result<ConstDataPtr> GetConnectionValue ( const GraphNode target,
CONNECTION_POSITION  position,
const InternedId attr,
const DataType expectedType,
Bool  reverse = false 
) const

Gets the value of the given attribute for the connection from this port to target. If there is no such connection, the connection has no value for the attribute or the value doesn't have the expected type, a null ConstDataPtr is returned.

Parameters
[in]targetThe other end of the connection.
[in]positionThe connection position at which the attribute's value shall be obtained.
[in]attrThe attribute whose value shall be obtained.
[in]expectedTypeThe expected type of the attribute value, may be nullptr if no check shall be done.
[in]reverseTrue if the connection shall be from target to this port (also #position is reversed in this case), false otherwise (the default).
Returns
The attribute value of the connection, or a null ConstDataPtr.

◆ GetConnectionValue() [2/3]

Result<Opt<const T&> > GetConnectionValue ( const GraphNode target,
CONNECTION_POSITION  position,
const InternedId attr,
Bool  reverse = false 
) const

Gets the value of the given attribute for the connection from this port to target. If there is no such connection, the connection has no value for the attribute or the value doesn't have the expected type, an empty Opt is returned.

Parameters
[in]targetThe other end of the connection.
[in]positionThe connection position at which the attribute's value shall be obtained.
[in]attrThe attribute whose value shall be obtained.
[in]reverseTrue if the connection shall be from target to this port (also #position is reversed in this case), false otherwise (the default).
Returns
The attribute value of the connection, may be an empty Opt.

◆ GetConnectionValue() [3/3]

Result<Opt<const typename ATTR::ValueType&> > GetConnectionValue ( const GraphNode target,
CONNECTION_POSITION  position,
const ATTR &  attr,
Bool  reverse = false 
) const

Gets the value of the given attribute #attr for the connection from this port to target. If there is no such connection, the connection has no value for the attribute or the value doesn't have the expected type, an empty Opt is returned.

Parameters
[in]attrThe attribute whose value shall be set.
[in]targetThe other end of the connection.
[in]positionThe connection position at which the attribute's value shall be obtained.
[in]reverseTrue if the connection shall be from target to this port (also #position is reversed in this case), false otherwise (the default).
Returns
The attribute value of the connection, may be an empty Opt.

◆ SetConnectionValue() [1/3]

Result<Bool> SetConnectionValue ( const GraphNode target,
CONNECTION_POSITION  position,
const InternedId attr,
ForwardingDataPtr &&  value 
) const

Sets the value of #attr to value for the connection from this port to #target. This will override any previously existing value.

Parameters
[in]targetThe other end of the connection.
[in]positionThe connection position at which the attribute's value shall be set.
[in]attrThe attribute whose value shall be set.
[in]valueThe value for the attribute.
Returns
True if the value has been changed.

◆ SetConnectionValue() [2/3]

Result<Bool> SetConnectionValue ( const GraphNode target,
CONNECTION_POSITION  position,
const ATTR &  attr,
const typename ATTR::ValueType &  value 
) const

Sets the value of #ATTR to value for this node. This will override any previously existing value.

Parameters
[in]attrThe attribute whose value shall be set.
[in]targetThe other end of the connection.
[in]positionThe connection position at which the attribute's value shall be set.
[in]valueThe value for the attribute.
Returns
True if the value has been changed.

◆ SetConnectionValue() [3/3]

Result<Bool> SetConnectionValue ( const GraphNode target,
CONNECTION_POSITION  position,
const ATTR &  attr,
typename ATTR::ValueType &&  value 
) const

Sets the value of #ATTR to value for this node. This will override any previously existing value.

Parameters
[in]attrThe attribute whose value shall be set.
[in]targetThe other end of the connection.
[in]positionThe connection position at which the attribute's value shall be set.
[in]valueThe value for the attribute.
Returns
True if the value has been changed.

◆ Connect() [1/2]

Result<void> Connect ( const GraphNode target,
Wires  modes = WIRE_MODE::CONNECT_DEFAULT,
Bool  reverse = false 
) const

Connects this port to the other port #target using the given wire #modes. Usually you use one of the values WIRE_MODE::MIN, WIRE_MODE::NORMAL, WIRE_MODE::MAX for #modes, then a connection with a value wire of the given priority is created from this port to the #target port. But you can also add dependency and event wires by using an appropriate Wires value for #modes. And for each wire you can specify one of the special wire modes:

Typically, you connect an output port of a root child node to an input port of another root child node. But you can also connect

  • an output port of a root child node to an output port of the root node (to forward the output of the child node to the root node)
  • an input port of the root node to an input port of a root child node, (to forward the input of the root node to the child node)
  • an input port of the root node to an output port of the same root node (to forward the input directly to the output without changing anything).

It is not possible to connect ports which don't belong to the root node or its direct children.

Parameters
[in]targetThe target port to connect to.
[in]modesThe type to use for the connection.
[in]reverseIf true the direction is reversed (from target to this port).
Returns
OK on success.

◆ Connect() [2/2]

Result<void> Connect ( const Result< typename SFINAEHelper< GraphNode, BASE >::type > &  target,
Wires  modes = WIRE_MODE::CONNECT_DEFAULT,
Bool  reverse = false 
) const

Connects this port to the other port #target using the given wire #modes. Usually you use one of the values WIRE_MODE::MIN, WIRE_MODE::NORMAL, WIRE_MODE::MAX for #modes, then a connection with a value wire of the given priority is created from this port to the #target port. But you can also add dependency and event wires by using an appropriate Wires value for #modes. And for each wire you can specify one of the special wire modes:

Typically, you connect an output port of a root child node to an input port of another root child node. But you can also connect

  • an output port of a root child node to an output port of the root node (to forward the output of the child node to the root node)
  • an input port of the root node to an input port of a root child node, (to forward the input of the root node to the child node)
  • an input port of the root node to an output port of the same root node (to forward the input directly to the output without changing anything).

It is not possible to connect ports which don't belong to the root node or its direct children.

Parameters
[in]targetThe target port to connect to.
[in]modesThe type to use for the connection.
[in]reverseIf true the direction is reversed (from target to this port).
Returns
OK on success.

◆ RemoveConnections()

Result<void> RemoveConnections ( PORT_DIR  dir,
Wires  mask = Wires::All(WIRE_MODE::FULL_MASK) 
) const

Removes all connections of this port in the given direction which match the given mask.

Parameters
[in]dirConnection direction.
[in]maskMask for the connections to remove.

◆ IsConnectable()

Result<Bool> IsConnectable ( const GraphNode target) const

Checks if a connection from this port to target can be made.

Parameters
[in]targetTarget port of the (hypothetical) connection.
Returns
True if a connection is allowed, false otherwise.

◆ GetValues()

Result<void> GetValues ( GraphAttributeInterface::FLAGS  mask,
GraphAttributeMap map 
) const

Gets all attribute values of this node.

Parameters
[out]mapAll attribute values of this node will be added to #map.
Returns
OK on success.

◆ RemoveValue()

Result<Bool> RemoveValue ( const InternedId attr) const

Removes an attribute value from this node. Nothing happens if this node doesn't have a value for the given attribute.

Parameters
[in]attrThe attribute whose value shall be removed from this node.
Returns
True if the value has been changed.

◆ InheritValue()

Result<Bool> InheritValue ( const InternedId attr) const

Restores the inherited state of the value for #attr. This removes any value which has been set directly in this graph.

Parameters
[in]attrThe attribute whose value shall be inherited from the base graph.

◆ GetValue() [1/4]

Result<ConstDataPtr> GetValue ( const InternedId attr,
const DataType expectedType 
) const

Gets the value of the given attribute for this node. If this node doesn't have a value for the attribute or the value doesn't have the expected type, a null ConstDataPtr is returned.

Parameters
[in]attrThe attribute whose value shall be obtained.
[in]expectedTypeThe expected type of the attribute value, may be nullptr if no check shall be done.
Returns
The attribute value of this node, or a null ConstDataPtr.

◆ GetStoredValue() [1/3]

Result<ConstDataPtr> GetStoredValue ( const InternedId attr,
const DataType expectedType 
) const

Gets the current value of the given attribute for this node, REGARDLESS of whether it is valid or not. If using lazy updates then this may be out of date. If NOT using lazy updates then this should always match GetValue(). If this node doesn't have a value for the attribute or the value doesn't have the expected type, a null ConstDataPtr is returned.

Parameters
[in]attrThe attribute whose value shall be obtained.
[in]expectedTypeThe expected type of the attribute value, may be nullptr if no check shall be done.
Returns
The attribute value of this node, or a null ConstDataPtr.

◆ GetBaseValues()

Result<Bool> GetBaseValues ( const InternedId attr,
const DataType expectedType,
const ValueReceiver< const ConstDataPtr &, Int > &  valueReceiver 
) const

Gets the values of the given attribute for this node and its inherited parents. If this node doesn't have a value for the attribute or the value doesn't have the expected type, GetBaseValues will keep iterating the inherited nodes and call #valueReceiver each time the attribute is found on an a base.

Parameters
[in]attrThe attribute whose value shall be obtained.
[in]expectedTypeThe expected type of the attribute value, may be nullptr if no check shall be done.
[in]valueReceiverA callback which receives the attribute values and their nestings.
Returns
The attribute values.

◆ GetValue() [2/4]

Result<Opt<const T&> > GetValue ( const InternedId attr) const

Gets the value of the given attribute for this node. If this node doesn't have a value for the attribute or the value doesn't have type T, an empty Opt is returned.

Parameters
[in]attrThe attribute whose value shall be obtained.
Template Parameters
TThe expected type of the attribute value.
Returns
The attribute value of this node, may be an empty Opt.

◆ GetValue() [3/4]

Result<Opt<const typename ATTR::ValueType&> > GetValue ( void  ) const

Gets the value of the given attribute #ATTR for this node. If this node doesn't have a value for the attribute of the correct type, an empty Opt is returned.

String name = port.GetValue<decltype(Name)>().GetValueOrNull() iferr_return;
#define Name(a0, a1, a2, a3, a4, a5, a6)
Definition: Python-ast.h:644
const char const char * name
Definition: abstract.h:195
Definition: c4d_string.h:39
#define iferr_return
Definition: resultbase.h:1465
Template Parameters
ATTRThe attribute whose value shall be obtained.
Returns
The attribute value of this node, may be an empty Opt.

◆ GetValue() [4/4]

Result<Opt<const typename ATTR::ValueType&> > GetValue ( const ATTR &  attr) const

Gets the value of the given attribute #attr for this node. If this node doesn't have a value for the attribute of the correct type, an empty Opt is returned.

String name = port.GetValue(Name).GetValueOrNull() iferr_return;
Parameters
[in]attrThe attribute whose value shall be obtained.
Returns
The attribute value of this node, may be an empty Opt.

◆ GetStoredValue() [2/3]

Result<Opt<const typename ATTR::ValueType&> > GetStoredValue ( ) const

Gets the current value of the given attribute for this node, REGARDLESS of whether it is valid or not. If using lazy updates then this may be out of date. If NOT using lazy updates then this should always match GetValue(). If this node doesn't have a value for the attribute of the correct type, an empty Opt is returned.

String name = port.GetStoredValue<decltype(Name)>().GetValueOrNull() iferr_return;
Template Parameters
ATTRThe attribute whose value shall be obtained.
Returns
The attribute value of this node, may be an empty Opt.

◆ GetStoredValue() [3/3]

Result<Opt<const typename ATTR::ValueType&> > GetStoredValue ( const ATTR &  attr) const

Gets the current value of the given attribute for this node, REGARDLESS of whether it is valid or not. If using lazy updates then this may be out of date. If NOT using lazy updates then this should always match GetValue(). If this node doesn't have a value for the attribute of the correct type, an empty Opt is returned.

String name = port.GetStoredValue(Name).GetValueOrNull() iferr_return;
Parameters
[in]attrThe attribute whose value shall be obtained.
Returns
The attribute value of this node, may be an empty Opt.

◆ SetValue() [1/5]

Result<Bool> SetValue ( const InternedId attr,
ForwardingDataPtr &&  value,
Bool  checkAndInvalidate = true 
) const

Sets the value of #attr to value for this node. This will override any previously existing value.

Parameters
[in]attrThe attribute whose value shall be set.
[in]valueThe value for the attribute.
[in]checkAndInvalidateTrue by default. Use false to suppress check, invalidation and update of time stamp. False may only be used for attributes which aren't needed during validation.
Returns
True if the value has been changed.

◆ SetValue() [2/5]

Result<Bool> SetValue ( const ATTR &  attr,
const typename ATTR::ValueType &  value 
) const

Sets the value of #attr to value for this node. This will override any previously existing value.

Parameters
[in]attrThe attribute whose value shall be set.
[in]valueThe value for the attribute.
Returns
True if the value has been changed.

◆ SetValue() [3/5]

Result<Bool> SetValue ( const ATTR &  attr,
typename ATTR::ValueType &&  value 
) const

Sets the value of #attr to value for this node. This will override any previously existing value.

Parameters
[in]attrThe attribute whose value shall be set.
[in]valueThe value for the attribute.
Returns
True if the value has been changed.

◆ SetValue() [4/5]

Result<Bool> SetValue ( const typename ATTR::ValueType &  value) const

Sets the value of #ATTR to value for this node. This will override any previously existing value.

Template Parameters
ATTRThe attribute whose value shall be set.
Parameters
[in]valueThe value for the attribute.
Returns
True if the value has been changed.

◆ SetValue() [5/5]

Result<Bool> SetValue ( typename ATTR::ValueType &&  value) const

Sets the value of #ATTR to value for this node. This will override any previously existing value.

Template Parameters
ATTRThe attribute whose value shall be set.
Parameters
[in]valueThe value for the attribute.
Returns
True if the value has been changed.

◆ TouchValue()

Result<void> TouchValue ( const InternedId attr) const

Marks the value of #attr as modified without actually modifying it. Use this if the value points to some external data which has changed without knowledge of the graph (for example a Url for a file which has been modified). If there is no value yet for attr, an IllegalStateError is returned.

Parameters
[in]attrThe attribute which shall be marked as modified.
Returns
OK on success.

◆ ChangeValue()

Result<void> ChangeValue ( const InternedId attr,
const SubDataOperation &  op,
const SubDataPathBlock path,
ForwardingDataPtr &&  value 
)

Sets a part of the value of #attr to value for this node.

Parameters
[in]attrThe attribute whose value shall be set.
[in]opThe SubDataOperation to use.
[in]pathThe path to the part of the attribute value which shall be changed.
[in]valueThe new value for the part.
Returns
OK on success.

◆ SetDefaultValue()

Result<Bool> SetDefaultValue ( T &&  value) const

Sets the value of the attribute DESCRIPTION::DATA::BASE::DEFAULTVALUE to value for this port. This will override any values which would otherwise be inherited from a base port.

Parameters
[in]valueThe value for the DefaultValue attribute.
Returns
True if the value has been changed.

◆ GetDefaultValue()

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.

Template Parameters
TThe type to return.
Parameters
[in]defThe value to return when there is no default value of matching type.
Returns
The default value of this port.

◆ GetConstantValue()

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.

Template Parameters
TThe type to return.
Parameters
[in]defThe value to return when there is no constant value of matching type.
Returns
The constant value of this port.

◆ GetAttributeModificationsSince()

Result<Bool> GetAttributeModificationsSince ( TimeStamp  stamp,
const ValueReceiver< InternedId, ConstDataPtr > &  receiver 
) const

Reports all attribute modifications which have been made for this 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().

See also
GraphModelInterface::GetModificationsSince
Parameters
[in]stampA reference time stamp. Only modifications newer than this stamp are reported.
[in]receiverModifications are reported to this receiver as a pair of the attribute identifier and the current value.
Returns
false if the receiver cancelled further evaluation, true otherwise.

◆ GetAttributeStamp()

Result<TimeStamp> GetAttributeStamp ( const InternedId attr) const

Returns the modification stamp of the given attribute for this node. This is the value of the graph's time stamp (see GraphModelInterface::GetModificationStamp) at the time when the attribute value has been set last for this node, or a null value if it hasn't been set at all.

Parameters
[in]attrAn attribute.
Returns
The modification stamp of the last change of the attribute value.

◆ GetConnectionStamp()

Result<TimeStamp> GetConnectionStamp ( PORT_DIR  direction) const

Returns the modification stamp of incoming/outgoing connections for this port. This is the value of the graph's time stamp (see GraphModelInterface::GetModificationStamp) at the time when connections in the given direction have been modified last for this port.

Parameters
[in]directionThe connection direction.
Returns
The modification stamp of the last connection change of the port.

◆ CopyValuesFrom()

Result<void> CopyValuesFrom ( const GraphNode source,
Bool  includeInner 
) const

Copies all directly set attribute values of source to this node. This excludes derived attribute values as well as attribute values which are inherited from a base.

Parameters
[in]sourceAnother GraphNode, may stem from a different graph.
[in]includeInnerIf true, copies attribute values for all inner nodes, too.

◆ CopyConnectionsFrom()

Result<void> CopyConnectionsFrom ( const GraphNode source,
PORT_DIR  direction,
Bool  includeInner 
) const

Copies all connections of source to the port given by this GraphNode. For each connection of source to a port in the given direction, a corresponding port in this graph is searched (based on the relative path) and, if it exists, a connection to that port is created.

Parameters
[in]sourceAnother GraphNode port, may stem from a different graph.
[in]directionThe direction of connections to copy.
[in]includeInnerIf true, copies connections for all inner nodes, too.

◆ GetMessageFlags()

Result<GraphAttribute::FLAGS> GetMessageFlags ( const InternedId attr) const

Returns the message flags of the given attribute at this node. You have to call this method if you want to check if an attribute has a message (an error or a warning) for this node.

Parameters
[in]attrThe attribute which shall be asked.
Returns
Message flags (GraphAttribute::FLAGS::WARNING, GraphAttribute::FLAGS::ERROR) of #attr at this node.
See also
GraphAttributeInterface::GetMessageFlags

◆ GetMessages()

Result<Bool> GetMessages ( const InternedId attr,
const ValueReceiver< const GraphMessage & > &  receiver 
) const

Yields the error or warning messages (if any) of the given attribute at this node to #receiver.

Parameters
[in]attrThe attribute which shall be asked.
[in]receiverAll messages are reported to this receiver.
Returns
false if the receiver cancelled further evaluation, true otherwise.