MutableGNodeFunctions< BASE > Class Template Reference

#include <nodesystem.h>

Inheritance diagram for MutableGNodeFunctions< BASE >:

Detailed Description

template<typename BASE>
class maxon::nodes::MutableGNodeFunctions< BASE >

This class template contains the functions of a general mutable g-node which shall also be available on Result<NODE>.

Public Member Functions

Result< void > Remove (Opt< ChangeList & > list={}) const
 
Result< void > InheritChild (const InternedId &childId, Opt< ChangeList & > list={}) const
 
Result< BoolInheritValue (const InternedId &attr, Opt< ChangeList & > list={}) const
 
Result< BoolRemoveValue (const InternedId &attr, Opt< ChangeList & > list={}) const
 
Result< BoolSetValue (const InternedId &attr, ForwardingDataPtr &&value, Opt< ChangeList & > list={}) const
 
template<typename ATTR >
Result< BoolSetValue (const ATTR &attr, const typename ATTR::ValueType &value, Opt< ChangeList & > list={}) const
 
template<typename ATTR >
Result< BoolSetValue (const ATTR &attr, typename ATTR::ValueType &&value, Opt< ChangeList & > list={}) const
 
template<typename ATTR >
Result< BoolSetValue (const typename ATTR::ValueType &value, Opt< ChangeList & > list={}) const
 
template<typename ATTR >
Result< BoolSetValue (typename ATTR::ValueType &&value, Opt< ChangeList & > list={}) const
 
Result< void > ChangeValue (const InternedId &attr, const SubDataOperation &op, const SubDataPathBlock &path, ForwardingDataPtr &&value, Opt< ChangeList & > list={}) const
 
Result< void > TouchValue (const InternedId &attr, Opt< ChangeList & > list={}) const
 
- Public Member Functions inherited from GNodeFunctions< BASE >
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< ConstDataPtrGetValue (const InternedId &attr, const DataType &expectedType) const
 
