#include <corenodes.h>
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"
.------------------
>
-----------------------------------------------
<
-----------.
+GetName(): Id
| | | +--------------------------------------------—+ | | | | | | | | "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 | |
MAXON_METHOD const Id & | GetId () const |
MAXON_METHOD void | SetId (const Id &name) |
MAXON_METHOD CoreNodeFactory | GetFactory () const |
MAXON_METHOD const DataDictionary & | GetArguments () const |
MAXON_METHOD void | InitFactory (const CoreNodeFactory &factory, const DataDictionary &args) |
MAXON_METHOD Bool | IsCoreNodeGroup () const |
MAXON_METHOD Int | GetChildCount () const |
MAXON_METHOD const Interface::Instance * | GetChild (Int index) const |
MAXON_FUNCTION Interface::Instance * | GetChild (Int index) |
MAXON_METHOD const 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< Int > | FindValidPortIndex (const PortId &port) const |
MAXON_METHOD const PortInfo & | GetPortInfo (const PortId &port) const |
MAXON_METHOD Result< const PortInfo & > | GetValidPortInfo (const PortId &port) const |
MAXON_METHOD Result< Int > | AddPort (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< Data > | GetValue (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 UniqueHash | GetUniqueHashCode () 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") | |
|
private |
This defines the covariant return type of GetChild
|
private |
MAXON_METHOD const Id& GetId | ( | ) | const |
Returns the identifier of the core node.
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").
[in] | name | The identifier of the core node. |
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.
MAXON_METHOD const DataDictionary& GetArguments | ( | ) | const |
Returns the factory arguments which have been used to create this core node, see GetFactory().
MAXON_METHOD void InitFactory | ( | const CoreNodeFactory & | factory, |
const DataDictionary & | args | ||
) |
Sets the factory and factory arguments for this core node, see GetFactory().
[in] | factory | The core node factory which created this core node. |
[in] | args | The factory arguments used for creation of this core node. |
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.
MAXON_METHOD Int GetChildCount | ( | ) | const |
Returns the number of children of this group.
MAXON_METHOD const Interface::Instance* GetChild | ( | Int | index | ) | const |
Returns the child of this group at the given index.
[in] | index | The child index between 0 and GetChildCount()-1. |
MAXON_FUNCTION Interface::Instance* GetChild | ( | Int | index | ) |
Returns the child of this group at the given index.
[in] | index | The child index between 0 and GetChildCount()-1. |
MAXON_METHOD const Interface::Instance* FindChild | ( | const Id & | name | ) | const |
Finds the child of this group with the given name.
[in] | name | A name. |
MAXON_METHOD Int GetPortCount | ( | PORT_DIR | direction | ) | const |
Returns the number of ports of this group for the given direction.
[in] | direction | A port direction (PORT_DIR::INPUT for input ports, PORT_DIR::OUTPUT for output ports). |
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.
[in] | port | Identifier of the port. |
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.
[in] | port | Identifier of the port. |
MAXON_METHOD const PortInfo& GetPortInfo | ( | const PortId & | port | ) | const |
MAXON_METHOD Result<const PortInfo&> GetValidPortInfo | ( | const PortId & | port | ) | const |
Adds a port to this group.
[in] | direction | The direction of the port (PORT_DIR::INPUT for inputs ports, PORT_DIR::OUTPUT for output ports). |
[in] | name | Name of the port, this has to be unique among all ports of the same direction. |
[in] | type | Type of the port. Usually this is a const type, only state ports have a non-const type. |
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.
[in] | input | The input port for the pass-through. |
[in] | output | The output port for the pass-through. |
[in] | wires | The wires to use for the pass-through. |
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.
[in] | attr | The attribute whose value shall be obtained. |
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.
[in] | attr | The attribute whose value shall be obtained. |
MAXON_METHOD Result<void> SetValue | ( | const InternedId & | attr, |
ForwardingDataPtr && | value | ||
) |
Sets the value of #attr to value for this node.
[in] | attr | The attribute whose value shall be set. |
[in] | value | The value for the attribute. |
MAXON_FUNCTION Result<void> SetValue | ( | const ATTR & | attr, |
const typename ATTR::ValueType & | value | ||
) |
Sets the value of #attr to value for this node.
[in] | attr | The attribute whose value shall be set. |
[in] | value | The value for the attribute. |
MAXON_FUNCTION Result<void> SetValue | ( | const ATTR & | attr, |
typename ATTR::ValueType && | value | ||
) |
Sets the value of #attr to value for this node.
[in] | attr | The attribute whose value shall be set. |
[in] | value | The value for the attribute. |
MAXON_METHOD UniqueHash GetUniqueHashCode | ( | ) | 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.
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 | ( | maxon::corenodes::Optimizer | , |
Optimizer | , | ||
"net.maxon.corenode.optimizer" | |||
) |
This attribute provides an optimizer for a core node, see corenodes::Optimizer.
MAXON_ATTRIBUTE_CLASS | ( | Id | , |
NodeId | , | ||
"net.maxon.corenode.nodeid" | |||
) |
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 | ( | 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_FUNCTION String ToString | ( | const FormatStatement * | fmt = nullptr | ) | const |