maxon.DataType

Description

maxon.DataType provides a set of functions which allow to operate on values of arbitrary types in a generic way.
Each type needs its own maxon.DataType with specific implementations of the access functions.
The maxon.Data class uses maxon.DataType to be able to store values of arbitrary type.

There are primary data types and compound data types. A primary data type is registered at the DataTypes registry. A compound data type is for example: - a pointer or reference type of another type, - a block type of another type, - a result type of another type, - an array type of another type, - a tuple data type composed of a set of member types. Compound data types are typically created as instantiations of parametric types.

Inheritance diagram

Inheritance

Methods Signature

CheckValueKind(test) Tests the value kind of this data type for the given flags (by using the bitwise and).
Create()
Creates a new instance of this type.
Get() Retrieves a maxon.DataType from its maxon.Id
GetAlignment() Returns the alignment of values of this data type.
GetBaseArrayType() Retrieves the kind of BaseArray used.
GetConstType() Retrieves the constant type of the current type.
GetElementType() Returns the element type of this data type.
GetId()
Returns the identifier of this data type.
GetNativeType() Returns the initial DataType.
GetOpaqueType() Retrieves the hidden type of a DataType.
GetPointerType() Retrieves the pointer type of the current type.
GetSize() Returns the size of values of this data type.
GetType() Returns the DataType of the current object.
GetTypeArguments()
Returns the type arguments of this data type.
GetUnderlyingType()
Returns the most atomic way for describing a parameter.
GetUnqualifiedType()
Returns the description of a parameter.
GetValueKind() Returns the kind of values of this data type.
Is(dt) Returns true if this type is the same as dt.
IsGeneric() Checks if the DataType is a Generic one.
ToString() Returns the String representation of the datatype.
__init__(dt) x.__init__(…) initializes x; see help(type(x)) for signature

Methods Definition

DataType.CheckValueKind(test)

Tests the value kind of this data type for the given flags (by using the bitwise and).

Parameters:test (maxon.VALUEKIND) – The flags to test.
Returns:True if the value kind of this data type has one of the given flags, False otherwise.
Return type:bool
DataType.Create()
Creates a new instance of this type.

If this type is a non-virtual interface, the new instance will be created by NewObj.
If this type is an array type TO BE DONE.
If this type is a virtual interface type, an error is returned because only classes can be instantiated, not interfaces.
Otherwise, the new instance will be initialized by the default constructor. For reference types, this means that the reference will point to nullptr.
Returns:New instance of this data type. The caller owns the new instance.
Return type:Any
static DataType.Get()

Retrieves a maxon.DataType from its maxon.Id

Parameters:
  • id (str) – The id of the datatype to search for.
  • lookupPythonTypes (bool) – True to look also in the python built-in datatype.
Returns:

The matched datatype.

Type:

maxon.DataType

Raise:

TypeError: If the id is not a str.

DataType.GetAlignment()

Returns the alignment of values of this data type. This might by an extended alignment.

Returns:Alignment of values.
Return type:int
DataType.GetBaseArrayType()

Retrieves the kind of BaseArray used.

Returns:The DataType of the BaseArray.
Return type:maxon.DataType
DataType.GetConstType()

Retrieves the constant type of the current type.

Returns:The constant DataType.
Return type:maxon.DataType
DataType.GetElementType()

Returns the element type of this data type. The element type is used for some parametric types such as pointers or references,

Returns:The DataType of the stored elements. Can be None.
Return type:maxon.DataType
DataType.GetId()
Returns the identifier of this data type.
Data type identifiers of primary types look like int32, pointer types are identified by a * suffix as in {float64*}, tuple types by a parenthesized list of its member types as in {(int32,float64*)}.
Returns:Unique identifier of this type.
Return type:maxon.Id
DataType.GetNativeType()

Returns the initial DataType.

Returns:The datatype.
Return type:maxon.DataType
DataType.GetOpaqueType()

Retrieves the hidden type of a DataType.

Returns:The opaque DataType.
Return type:maxon.DataType
DataType.GetPointerType()

Retrieves the pointer type of the current type.

Returns:The pointer DataType.
Return type:maxon.DataType
DataType.GetSize()

Returns the size of values of this data type.

Returns:Size of values.
Return type:int
classmethod DataType.GetType()

Returns the DataType of the current object.

Returns:The datatype.
Return type:maxon.DataType
DataType.GetTypeArguments()
Returns the type arguments of this data type.
Type arguments are set for some instantiations of parametric types.

For example, the 3-dimensional Vector is an instantiation of the parametric type Vec with the arguments (Float, 3).
Returns:The type arguments of this type.
Return type:list(tuple(type, name))
DataType.GetUnderlyingType()
Returns the most atomic way for describing a parameter.
e.g: for a ColorA it’s “(float64 r,float64 g,float64 b,float64 a)”
Returns:The underlying DataType.
Return type:maxon.DataType
DataType.GetUnqualifiedType()
Returns the description of a parameter.
e.g: for a ColorA it’s “net.maxon.parametrictype.col<4,float64>”
Returns:The unqualified DataType.
Return type:maxon.DataType
DataType.GetValueKind()

Returns the kind of values of this data type. This is a coarse classification to distinguish between e.g. value types, pointers, references, arrays and tuples.

Returns:Kind of values.
Return type:maxon.VALUEKIND
DataType.Is(dt)

Returns true if this type is the same as dt.

Parameters:dt (maxon.DataType) – Type to compare.
Returns:True if this type is the same.
Return type:bool
DataType.IsGeneric()

Checks if the DataType is a Generic one.

Returns:True if it’s a Generic.
Return type:bool
DataType.ToString()

Returns the String representation of the datatype.

Returns:The string representation of the DataType.
Return type:str
DataType.__init__(dt)

x.__init__(…) initializes x; see help(type(x)) for signature