Result< ConstDataPtrGetValue (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< BoolGetBaseValues (const InternedId &attr, const DataType &expectedType, const ValueReceiver< const ConstDataPtr &, Int > &receiver) const
 
Result< BoolGetAttributeModificationsSince (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< BoolGetInnerNodes (NODE_KIND mask, Bool includeThis, const ValueReceiver< const GNodeSelector< BASE::MUTABLE > & > &receiver) const
 
const NodeSystemGetBase () const
 
const Block< const NodeSystem > & GetBases () const
 
Result< BoolGetAllBases (const ValueReceiver< const NodeSystem & > &receiver) const
 
const NodeTemplate & GetTemplate () const
 
Result< BoolGetAllTemplates (const ValueReceiver< const NodeTemplate & > &receiver) const
 
const NodeSystemDerivationHandler & GetDerivationHandler () const
 

Protected Types

using Super = GNodeFunctions< BASE >
 
- Protected Types inherited from GNodeFunctions< BASE >
using Super = BASE
 

Member Typedef Documentation

◆ Super

using Super = GNodeFunctions<BASE>
protected

Member Function Documentation

◆ Remove()

Result<void> Remove ( Opt< ChangeList & >  list = {}) const

Removes the referenced g-node from this node system. Internally how the removal is done depends on the situation:

  1. If the node is not defined by this node system, but inherited from a base, it is marked as removed in this node system, so effectively the inherited node is hidden.
  2. If the node is defined by this node system, the node definition is removed. If this makes an inherited node visible, the latter is marked as removed as in the first case.

Not all g-nodes can be removed:

  • Input or output port lists can never be removed.
  • Top-level ports can only be removed if they belong to the root node. There are no restrictions on nested ports.
  • True nodes can only be removed if they are direct children of the root node.
    Parameters
    [in]listAn optional ChangeList to track the changes.

◆ InheritChild()

Result<void> InheritChild ( const InternedId childId,
Opt< ChangeList & >  list = {} 
) const

Removes any data for the child node #childId of the referenced node from the node system so that the state of the child node is restored to an unmodified instance of its base node. If there is no base, the node ceases to exist in the current node system. This function only has an effect if modifications to the child node have been made at the level of the node system of this reference.

Parameters
[in]childIdThe identifier of the child of this node which shall be restored to its inherited state.
[in]listAn optional ChangeList to track the changes.

◆ InheritValue()

Result<Bool> InheritValue ( const InternedId attr,
Opt< ChangeList & >  list = {} 
) const

Restores the inherited state of the value for #attr. This removes any value which has been set in this node system. It will also annul the effect of a previous invocation of RemoveValue().

Parameters
[in]attrThe attribute whose value at this g-node shall be restored to the inherited state.
[in]listAn optional ChangeList to track the changes.
Returns
OK on success.
See also
RemoveValue

◆ RemoveValue()

Result<Bool> RemoveValue ( const InternedId attr,
Opt< ChangeList & >  list = {} 
) const

Removes an attribute value from this g-node. The node won't have a value for #attr afterwards, i.e., even if one of its bases has a value for #attr, this node doesn't inherit the value. The removal can be undone by calling InheritValue().

Parameters
[in]attrThe attribute whose value shall be removed from this g-node.
[in]listAn optional ChangeList to track the changes.
Returns
True if modified.
See also
InheritValue

◆ SetValue() [1/5]

Result<Bool> SetValue ( const InternedId attr,
ForwardingDataPtr &&  value,
Opt< ChangeList & >  list = {} 
) const

Sets the value of #attr to value for this g-node. This will override any value which would otherwise be inherited for the attribute from a base.

Parameters
[in]attrThe attribute whose value shall be set.
[in]valueThe new value for the attribute.
[in]listAn optional ChangeList to track the changes.
Returns
True if the value has been changed, false otherwise.

◆ SetValue() [2/5]

Result<Bool> SetValue ( const ATTR &  attr,
const typename ATTR::ValueType &  value,
Opt< ChangeList & >  list = {} 
) const

Sets the value of #attr to value for this g-node. This will override any value which would otherwise be inherited for the attribute from a base. Example:

MutablePort port;
port.SetValue(InheritNestedPorts, false) iferr_return;
#define iferr_return
Definition: resultbase.h:1524
Parameters
[in]attrThe attribute whose value shall be set.
[in]valueThe new value for the attribute.
[in]listAn optional ChangeList to track the changes.
Returns
True if the value has been changed, false otherwise.

◆ SetValue() [3/5]

Result<Bool> SetValue ( const ATTR &  attr,
typename ATTR::ValueType &&  value,
Opt< ChangeList & >  list = {} 
) const

Sets the value of #attr to value for this g-node. This will override any value which would otherwise be inherited for the attribute from a base. Example:

MutablePort port;
TypeAccess ta;
port.SetValue(FixedPortType, std::move(ta)) iferr_return;
Parameters
[in]attrThe attribute whose value shall be set.
[in]valueThe new value for the attribute, this will be moved into the g-node.
[in]listAn optional ChangeList to track the changes.
Returns
True if the value has been changed, false otherwise.

◆ SetValue() [4/5]

Result<Bool> SetValue ( const typename ATTR::ValueType &  value,
Opt< ChangeList & >  list = {} 
) const

Sets the value of ATTR to value for this g-node. This will override any value which would otherwise be inherited for the attribute from a base. Example:

MutablePort port;
port.SetValue<decltype(InheritNestedPorts)>(false) iferr_return;
Template Parameters
ATTRThe attribute whose value shall be set.
Parameters
[in]valueThe new value for the attribute.
[in]listAn optional ChangeList to track the changes.
Returns
True if the value has been changed, false otherwise.

◆ SetValue() [5/5]

Result<Bool> SetValue ( typename ATTR::ValueType &&  value,
Opt< ChangeList & >  list = {} 
) const

Sets the value of ATTR to value for this g-node. This will override any value which would otherwise be inherited for the attribute from a base. Example:

MutablePort port;
TypeAccess ta;
port.SetValue<decltype(FixedPortType)>(std::move(ta)) iferr_return;
Template Parameters
ATTRThe attribute whose value shall be set.
Parameters
[in]valueThe new value for the attribute, this will be moved into the g-node.
[in]listAn optional ChangeList to track the changes.
Returns
True if the value has been changed, false otherwise.

◆ ChangeValue()

Result<void> ChangeValue ( const InternedId attr,
const SubDataOperation &  op,
const SubDataPathBlock path,
ForwardingDataPtr &&  value,
Opt< ChangeList & >  list = {} 
) const

Sets a part of the value of #attr to value for this g-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.
[in]listAn optional ChangeList to track the changes.
Returns
OK on success.

◆ TouchValue()

Result<void> TouchValue ( const InternedId attr,
Opt< ChangeList & >  list = {} 
) 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 node system (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.
[in]listAn optional ChangeList to track the changes.
Returns
OK on success.