micronodes_ports.h File Reference

Classes

class   DirectPortAccess< PORT, OWNER >
class   MappedPortAccess< PORT, OWNER >
class   ArrayElementAccess< ELEMENT >
class   PortOps< T, ACCESS, CHECK >
class   PortOpsBase< T, ACCESS >
class   PortOpsBase< T &, ACCESS >
class   PortOps< T, ACCESS, CHECK >
class   IndexedPortAccess< ACCESS >
class   IndexedPort< OP, N >
struct   SourceCodePortId
class   PortDefBase< C, MICRO, HASH, LOCAL, IS_STATE, INDEXCOUNT >
class   PortDefBaseCtor< C, MICRO, HASH, LOCAL, STATE, MEMBERS, DIMENSION, INDEXCOUNT >
class   PortDefBaseCtor< C, MICRO, HASH, LOCAL, STATE, MEMBERS, void, -1 >
struct   AddDimension< T, N >
struct   AddDimension< void, N >
class   PortArrayAccess< ACCESS >
struct   Select< PORT, MASK, OWNER >
class   PortMembers< PORTS >
struct   UnannotatedType< T >
struct   UnannotatedType< T >
class   MicroNode::Lazy< PORT >
class   MicroNode::Lazy< PORT >::Port< OWNER >
class   MicroNode::PortsAccess< ACCESS_FLAGS, PORTS >
class   MicroNode::PortsAccess< ACCESS_FLAGS, PORTS >::InputMembers
class   MicroNode::PortsAccess< ACCESS_FLAGS, PORTS >::NonEmptyInputMembersIteration
class   MicroNode::PortsAccess< ACCESS_FLAGS, PORTS >::OutputMembers
class   MicroNode::PortsAccess< ACCESS_FLAGS, PORTS >::Members
class   MicroNode::PortsAccess< ACCESS_FLAGS, PORTS >::EmptyInputMembersIteration
class   MicroNode::PortsAccess< ACCESS_FLAGS, PORTS >::Iterator
class   MicroNode::PortsAccess< ACCESS_FLAGS, PORTS >::BatchIterator

Namespaces

  maxon
  maxon::corenodes
  maxon::corenodes::details

Macros

#define  MAXON_PORT_INPUT (T, name)
#define  MAXON_PORT_INPUT_INDEXED (T, name, N)
#define  MAXON_PORT_INPUT_NAMED (T, name, portId)
#define  MAXON_PORT_OUTPUT (T, name)
#define  MAXON_PORT_OUTPUT_INDEXED (T, name, N)
#define  MAXON_PORT_OUTPUT_NAMED (T, name, portId)
#define  PRIVATE_MAXON_PORT_WRAP_false (CNT, ...)
#define  PRIVATE_MAXON_PORT_WRAP_true (CNT, ...)
#define  PRIVATE_MAXON_PORT_DIMENSION_false (CNT)
#define  PRIVATE_MAXON_PORT_DIMENSION_true (CNT)
#define  PRIVATE_MAXON_PORT_MEMBER (name, ARRAY, CNT)
#define  PRIVATE_MAXON_PORT (name, portId, ARRAY, CNT, ...)
#define  PRIVATE_MAXON_PORT_GET_NAME_HASHCODE (name)
#define  PRIVATE_MAXON_INPUT_PORT_NAMED (T, name, portId, LOCAL , ARRAY, CNT, ...)
#define  PRIVATE_MAXON_INPUT_PORT (T, name, LOCAL , ARRAY, CNT, ...)
#define  PRIVATE_MAXON_STATE_PORT (T, name, LOCAL , ARRAY, CNT, ...)
#define  PRIVATE_MAXON_OUTPUT_PORT_NAMED (T, name, portId, mtype, LOCAL , ARRAY, CNT, ...)
#define  PRIVATE_MAXON_OUTPUT_PORT (T, name, mtype, LOCAL , ARRAY, CNT, ...)

Typedefs

template<typename T >
using  MyBegin = typename T::Begin
template<typename T >
using  PortValueTypeHelper = typename std::conditional< STD_IS_REPLACEMENT (reference, T), typename std::decay< T >::type, typename std::add_const< T >::type >::type
template<typename T >
using  UnannotatedTypeHelper = typename SubstituteType< T, UnannotatedType >::type
using  PrivateMaxonCorenodesParentDimension = void

