CoreNodeBaseInterface Class Reference

#include <corenodes.h>

Inheritance diagram for CoreNodeBaseInterface:

Detailed Description

CoreNodeBaseInterface is the common base interface of micro node groups, core node groups and their finalized version CoreNode. Each core node is either a group of other core nodes, or a group of micro nodes. Thus at the lowest level we always have micro nodes.

This class diagram shows the relationships: @graph +–CoreNodeBaseInterface----------------—+

---------------------------------------—
+GetId(): Id

,--------------------------—|>|+GetPortInfo(kind, index): PortInfo |<|-----------------—. | |+GetChild(index): CoreNodeInstanceBasePtr | | | +---------------------------------------—+ | | ^ ^ "1" | | - * | | | v | +–CoreNodeGroupInterface----------------------------—+ +-CoreNodeInterface---------—+ | +–MicroNodeGroupInterface-------------—+

----------------------------------------------------— ---------------------------— --------------------------------------—
+AddChild(name:Id, node:CoreNode): CoreNodeInstancePtr +AddChild<MN>(name:Id): MicroNodePtr<MN>

|+Finalize(): CoreNode | +---------------------------—+ | |+Finalize(): CoreNode | +----------------------------------------------------—+ | +--------------------------------------—+ ^ "1" ^ "1" | ^ "1"

  • | | "1..* * v | "base" +--CoreNodeInstanceBaseInterface----------------+ v <table class="markdownTable"> <tr class="markdownTableHead"> <th class="markdownTableHeadNone"> </th> <th class="markdownTableHeadNone"> .------------------</th> <th class="markdownTableHeadNone"> ></th> <th class="markdownTableHeadNone"> -----------------------------------------------</th> <th class="markdownTableHeadNone"> <</th> <th class="markdownTableHeadNone"> -----------.</th> </tr> <tr class="markdownTableRowOdd"> <td class="markdownTableBodyNone"> </td> <td class="markdownTableBodyNone"> </td> <td class="markdownTableBodyNone"> </td> <td class="markdownTableBodyNone"> +GetName(): Id</td> <td class="markdownTableBodyNone"> </td> <td class="markdownTableBodyNone">

| | | +--------------------------------------------—+ | | | | | | | | "1..*" | | | | "1..*" +–CoreNodeInstanceInterface---------------—+ +–MicroNodeInterface--------------—+

------------------------------------------— ----------------------------------—
+GetParentGroup(): CoreNodeGroupRef +GetParentGroup(): MicroNodeGroupRef
+GetBase(): CoreNode +GetImplementation(): MicroNode

+------------------------------------------—+ +----------------------------------—+ | "1" | | "1" +–MicroNode-----------------------—+

----------------------------------—
+GetNode(): MicroNodeInterface*

+----------------------------------—+ @endgraph

Public Types

using ErrorList = Array< Tuple< PortId, Error > >
 

Public Member Functions

const MAXON_METHOD IdGetId () const
 
MAXON_METHOD void SetId (const Id &name)
 
MAXON_METHOD CoreNodeFactory GetFactory () const
 
const MAXON_METHOD DataDictionary & GetArguments () const
 
MAXON_METHOD void InitFactory (const CoreNodeFactory &factory, const DataDictionary &args)
 
MAXON_METHOD Bool IsCoreNodeGroup () const
 
MAXON_METHOD Int GetChildCount () const
 
const MAXON_METHOD Interface::Instance * GetChild (Int index) const
 
MAXON_FUNCTION Interface::Instance * GetChild (Int index)
 
const MAXON_METHOD Interface::Instance * FindChild (const Id &name) const
 
MAXON_METHOD Int GetPortCount (PORT_DIR direction) const
 
MAXON_METHOD Int FindPortIndex (const PortId &port) const
 
MAXON_METHOD Result< IntFindValidPortIndex (const PortId &port) const
 
const MAXON_METHOD PortInfoGetPortInfo (const PortId &port) const
 
MAXON_METHOD Result< const PortInfo & > GetValidPortInfo (const PortId &port) const
 
MAXON_METHOD Result< IntAddPort (PORT_DIR direction, const Id &name, const DataType &type)
 
MAXON_METHOD Result< void > AddPassThrough (const InPortId &input, const OutPortId &output, WIRETYPE wires)
 
MAXON_METHOD Result< DataGetValue (const InternedId &attr) const
 
template<typename ATTR >
MAXON_FUNCTION Result< Opt< typename ATTR::ValueType > > GetValue (const ATTR &attr) const
 
