MutablePortFunctions< BASE > Class Template Reference

#include <nodesystem.h>

Inheritance diagram for MutablePortFunctions< BASE >:

Detailed Description

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

This class template contains the functions of MutablePortList which shall also be available on Result<MutablePortList>.

Public Types

template<typename SUPER >
using ResultFunctions = MutablePortFunctions< maxon::nodes::details::GNodeResultBase< SUPER > >
 
using Super = PortFunctions< BASE >
 
- Public Types inherited from PortFunctions< BASE >
template<typename SUPER >
using ResultFunctions = PortFunctions< maxon::nodes::details::GNodeResultBase< SUPER > >
 
using Super = PortFunctionsSuper< BASE >
 

Public Member Functions

Result< void > Connect (Result< MutablePort > &&target, Wires modes=WIRE_MODE::CONNECT_DEFAULT, Opt< ChangeList & > list={}) const
 
template<typename T >
Result< void > SetDefaultValue (T &&value) const
 
Result< void > SetType (const DataType &dataType) const
 
template<typename T >
Result< void > SetType () const
 
Result< BoolSetConnectionValue (const MutablePort &target, CONNECTION_POSITION position, const InternedId &attr, ForwardingDataPtr &&value, Opt< ChangeList & > list={}) const
 
template<typename ATTR >
Result< BoolSetConnectionValue (const MutablePort &target, CONNECTION_POSITION position, const ATTR &attr, const typename ATTR::ValueType &value, Opt< ChangeList & > list={}) const
 
template<typename ATTR >
Result< BoolSetConnectionValue (const MutablePort &target, CONNECTION_POSITION position, const ATTR &attr, typename ATTR::ValueType &&value, Opt< ChangeList & > list={}) const
 
- Public Member Functions inherited from PortFunctions< BASE >
Result< PortListSelector< BASE::MUTABLE > > GetParent () const
 
Result< BoolGetConnections (PORT_DIR dir, const ValueReceiver< const ConnectionSelector< BASE::MUTABLE > & > &conns, Wires mask=Wires::All(), NodeSystemInterface::GET_CONNECTIONS_MODE mode=NodeSystemInterface::GET_CONNECTIONS_MODE::CONNECTIONS) const
 
Result< WiresGetWires (const PortSelector< BASE::MUTABLE > &target) const
 
Result< BoolGetConnectionValues (const PortSelector< BASE::MUTABLE > &target, const ValueReceiver< CONNECTION_POSITION, InternedId, const ConstDataPtr & > &receiver) const
 
Result< ConstDataPtrGetConnectionValue (const PortSelector< BASE::MUTABLE > &target, CONNECTION_POSITION position, const InternedId &attr, const DataType &expectedType) const
 
template<typename T >
Result< Opt< const T & > > GetConnectionValue (const PortSelector< BASE::MUTABLE > &target, CONNECTION_POSITION position, const InternedId &attr) const
 
template<typename ATTR >
Result< Opt< const typename ATTR::ValueType & > > GetConnectionValue (const PortSelector< BASE::MUTABLE > &target, CONNECTION_POSITION position, const ATTR &attr) const
 
TimeStamp GetConnectionStamp (PORT_DIR direction) const
 
Bool IsPortOfRoot () const
 
Bool IsTopLevelPort () const
 
Int GetTopologicalLayer () const
 
template<typename PATH >
Result< void > InitFromPath (typename PortFunctionsSuper< BASE >::NodeSystemCtorParam system, PATH &&path, NODE_KIND check=NODE_KIND::PORT_MASK)
 

Member Typedef Documentation

◆ ResultFunctions

◆ Super

using Super = PortFunctions<BASE>

Member Function Documentation

◆ Connect()

Result<void> Connect ( Result< MutablePort > &&  target,
Wires  modes = WIRE_MODE::CONNECT_DEFAULT,
Opt< ChangeList & >  list = {} 
) 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.

It is not allowed to create a cycle in the graph. However the Connect function itself doesn't check this, it is done later during e.g. MutableRoot::Validate or MutableRoot::EndModification. Therefore it is possible to temporarily introduce a cycle and resolve this immediately afterwards by removing another connection.

Parameters
[in]targetThe target port to connect to. Result<MutablePort> is accepted and the error, if any, is forwarded.
[in]modesThe Wires to use for the connection.
[in]listAn optional ChangeList to track the changes.
Returns
OK on success.

◆ SetDefaultValue()

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

Sets the value of the DefaultValue attribute 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
OK on success.

◆ SetType() [1/2]

Result<void> SetType ( const DataType dataType) const

Sets the given #dataType as the value of the FixedPortType attribute.

Parameters
[in]dataTypeThe data type for this port.
Returns
OK on success.

◆ SetType() [2/2]

Result<void> SetType ( ) const

Sets the type T as the value of the FixedPortType attribute.

Template Parameters
TThe data type for this port.
Returns
OK on success.

◆ SetConnectionValue() [1/3]

Result<Bool> SetConnectionValue ( const MutablePort target,
CONNECTION_POSITION  position,
const InternedId attr,
ForwardingDataPtr &&  value,
Opt< ChangeList & >  list = {} 
) 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 MutablePort target,
CONNECTION_POSITION  position,
const ATTR &  attr,
const typename ATTR::ValueType &  value,
Opt< ChangeList & >  list = {} 
) 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 MutablePort target,
CONNECTION_POSITION  position,
const ATTR &  attr,
typename ATTR::ValueType &&  value,
Opt< ChangeList & >  list = {} 
) 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.