函数

template<typename DIMENSION >
Int   ComputeLinearIndex (const Int *index)
template<>
Int   ComputeLinearIndex< Char > (const Int *index)
template<typename DIMENSION >
Int   ComputeLinearIndex ( Int index)
template<typename PORTIDTYPE >
constexpr UInt   GetPortHashCodeHelper (PORTIDTYPE const &inId)
constexpr UInt   GetPortHashCodeHelper (LiteralId const &inId)
template<Int LENGTH>
constexpr UInt   GetPortHashCodeHelper (const char(&inId)[ LENGTH ])

Macro Definition Documentation

◆  MAXON_PORT_INPUT

#define MAXON_PORT_INPUT (   T,
  name 
)

Defines an input port of a micro node group with the given type and name. The macro has to be used within a micro node group implementation class, see MicroNodeGroupInterface for a complete example.

To be accessible within the Process method of a micro node, you have to add the port to the port list of the MicroNode::Ports or BatchMicroNode::Batch template for the Process methods's parameter. Within the method you can use two operations on the port:

The following code shows the usage of MAXON_INPUT_PORT:

class MySquareRoot { public: // Declaration of the input and output ports of the micro node group. MAXON_PORT_INPUT(Float, input); MAXON_PORT_OUTPUT(Float, result);
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<input, result>& ports) const { // Read value from input port. Float x = ports.input(); // Check if the input port has a user-defined value. Bool hasValue = ports.input.HasValue(); ... return OK; } }; ... };
参数
[in] T The type of the port.
[in] name The name of the port.

◆  MAXON_PORT_INPUT_INDEXED

#define MAXON_PORT_INPUT_INDEXED (   T,
  name,
 
)

Defines an indexed input port of a micro node group with the given type and name. An indexed port is an indexable collection of N ports with same name and type. The number N has to be a compile-time constant, for a dynamic number of ports see VariadicPort.

The macro has to be used within a micro node group implementation class, afterwards you can use the indexed port for micro nodes as in this example:

// This class template defines a micro node group which adds N values. template <Int N> class MyIndexedAddNode { public: // Declaration of the input and output ports of the micro node group. MAXON_PORT_INPUT_INDEXED(Int, in, N); 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<in, out>& ports) const { Int sum = 0; for (Int i = 0; i < N; ++i) { sum += ports.in[i](); } ports.out.Update(sum); return OK; } }; // The Init function will be called to set up the micro node group // when you call CreateNode<MyIndexedAddNode<N>>() or as part of the MAXON_CORENODE_REGISTER macro. static Result<void> Init(const MicroNodeGroupRef& group) { iferr_scope; group.AddChild<Impl>() iferr_return; for (Int i = 0; i < N; ++i) { // GetPort() needs the index of the port for which you want to get the PortId, // you have to specify the index within the parentheses. InPortId p = group.GetPort(in(i)) iferr_return; DiagnosticOutput("Name of port @ is @.", i, group.GetPortInfo(p).name); } return OK; } };
注意
name is the name by which the port is accessed in source code. The name which is used by the API (such as in PortInfo::name) is name followed by a dot and the index plus one (so the names are 1-based).
参数
[in] T The type of the indexed port.
[in] name The name of the indexed port.
[in] N The number of ports.

◆  MAXON_PORT_INPUT_NAMED

#define MAXON_PORT_INPUT_NAMED (   T,
  name,
  portId 
)

Defines a named input port with an id that can differ from the name.

另请参阅
MAXON_INPUT_PORT, split name parameter into name + portId. portId supports any constexpr type, hardcoded strings, attribute, LiteralId.

◆  MAXON_PORT_OUTPUT

#define MAXON_PORT_OUTPUT (   T,
  name 
)

Defines an output port of a micro node group with the given type and name. The macro has to be used within a micro node group implementation class, see MicroNodeGroupInterface for a complete example.

To be accessible within the Process method of a micro node, you have to add the port to the port list of the MicroNode::Ports or BatchMicroNode::Batch template for the Process methods's parameter. Within the method you can use several operations on the port:

The following code shows the usage of MAXON_OUTPUT_PORT:

