BasicMicroNode Class Reference

#include <micronodes.h>

Inheritance diagram for BasicMicroNode:

详细描述

BasicMicroNode is the base class for simple custom micro nodes. A BasicMicroNode receives a single set of input values in its Process method and computes the corresponding output values. If the Process method consists of just a few simple operations, you should consider to implement a BatchMicroNode instead: It computes the output values for a whole batch of input values with a single call, so this reduces the calling overhead of nodes.

To implement a BasicMicroNode , you have to derive a new class from BasicMicroNode and add a Process method to that class which has a {const Ports<...>&} parameter with a list of those ports between the angular brackets which shall be accessed by the node. The ports have to be defined by MAXON_PORT macros in a micro node group class. Usually the BasicMicroNode class is a member of that micro node group class as in this example:

// 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; } };

Public Types

using  MicroNodeClass = BasicMicroNode
using  ProcessFn = Result < void >(*)(const MicroNode *, const void *,)
-  Public Types inherited from MicroNode
enum   TYPE {
   INVALID ,
   BASIC ,
   BATCH ,
   SPLIT_MERGE ,
   ITERATION ,
   SEQUENCING ,
   RECURSION_STEP ,
   CURRENT_ITERATION_VALUE ,
   CURRENT_ITERATION_VALUE_WITH_INIT ,
   COPY ,
   SET_TRUE ,
   NOP ,
   SUBTRACTIVE_DOMAIN ,
   VARIABLE_MASK ,
   VALUE_PORT_MASK ,
   INPUT_PORT_MASK ,
   EXPORTED_PORT ,
   VIRTUAL_INPUT_PORT ,
   OUTPUT_PORT_MASK ,
   VARIABLE ,
   PORT_MASK ,
   FACTOR_MASK ,
   ROOT ,
   WHILE_CONDITION ,
   INDEFINITE_LOOP ,
   TOP_LEVEL_FACTOR_MASK ,
   FRAME_MASK ,
   TOP_LEVEL_FRAME ,
   FRAME ,
   EVENT_MASK ,
   EVENT ,
   FACTOR_HEAD_MASK ,
   DEFINITE_FACTOR_HEAD_MASK ,
   CONTAINER_LOOP_HEAD_MASK ,
   CONTAINER_OUTPUT_HEAD_MASK ,
   DEFINITE_FACTOR_MASK ,
   CONTAINER_OUTPUT_ELEMENT_MASK ,
   INDEXABLE_FACTOR_MASK ,
   DIMENSIONAL_FACTOR_TEST ,
   CONTAINER_LOOP_MASK ,
   INDEFINITE_LOOP_HEAD ,
   RECURSION_HEAD ,
   DEFINITE_LOOP_HEAD ,
   CONTAINER_LOOP_HEAD ,
   ARRAY_LOOP_HEAD ,
   CONTAINER_LOOP ,
   ARRAY_LOOP ,
   CONTAINER_OUTPUT_HEAD ,
   CONTAINER_OUTPUT_ELEMENT ,
   ARRAY_OUTPUT_ELEMENT ,
   DEFINITE_LOOP ,
   GENERIC_DEFINITE_LOOP ,
   RECURSION ,
   INPUT_ELEMENT_MASK ,
   ARRAY_INPUT_ELEMENT ,
   CONTAINER_INPUT_ELEMENT ,
   INPUT_MASK ,
   OUTPUT_MASK ,
   CONTAINER_MASK ,
   CONTAINER ,
   ARRAY_CONTAINER ,
   ARRAY ,
   CONTAINER_OUTPUT_MASK ,
   CONTAINER_OUTPUT ,
   CONTAINER_INPUT_GROUP_MASK ,
   CONTAINER_INPUT_GROUP ,
   ALL
}
enum   FLAGS {
   NONE ,
   STATE ,
   STATE_MODIFIER ,
   LOCAL ,
   PERMANENT ,
   CACHED ,
   DONT_WRAP ,
   CURRENT_ITV ,
   NEXT_ITV ,
   CONTAINER_MEMBER ,
   COMMUTATIVE ,
   STATE_MAPPER ,
   PARAMETER ,
   INPUT_WITHOUT_VALUE ,
   OUTER_DOMAIN ,
   NO_FACTORS ,
   SUSPEND ,
   KEEP_LETTER_CASE ,
   INDEPENDENT ,
   INCLUDE_IN_PREDECESSORS ,
   FACTOR_REFERENCE ,
   OPTIONAL_INPUT ,
   CURRENT_ITV_GROUP ,
   NEXT_ITV_GROUP ,
   HIDDEN ,
   ITV_MASK ,
   ITV_GROUP_MASK ,
   PORT_MODIFIERS ,
   MODIFIERS ,
   ALL
}
enum   PORTSACCESS_FLAGS {
   NONE ,
   ITERATION ,
   CONTAINER_MASK ,
   CONST_MASK ,
   BATCH ,
   BATCH_ACCESS ,
   CONTAINER ,
   CONST_CONTAINER ,
   DIRECT_ACCESS_TEST
}
template<typename PORT >
using  Input = typename PORT::PrivateInput
template<typename... PORTS>
using  端口 = typename PortsAccess < PORTSACCESS_FLAGS::NONE , PORTS... >::Members

