#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) |
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) |
static MAXON_METHOD ConstDataPtr | GetConstant (const DataType &type, Int value) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (CoreNodesLib, MAXON_REFERENCE_NONE, "net.maxon.corenode.interface.corenodeslib") | |
Static Private Member Functions | |
static MAXON_METHOD Result< Bool > | PrivateConvertArgument (TrivialDataPtr &arg, const DataType &expectedType, PointerArray< Data > &resultReferences) |
|
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. |
|
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 |
|
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. |
|
static |
Allows to fetch a zero or non zero constant value for a specific DataType. For instance "GetConstant(GetDataType<Matrix>(), 0)" will return a Matrix with a null translation, rotation and scale. "GetConstant(GetDataType<Matrix>(), 1)" would return an identity matrix. "GetConstant(GetDataType<ColorA>(), 1)" will return a ColorA's default value, hence ColorA{0.0_f, 0.0_f, 0.0_f, 1.0_f}. Mostly used to node optimizers.
[in] | type | The requested DataType. |
[in] | value | 0 to get a zero initialized version of the data, 1 to get non-zero (default value) for type. |
|
staticprivate |
Applies the required conversion sequence on the TrivialDataPtr's content to transform it into the desired DataType. This supports VALUEKIND::FUNCTION value types. The owner of the resulting TrivialDataPtr is in #resultReferences, i.e. keep it valid as long as arg can be used.
[in,out] | arg | A value to be converted using CoreNodesLib::GetConversion (and more for VALUEKIND::FUNCTION). |
[in] | expectedType | The desired type for arg. |
[out] | resultReferences | A Data array to maintain until the content of arg is not needed anymore. arg becomes invalid when resultReferences is out of scope or reset. |