#include <parametric_type.h>
A ParametricType instantiates a new DataType from a number of more elementary data types. For example, ParametricTypes::Vec instantiates a vector type from its element type and the number of dimensions, ParametricTypes::Tuple instantiates a tuple type from member types, and ParametricTypes::Const instantiates the const-qualified version of a given type. Possible parameters of a ParametricType are not only types, but also Members (type/id pairs) and integers.
Private Member Functions | |
MAXON_INTERFACE_SIMPLE_VIRTUAL (ParametricTypeInterface, MAXON_REFERENCE_CONST_POINTER) | |
|
private |
MAXON_METHOD const Id& GetId | ( | ) | const |
Returns the identifier of the parametric type. Usually this is also used as prefix for the identifiers of instantiates types, but there are exceptions for basic parametric types such as for const, tuples or arrays.
MAXON_METHOD Result<DataType> Instantiate | ( | const Block< const Member > & | args, |
const Block< const Int64 > & | iargs = GetZeroRef< Block< const Int64 >>() |
||
) | const |
Instantiates this parametric type for the given arguments. This is the general method which supports members and integers as arguments, you can use one of the simpler overloads for common cases like type-only arguments.
[in] | args | The arguments for Member parameters of this parametric type. The identifier part of a Member has to be left empty if the parametric type needs a DataType only. |
[in] | iargs | The arguments for Int64 parameters of this parametric type (for example the dimension of a vector). |
MAXON_FUNCTION Result<DataType> Instantiate | ( | const DataType & | type, |
const Block< const Int64 > & | iargs = GetZeroRef< Block< const Int64 >>() |
||
) | const |
Instantiates this parametric type for the given arguments. This overload can be used for parametric types with a single DataType parameter (plus optionally some integer parameters).
[in] | type | The argument for the single DataType parameter of this parametric type. |
[in] | iargs | The optional arguments for Int64 parameters of this parametric type. |
MAXON_FUNCTION Result<DataType> Instantiate | ( | Result< DataType > && | type, |
const Block< const Int64 > & | iargs = GetZeroRef< Block< const Int64 >>() |
||
) | const |
Instantiates this parametric type for the given arguments. This overload can be used for parametric types with a single DataType parameter (plus optionally some integer parameters). For convenience the type parameter of this overload supports Result<DataType>, so you can directly pass the result of some other function with Result<DataType> return type to this parameter.
[in] | type | The argument for the single DataType parameter of this parametric type. |
[in] | iargs | The optional arguments for Int64 parameters of this parametric type. |
MAXON_FUNCTION Result<DataType> Instantiate | ( | const Block< const DataType > & | types, |
const Block< const Int64 > & | iargs = GetZeroRef< Block< const Int64 >>() |
||
) | const |
Instantiates this parametric type for the given arguments. This overload can be used for parametric types with a number of DataType parameters (plus optionally some integer parameters).
[in] | types | The arguments for the DataType parameters of this parametric type. |
[in] | iargs | The optional arguments for Int64 parameters of this parametric type. |
MAXON_METHOD Bool IsBaseOfOrSame | ( | const DataType & | type, |
const DataType & | other | ||
) | const |
Checks if the given type is a base type of the other
type (or the same). At least one of the types is an instantiation of this parametric type. This method is invoked from DataType::IsBaseOfOrSame, and when type and other have different parametric types, it will be invoked twice, once for each parametric type. If at least one of these invocations returns true, the result of DataType::IsBaseOfOrSame is true.
[in] | type | A data type. |
[in] | other | Another data type. |
MAXON_METHOD Result<void> Convert | ( | const DataPtr & | dest, |
const ConstDataPtr & | src, | ||
CONVERSION_FLAGS | ignore | ||
) | const |
Converts the value src to the value #dest (the type of which has to be an instantiation of this parametric type).
[in] | dest | The destination value, it has to use an instantiation of this parametric type. |
[in] | src | The source value. |
[in] | ignore | Only those conversions are taken into account whose conversion flags aren't set in #ignore. |
Parses an instantiation of this parametric type from a part of a data type identifier. params points to the first character after the opening angular bracket. The returned character pointer has to point to the closing angular bracket. For example, when the full data type identifier is "net.maxon.parametrictype.vec<3,float32>" the Parse method of ParametricTypes::Vec will be called with params pointing to "3", and it returns the data type of Vector32 plus a character pointer to ">".
[in] | params | Pointer to a part of a data type identifier. |
MAXON_METHOD void ResetInstantiated | ( | DataTypeImpl * | type | ) | const |
MAXON_METHOD DataTypeImpl*& GetLeakingLink | ( | DataTypeImpl * | type | ) | const |