TypeVec

class dsviper.TypeVec(numeric_type, size)

Bases: Type

The vec<numeric_type, size> type.

numeric_type is one of the integer or floating-point primitives, Type.UINT8 through Type.DOUBLE; Type.BOOL and Type.STRING raise. size is at least 1, and 0 raises. The accessor that reads numeric_type back is element_type(), and ValueVec builds values of it.

static cast(type: Type) → TypeVec

Return type as a TypeVec, or raise if it is not one.

description(*, namespace: NameSpace | None = None) → str

Return the same as representation(): vec<element_type, size>, qualified against namespace.

element_type() → _NumericTypes

Return the numeric type of one component.

elements_type() → TypeVector

Return vector<element_type>, the type a whole component listing has.

representation(*, namespace: NameSpace | None = None) → str

Return the type written out as vec<element_type, size>, with the names qualified against namespace - the global namespace when it is None.

runtime_id() → ValueUUId

Return the uuid identifying this type.

It is computed from what the type is, so the same declaration yields the same id in any Definitions. Definitions says what each kind is computed from.

size() → int

Return the number of elements.

type_code() → str

Return the code naming this kind of type, such as “int32”, “struct” or “vector”.