MicroNodeGroupInterface is a group of micro nodes. A micro node group is the most fundamental core node. In the usual case a group consists of just one micro node, then you set up a micro node group with the following pattern:
// This class defines a micro node group which adds two Int values.
class MyAddNode
{
public:
// Declaration of the input and output ports of the micro node group.
MAXON_PORT_INPUT(Int, in1);
MAXON_PORT_INPUT(Int, in2);
MAXON_PORT_OUTPUT(Int, out);
// Implementation of the single custom micro node.
class Impl : public BasicMicroNode
{
public:
// The Process method needs to specify which ports of the group the micro node accesses, in this case all ports.
// If the group contains more than one micro node, each micro node usually needs only a subset of the ports.
Result<void> Process(const Ports<in1, in2, out>& ports) const
{
ports.out.Update(ports.in1() + ports.in2());
return OK;
}
};
// The Init function will be called to set up the micro node group
// when you call CreateNode<MyAddNode>() or as part of the MAXON_CORENODE_REGISTER macro.
static Result<void> Init(const MicroNodeGroupRef& group)
{
iferr_scope;
group.AddChild<Impl>() iferr_return;
return OK;
}
};
The Init function can have additional parameters:
- When called from one of the MAXON_CORENODE_REGISTER macros there may be one additional parameter of type
{const DataDictionary&}. It receives the factory arguments which are passed to the Create method of the CoreNodeFactory registered by the macro. These arguments contain information such as the number of variadic ports to create, see MicroNodeInterface::AddVariadicPort.
- When called from CreateNode an arbitrary number of extra arguments can be passed from the call to CreateNode to the call to Init.
|
template<typename MN , typename... ARGS> |
MAXON_FUNCTION Result< MicroNodePtr< MN > > | AddChild (const Id &name, ARGS &&... args) |
|
template<typename MN > |
MAXON_FUNCTION Result< MicroNodePtr< MN > > | AddChild () |
|
template<typename PORT > |
MAXON_FUNCTION Result< typename PORT::PortIdType > | GetPort (const PORT &port) |
|
template<typename OUTPORT > |
MAXON_FUNCTION Result< MicroNodePtr< typename OUTPORT::PortClass::MicroNodeClass > > | GetPortMicroNode (const OUTPORT &port) |
|
template<typename PORT > |
MAXON_FUNCTION Result< void > | SetDataType (const PORT &port, const DataType &type) |
|
template<typename PORT > |
MAXON_FUNCTION Result< void > | AddWires (const PORT &port, WIRETYPE wires) |
|
| MAXON_ADD_TO_REFERENCE_CLASS (Result< CoreNode > Finalize() { if(!this->GetPointer()) return IllegalArgumentError(MAXON_SOURCE_LOCATION);Result< CoreNode > result=this->GetPointer() ->PrivateFinalize();if(result==OK) this->ResetReference();return result;}) |
|
MAXON_METHOD Result< CoreNode > | PrivateFinalize () |
|
template<typename PORTID > |
Result< PORTID > | PrivateGetPort (const corenodes::details::SourceCodePortId &pid, const Id &name, const DataType &vtype, WIRETYPE wtypes) |
|
template<typename NODECLASS > |
Result< void > | PrivateAutoCreatePorts (const Generic *arg, Result< DataType >(*getPortType)(const Id &, const Generic *)) |
|
MAXON_FUNCTION Result< MicroNodePtr<> > | CreatePort (const Id &name, MicroNode::TYPE type, MicroNode::FLAGS flags, const DataType &vtype) |
|
MAXON_METHOD Result< MicroNodePtr<> > | PrivateCreatePort (Int pid, const Id &name, MicroNode::TYPE type, MicroNode::FLAGS flags, const DataType &vtype, Int count) |
|
MAXON_METHOD Result< Int > | PrivateGetPort (const corenodes::details::SourceCodePortId &declId, const PortId &pid, const DataType &vtype, WIRETYPE wtypes) |
|
MAXON_METHOD Result< OutPortId > | PrivateAddParameter (MicroNodeInterface *paramRoot, Int pid, const DataType &type, const Id &name, MicroNode::TYPE portType, MicroNode::FLAGS flags, const ConstDataPtr &constant, MicroNodeInterface *&portOut) |
|
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 |
|