class MySquareRoot { public: // Declaration of the input and output ports of the micro node group. MAXON_PORT_INPUT(Float, input); MAXON_PORT_OUTPUT(Float, result); 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<input, result>& ports) const { Float x = ports.input(); // Update the port's value, this will only update the time stamp if the new value differs from the previous one. ports.result.Update(Sqrt(x)); // Directly set the port's value, this will always update the time stamp. ports.result.GetWritable() = Sqrt(x); // Same as above. Float& r = ports.result.GetWritable(); r = Sqrt(x); // GetWritableTouchLater() returns a writable reference for the port value. When you modify the referenced value // you have to make sure to call Touch() on the port to update the time stamp. Float& s = ports.result.GetWritableTouchLater(); if (s * s != x) { // Current value of output port isn't the square root of x, recompute and update time stamp. // (In practice one wouldn't use this optimization for something as simple as Sqrt.) s = Sqrt(x); ports.result.Touch(); } // Check if the value of the output port is actually needed. Bool needed = ports.result.IsNeeded(); // Check if the output port is time-stamped. Bool timeStamped = ports.result.IsTimeStamped(); return OK; } }; ... };
参数
[in] T The type of the port.
[in] name The name of the port.

◆  MAXON_PORT_OUTPUT_INDEXED

#define MAXON_PORT_OUTPUT_INDEXED (   T,
  name,
 
)

Defines an indexed output port of a micro node group with the given type and name, see MAXON_PORT_INPUT_INDEXED for more details.

参数
[in] T The type of the indexed port.
[in] name The name of the indexed port.
[in] N The number of ports.

◆  MAXON_PORT_OUTPUT_NAMED

#define MAXON_PORT_OUTPUT_NAMED (   T,
  name,
  portId 
)

Defines a named output port with an id that can differ from the name.

另请参阅
MAXON_INPUT_PORT, split name parameter into name + portId. portId supports any constexpr type, hardcoded strings, attribute, LiteralId.

◆  PRIVATE_MAXON_PORT_WRAP_false

#define PRIVATE_MAXON_PORT_WRAP_false (   CNT,
  ...  
)

◆  PRIVATE_MAXON_PORT_WRAP_true

#define PRIVATE_MAXON_PORT_WRAP_true (   CNT,
  ...  
)

◆  PRIVATE_MAXON_PORT_DIMENSION_false

#define PRIVATE_MAXON_PORT_DIMENSION_false (   CNT )

◆  PRIVATE_MAXON_PORT_DIMENSION_true

#define PRIVATE_MAXON_PORT_DIMENSION_true (   CNT )

◆  PRIVATE_MAXON_PORT_MEMBER

#define PRIVATE_MAXON_PORT_MEMBER (   name,
  ARRAY,
  CNT 
)

◆  PRIVATE_MAXON_PORT

#define PRIVATE_MAXON_PORT (   name,
  portId,
  ARRAY,
  CNT,
  ...  
)

◆  PRIVATE_MAXON_PORT_GET_NAME_HASHCODE

#define PRIVATE_MAXON_PORT_GET_NAME_HASHCODE (   name )

◆  PRIVATE_MAXON_INPUT_PORT_NAMED

#define PRIVATE_MAXON_INPUT_PORT_NAMED (   T,
  name,
  portId,
  LOCAL ,
  ARRAY,
  CNT,
  ...  
)

◆  PRIVATE_MAXON_INPUT_PORT

#define PRIVATE_MAXON_INPUT_PORT (   T,
  name,
  LOCAL ,
  ARRAY,
  CNT,
  ...  
)

◆  PRIVATE_MAXON_STATE_PORT

#define PRIVATE_MAXON_STATE_PORT (   T,
  name,
  LOCAL ,
  ARRAY,
  CNT,
  ...  
)

◆  PRIVATE_MAXON_OUTPUT_PORT_NAMED

#define PRIVATE_MAXON_OUTPUT_PORT_NAMED (   T,
  name,
  portId,
  mtype,
  LOCAL ,
  ARRAY,
  CNT,
  ...  
)

◆  PRIVATE_MAXON_OUTPUT_PORT

#define PRIVATE_MAXON_OUTPUT_PORT (   T,
  name,
  mtype,
  LOCAL ,
  ARRAY,
  CNT,
  ...  
)

Typedef Documentation

◆  PrivateMaxonCorenodesParentDimension

using PrivateMaxonCorenodesParentDimension = void