MAXON_METHOD Result< void > SetValue (const InternedId &attr, ForwardingDataPtr &&value)
 
template<typename ATTR >
MAXON_FUNCTION Result< void > SetValue (const ATTR &attr, const typename ATTR::ValueType &value)
 
template<typename ATTR >
MAXON_FUNCTION Result< void > SetValue (const ATTR &attr, typename ATTR::ValueType &&value)
 
MAXON_METHOD HashValue GetHashValue () const
 
 MAXON_ATTRIBUTE_CLASS (Bool, Pure, "net.maxon.corenode.pure")
 
 MAXON_ATTRIBUTE_CLASS (maxon::corenodes::Optimizer, Optimizer, "net.maxon.corenode.optimizer")
 
 MAXON_ATTRIBUTE_CLASS (Id, NodeId, "net.maxon.corenode.nodeid")
 
 MAXON_ATTRIBUTE_CLASS (Data, Value, "net.maxon.corenode.value")
 
 MAXON_ATTRIBUTE_CLASS (DataType, Type, "net.maxon.corenode.type")
 
 MAXON_ATTRIBUTE_CLASS (Id, TypeId, "datatype")
 
 MAXON_ATTRIBUTE_CLASS (DataType, InType, "in")
 
 MAXON_ATTRIBUTE_CLASS (DataType, OutType, "out")
 
 MAXON_ATTRIBUTE_CLASS (DataType, SourceType, "net.maxon.corenode.sourcetype")
 
 MAXON_ATTRIBUTE_CLASS (BaseArray< Member >, Members, "net.maxon.corenode.members")
 
 MAXON_ATTRIBUTE_CLASS (Int, Count, "net.maxon.corenode.count")
 
 MAXON_ATTRIBUTE_CLASS (CONVERSION_FLAGS, ConversionFlags, "net.maxon.corenode.conversionflags")
 
 MAXON_ATTRIBUTE_CLASS (String, Message, "net.maxon.corenode.message")
 
 MAXON_ATTRIBUTE_CLASS (ErrorList, Errors, "net.maxon.corenode.errors")
 
 MAXON_ATTRIBUTE_CLASS (Id, VariableId, "net.maxon.corenode.variableid")
 
 MAXON_ATTRIBUTE_CLASS (Array< Id >, Filters, "net.maxon.corenode.filters")
 
MAXON_FUNCTION String ToString (const FormatStatement *fmt=nullptr) const
 

Private Types

using Instance = CoreNodeInstanceBaseInterface
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (CoreNodeBaseInterface, MAXON_REFERENCE_NORMAL, "net.maxon.corenode.interface.corenodebase")
 

Member Typedef Documentation

◆ Instance

This defines the covariant return type of GetChild

◆ ErrorList

using ErrorList = Array<Tuple<PortId, Error> >

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( CoreNodeBaseInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.corenode.interface.corenodebase"   
)
private

◆ GetId()

const MAXON_METHOD Id& GetId ( ) const

Returns the identifier of the core node.

Returns
Identifier of the core node.

◆ SetId()

MAXON_METHOD void SetId ( const Id name)

Sets the identifier of this core node. The identifier is used to derive names of instances of this node when they have no explicit name (such as "mynode.1" if the node has identifier "mynode").

Parameters
[in]nameThe identifier of the core node.

◆ GetFactory()

MAXON_METHOD CoreNodeFactory GetFactory ( ) const

Returns the factory which created this core node. When a core node has been created by a factory, an equivalent core node can be created by calling the factory again with the same arguments.

Returns
Factory which created this core node, or nullptr if it hasn't been created by a factory.

◆ GetArguments()

const MAXON_METHOD DataDictionary& GetArguments ( ) const

Returns the factory arguments which have been used to create this core node, see GetFactory().

Returns
Factory arguments for the creation of this core node.

◆ InitFactory()

MAXON_METHOD void InitFactory ( const CoreNodeFactory factory,
const DataDictionary &  args 
)

Sets the factory and factory arguments for this core node, see GetFactory().

Parameters
[in]factoryThe core node factory which created this core node.
[in]argsThe factory arguments used for creation of this core node.

◆ IsCoreNodeGroup()

MAXON_METHOD Bool IsCoreNodeGroup ( ) const

Checks if this CoreNodeBaseInterface is a core node group or a micro node group. In the first case you can cast #this to a CoreNodeGroupInterface, otherwise to a MicroNodeGroupInterface.

Returns
True if #this is a core node group, false if it is a micro node group.

◆ GetChildCount()

MAXON_METHOD Int GetChildCount ( ) const