公共成员函数

  MAXON_SECONDARG (,, template< typename PORTMODE >) static void Process()
template<typename MN >
void  PrivateInit ()
-  Public Member Functions inherited from MicroNode
enum maxon::corenodes::MicroNode::TYPE   MAXON_ENUM_ORDERED_FLAGS_CLASS ( TYPE )
enum maxon::corenodes::MicroNode::FLAGS   MAXON_ENUM_FLAGS_CLASS ( FLAGS )
const Base ToBase () const
Base ToBase ()
Bool   HasSameClass (const MicroNode &other) const
const MicroNodeInterface GetNode () const
MicroNodeInterface GetNode ()
TYPE   GetType () const
FLAGS   GetFlags () const
enum maxon::corenodes::MicroNode::PORTSACCESS_FLAGS   MAXON_ENUM_FLAGS_CLASS ( PORTSACCESS_FLAGS )

Public Attributes

Base   _base
ProcessFn   _fProcess [1]
corenodes::details::InitUserDataFn   _fInitUserData
corenodes::details::GetLlvmAssemblyFn   _fGetLlvmAssembly
-  Public Attributes inherited from MicroNode
class maxon::corenodes::MicroNode::Base   MAXON_ENUM_FLAGS_CLASS

静态公共属性

static const TYPE   MICRONODE_TYPE
static const WIRETYPE   IS_TARGET_OF
static const WIRETYPE   IS_SOURCE_OF
-  Static Public Attributes inherited from MicroNode
static const TYPE   INPUT_TYPE_MASK
static const TYPE   OUTPUT_TYPE_MASK
static const FLAGS   MICRONODE_FLAGS

Static Private Member Functions

template<typename MN , typename MT , MT METHOD, typename PORTS >
static ProcessFn   GetProcessFn ( Result < void >(MN::*)( PORTS &,) const, MicroNode::Base &node)
template<typename MN , typename MT , MT METHOD>
static ProcessFn   GetProcessFn (void(*)(), MicroNode::Base &)

Additional Inherited Members

-  Static Public Member Functions inherited from MicroNode
static void  InitUserData ()
static void  GetLlvmAssembly (const LlvmGlobalsReceiver &)

Member Typedef Documentation

◆  MicroNodeClass

using MicroNodeClass = BasicMicroNode

◆  ProcessFn

using ProcessFn = Result <void>(*)(const MicroNode *, const void*,)

成员函数文档编制

◆  GetProcessFn() [1/2]

static ProcessFn GetProcessFn ( Result < void >(MN::*)( PORTS &,) const  ,
MicroNode::Base node  
)
static private

◆  GetProcessFn() [2/2]

static ProcessFn GetProcessFn ( void(*)()  ,
MicroNode::Base  
)
static private

◆  MAXON_SECONDARG()

MAXON_SECONDARG ( template< typename PORTMODE >  )

◆  PrivateInit()

void PrivateInit ( )

Member Data Documentation

◆  MICRONODE_TYPE

const TYPE MICRONODE_TYPE static

◆  _base

Base _base

◆  IS_TARGET_OF

const WIRETYPE IS_TARGET_OF static

◆  IS_SOURCE_OF

const WIRETYPE IS_SOURCE_OF static

◆  _fProcess

ProcessFn _fProcess[1]

◆  _fInitUserData

corenodes::details::InitUserDataFn _fInitUserData

◆  _fGetLlvmAssembly

corenodes::details::GetLlvmAssemblyFn _fGetLlvmAssembly