Open Search
    PortFunctions< BASE > Class Template Reference

    #include <nodesystem.h>

    Inheritance diagram for PortFunctions< BASE >:

    Detailed Description

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

    This class template contains the functions of Port which shall also be available on Result<Port> (and also for MutablePort).

    Public Types

    template<typename SUPER >
    using ResultFunctions = PortFunctions< maxon::nodes::details::GNodeResultBase< SUPER > >
     
    using Super = PortFunctionsSuper< BASE >
     

    Public Member Functions

    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)
     

    Private Types

    template<Bool MUT>
    using Selector = PortSelector< MUT >
     

    Static Private Attributes

    static const NODE_KIND KIND
     

    Member Typedef Documentation

    ◆ Selector

    using Selector = PortSelector<MUT>
    private

    ◆ ResultFunctions

    ◆ Super

    using Super = PortFunctionsSuper<BASE>

    Member Function Documentation

    ◆ GetParent()

    Result<PortListSelector<BASE::MUTABLE> > GetParent ( ) const

    Returns the parent node of this port. The parent node of a top-level port is a port list, the parent node of a nested port is a port, too. Therefore this function's return type is PortList which is a base class of Port.

    Returns
    Reference to parent port list or port.

    ◆ GetConnections()

    Result<Bool> GetConnections ( 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

    Yields all connections of this port for the given direction. This includes not only connections which have been added at the level of the node system of this reference, but also inherited connections from base node systems and implicit connections from enclosing ports. It does not include connections which have been marked as removed (see WIRE_MODE::REMOVE).

    Parameters
    [in]dirWhether to yield incoming or outgoing connections.
    [out]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 PortSelector< BASE::MUTABLE > &  target) const

    Returns the Wires which are present between this port (source) and target. Like GetConnections this includes connections which are inherited from a base node system and implicit connections from enclosing ports. It does not include connections which have been marked as removed (see WIRE_MODE::REMOVE).

    Parameters
    [in]targetThe target port.
    Returns
    The complete set of Wires from this port to target.

    ◆ GetConnectionValues()

    Result<Bool> GetConnectionValues ( const PortSelector< BASE::MUTABLE > &  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 PortSelector< BASE::MUTABLE > &  target,
    CONNECTION_POSITION  position,
    const InternedId attr,
    const DataType expectedType 
    ) 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.
    Returns
    The attribute value of the connection, or a null ConstDataPtr.

    ◆ GetConnectionValue() [2/3]

    Result<Opt<const T&> > GetConnectionValue ( const PortSelector< BASE::MUTABLE > &  target,
    CONNECTION_POSITION  position,
    const InternedId attr 
    ) 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.
    Returns
    The attribute value of the connection, may be an empty Opt.

    ◆ GetConnectionValue() [3/3]

    Result<Opt<const typename ATTR::ValueType&> > GetConnectionValue ( const PortSelector< BASE::MUTABLE > &  target,
    CONNECTION_POSITION  position,
    const ATTR &  attr 
    ) 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 obtained.
    [in]targetThe other end of the connection.
    [in]positionThe connection position at which the attribute's value shall be obtained.
    Returns
    The attribute value of the connection, may be an empty Opt.

    ◆ GetConnectionStamp()

    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.

    ◆ IsPortOfRoot()

    Bool IsPortOfRoot ( ) const

    Checks if this port is a port of the root node of a node system. This includes not only top-level ports, but also nested ports.

    Returns
    True if this port is a port of the root node, false otherwise.

    ◆ IsTopLevelPort()

    Bool IsTopLevelPort ( ) const

    Checks if this port is a top-level port. A top-level port is a port which is not nested within another port, but a direct child of the input or output port list of a node.

    Returns
    True if this port is a top-level port, false otherwise.

    ◆ GetTopologicalLayer()

    Int GetTopologicalLayer ( ) const

    Returns an Int value which corresponds to a topological layer index for this port. The connections within a node system build a directed acyclic graph, and the node system sets up a corresponding topological layering of all ports within MutableRoot::ValidateTopology(). Ports within the same layer aren't reachable from each other. Whenever port x can be reached from port y via a number of connections, the layer of x is greater than the layer of y. However the reverse is not true, so different layer indices don't imply reachability. You can use the fact that two ports are in the same layer for parallelization: In that case computations on these ports are usually independent.

    For the topplogical layering only top-level ports are considered, connections between nested ports are treated as if they were between their enclosing top-level ports. Therefore the layer of a nested port is the same as the layer of its enclosing port.

    Returns
    The index of the layer of this port (or its enclosing top-level port) in the topological layering, or a negative number if this port reference doesn't point to a valid port.

    ◆ InitFromPath()

    Result<void> InitFromPath ( typename PortFunctionsSuper< BASE >::NodeSystemCtorParam  system,
    PATH &&  path,
    NODE_KIND  check = NODE_KIND::PORT_MASK 
    )

    Initializes a g-node reference from a node system and a path. If there's no node in the node system for the given path, this reference is set to a null reference. If a node exists but its kind doesn't match the check mask, an IllegalArgumentError is returned.

    Parameters
    [in]systemThe node system to use.
    [in]pathA path which points to a g-node in the given node system.
    [in]checkA mask of the expected node kind(s).
    Returns
    Usually OK (even when path doesn't exist), but an IllegalArgumentError if path exists but doesn't match check.

    Member Data Documentation

    ◆ KIND

    const NODE_KIND KIND
    staticprivate