Returns the number of children of this group.

Returns
Number of children of this group.

◆ GetChild() [1/2]

const MAXON_METHOD Interface::Instance* GetChild ( Int  index) const

Returns the child of this group at the given index.

Parameters
[in]indexThe child index between 0 and GetChildCount()-1.
Returns
Child node instance at the given index. @MAXON_ANNOTATION{interfaceParameter=Interface}

◆ GetChild() [2/2]

MAXON_FUNCTION Interface::Instance* GetChild ( Int  index)

Returns the child of this group at the given index.

Parameters
[in]indexThe child index between 0 and GetChildCount()-1.
Returns
Child node instance at the given index. @MAXON_ANNOTATION{interfaceParameter=Interface} @MAXON_ANNOTATION{interfaceParameter=Interface}

◆ FindChild()

const MAXON_METHOD Interface::Instance* FindChild ( const Id name) const

Finds the child of this group with the given name.

Parameters
[in]nameA name.
Returns
Child node instance having the given name, or a nullptr if no such child exists. @MAXON_ANNOTATION{interfaceParameter=Interface}

◆ GetPortCount()

MAXON_METHOD Int GetPortCount ( PORT_DIR  direction) const

Returns the number of ports of this group for the given direction.

Parameters
[in]directionA port direction (PORT_DIR::INPUT for input ports, PORT_DIR::OUTPUT for output ports).
Returns
Number of ports for direction.

◆ FindPortIndex()

MAXON_METHOD Int FindPortIndex ( const PortId port) const

Finds the index of the port of this group which is identified by the given PortId port.

Parameters
[in]portIdentifier of the port.
Returns
Index of the identified port, or a negative number if no such port exists. @MAXON_ANNOTATION{default=-1}

◆ FindValidPortIndex()

MAXON_METHOD Result<Int> FindValidPortIndex ( const PortId port) const

Finds the index of the port of this group which is identified by the given PortId port.

Parameters
[in]portIdentifier of the port.
Returns
Index of the identified port, or an error if no such port exists.

◆ GetPortInfo()

const MAXON_METHOD PortInfo& GetPortInfo ( const PortId port) const

Returns the PortInfo of the port of this group which is identified by the given PortId port.

Parameters
[in]portIdentifier of the port.
Returns
PortInfo of the identified port, or a null value if no such port exists.

◆ GetValidPortInfo()

MAXON_METHOD Result<const PortInfo&> GetValidPortInfo ( const PortId port) const

Returns the PortInfo of the port of this group which is identified by the given PortId port.

Parameters
[in]portIdentifier of the port.
Returns
PortInfo of the identified port, or an error if no such port exists.

◆ AddPort()

MAXON_METHOD Result<Int> AddPort ( PORT_DIR  direction,
const Id name,
const DataType type 
)

Adds a port to this group.

Parameters
[in]directionThe direction of the port (PORT_DIR::INPUT for inputs ports, PORT_DIR::OUTPUT for output ports).
[in]nameName of the port, this has to be unique among all ports of the same direction.
[in]typeType of the port. Usually this is a const type, only state ports have a non-const type.
Returns
Index of the added port.

◆ AddPassThrough()

MAXON_METHOD Result<void> AddPassThrough ( const InPortId input,
const OutPortId output,
WIRETYPE  wires 
)

Adds a pass-through connection from an input port of this group to an output port of this group. Pass-through connections just pass their values on without changing or using them.

Parameters
[in]inputThe input port for the pass-through.
[in]outputThe output port for the pass-through.
[in]wiresThe wires to use for the pass-through.

◆ GetValue() [1/2]

MAXON_METHOD Result<Data> GetValue ( const InternedId attr) const

Gets the value of the given attribute for this node. Values can be set on the node using SetValue, and they are also inherited from the factory arguments and from the factory. If this node doesn't have a value for the attribute, an empty Data is returned.

Parameters
[in]attrThe attribute whose value shall be obtained.
Returns
The attribute value of this node, or an empty Data.

◆ GetValue() [2/2]

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

Gets the value of the given attribute for this node. Values can be set on the node using SetValue, and they are also inherited from the factory arguments. If this node doesn't have a value for the attribute or the value doesn't have the expected type, an empty Opt is returned.

Bool pure = node.GetValue(corenodes::CoreNodeInterface::Pure).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/3]

MAXON_METHOD Result<void> SetValue ( const InternedId attr,
ForwardingDataPtr &&  value 
)

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

Parameters
[in]attrThe attribute whose value shall be set.
[in]valueThe value for the attribute.

