#include <corenodes_lib.h>
CoreNodesLib provides a set of static methods around core nodes.
Static Public Member Functions | |
static MAXON_METHOD Result< const ConversionSequence * > | GetConversion (const DataType &to, const DataType &from, Bool allowIterations=false) |
static MAXON_METHOD Bool | IsEqualConversionSequence (const ConversionSequence &a, const ConversionSequence &b) |
static MAXON_METHOD Bool | IsBetterConversionSequence (const ConversionSequence &a, const ConversionSequence &b) |
static MAXON_METHOD Result< Data > | Convert (const ConversionSequence &cs, const ConstDataPtr &value) |
static MAXON_METHOD Result< Data > | Convert (const DataType &to, const ConstDataPtr &value) |
static MAXON_METHOD Result< CoreNode > | GetPassThroughNode (const DataType &type) |
static MAXON_METHOD Result< CoreNode > | WrapFunction (const reflection::Function &function) |
static MAXON_METHOD Optimizer | CreateOptimizer (const Block< const ShortCircuitRule > &rules) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (CoreNodesLib, MAXON_REFERENCE_NONE, "net.maxon.corenode.interface.corenodeslib") | |
|
private |
|
static |
Constructs a ConversionSequence from type #from to type #to. The sequence consists of zero to two ConversionNodes. If no suitable sequence can be found, nullptr is returned.
[in] | to | The destination type. |
[in] | from | The source type. |
[in] | allowIterations | If this is true, iteration conversions are considered too (such as from a Vector array to Vector). |
|
static |
Checks if two conversion sequences are equal (consist of equal conversion nodes). You don't have to call this method explicitly, just use ConversionSequence::operator==.
[in] | a | A conversion sequence. |
[in] | b | Another conversion sequence. |
|
static |
Checks if a conversion sequence is better than another one. You don't have to call this method explicitly, just use ConversionSequence::operator>.
[in] | a | A conversion sequence. |
[in] | b | Another conversion sequence. |
|
static |
Converts a given #value using conversion sequence #cs to the destination type of the conversion sequence.
[in] | cs | A conversion sequence. |
[in] | value | A value to convert. This has to match the source type of #cs, otherwise an error is returned. |
|
static |
Converts a given #value to a destination type #to using registered ConversionNodes. This method obtains a ConversionSequence using Convert() and then calls that sequence to convert the #value. If no ConversionSequence can be found a conversion with DataType::Convert() is tried.
[in] | to | The destination type. |
[in] | value | A value to convert. |
|
static |
Constructs a CoreNode which implements a direct pass-through of its single input port to its single output port. Such nodes can be used by Optimizers to set up special cases, for example a multiplication by one can be optimized to a pass-through.
[in] | type | The type of the values for the pass-through. |
|
static |
Constructs a CoreNode which calls the given #function on execution. The returned CoreNode has input ports for function parameters and a single output port for the function result.
[in] | function | The function to be wrapped by a CoreNode. |
|
static |
Creates an Optimizer for a set of ShortCircuitRules, see there for the meaning of the rules. The returned Optimizer will test the rules in the given order and apply the first matching one.
[in] | rules | A set of rules. The Optimizer doesn't make a copy, to you have to ensure that the rules remain valid during the lifetime of the Optimizer. For example just put the rules in a global static variable as in the example given at ShortCircuitRule. |