◆ SetValue() [2/3]

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

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

Parameters
[in]attrThe attribute whose value shall be set.
[in]valueThe value for the attribute.

◆ SetValue() [3/3]

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

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

Parameters
[in]attrThe attribute whose value shall be set.
[in]valueThe value for the attribute.

◆ GetHashValue()

MAXON_METHOD HashValue GetHashValue ( ) const

Returns the 128-bit hash value of this @CLASS. The implementation ensures uniform distribution, so for practical purposes you can safely assume that two objects are equal if their hash values are equal.

Returns
Hash value of this @CLASS.

◆ MAXON_ATTRIBUTE_CLASS() [1/16]

MAXON_ATTRIBUTE_CLASS ( Bool  ,
Pure  ,
"net.maxon.corenode.pure"   
)

This attribute should be set to true for a core node which implements a pure function. A pure function is a function where the return value is always the same for the same arguments and the evaluation has no side effects. Node compilers can take advantage of this by evaluating pure functions at compile-time.

◆ MAXON_ATTRIBUTE_CLASS() [2/16]

MAXON_ATTRIBUTE_CLASS ( maxon::corenodes::Optimizer  ,
Optimizer  ,
"net.maxon.corenode.optimizer"   
)

This attribute provides an optimizer for a core node, see corenodes::Optimizer.

◆ MAXON_ATTRIBUTE_CLASS() [3/16]

MAXON_ATTRIBUTE_CLASS ( Id  ,
NodeId  ,
"net.maxon.corenode.nodeid"   
)

◆ MAXON_ATTRIBUTE_CLASS() [4/16]

MAXON_ATTRIBUTE_CLASS ( Data  ,
Value  ,
"net.maxon.corenode.value"   
)

◆ MAXON_ATTRIBUTE_CLASS() [5/16]

MAXON_ATTRIBUTE_CLASS ( DataType  ,
Type  ,
"net.maxon.corenode.type"   
)

◆ MAXON_ATTRIBUTE_CLASS() [6/16]

MAXON_ATTRIBUTE_CLASS ( Id  ,
TypeId  ,
"datatype"   
)

◆ MAXON_ATTRIBUTE_CLASS() [7/16]

MAXON_ATTRIBUTE_CLASS ( DataType  ,
InType  ,
"in"   
)

◆ MAXON_ATTRIBUTE_CLASS() [8/16]

MAXON_ATTRIBUTE_CLASS ( DataType  ,
OutType  ,
"out"   
)

◆ MAXON_ATTRIBUTE_CLASS() [9/16]

MAXON_ATTRIBUTE_CLASS ( DataType  ,
SourceType  ,
"net.maxon.corenode.sourcetype"   
)

◆ MAXON_ATTRIBUTE_CLASS() [10/16]

MAXON_ATTRIBUTE_CLASS ( BaseArray< Member ,
Members  ,
"net.maxon.corenode.members"   
)

◆ MAXON_ATTRIBUTE_CLASS() [11/16]

MAXON_ATTRIBUTE_CLASS ( Int  ,
Count  ,
"net.maxon.corenode.count"   
)

◆ MAXON_ATTRIBUTE_CLASS() [12/16]

MAXON_ATTRIBUTE_CLASS ( CONVERSION_FLAGS  ,
ConversionFlags  ,
"net.maxon.corenode.conversionflags"   
)

◆ MAXON_ATTRIBUTE_CLASS() [13/16]

MAXON_ATTRIBUTE_CLASS ( String  ,
Message  ,
"net.maxon.corenode.message"   
)

◆ MAXON_ATTRIBUTE_CLASS() [14/16]

MAXON_ATTRIBUTE_CLASS ( ErrorList  ,
Errors  ,
"net.maxon.corenode.errors"   
)

◆ MAXON_ATTRIBUTE_CLASS() [15/16]

MAXON_ATTRIBUTE_CLASS ( Id  ,
VariableId  ,
"net.maxon.corenode.variableid"   
)

◆ MAXON_ATTRIBUTE_CLASS() [16/16]

MAXON_ATTRIBUTE_CLASS ( Array< Id ,
Filters  ,
"net.maxon.corenode.filters"   
)

◆ ToString()

MAXON_FUNCTION String ToString ( const FormatStatement fmt = nullptr) const

Returns a String representation of this @CLASS.

Parameters
[in]formatStatementNullptr or additional formatting instruction.
Returns
String representation of this @CLASS.
iferr_return
#define iferr_return
Definition: resultbase.h:1465
Bool
maxon::Bool Bool
Definition: ge_sys_math.h:55