nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
value_type.hpp
1// core/include/nk/value/value_type.hpp
2#pragma once
3
4#include <cstddef>
5#include <cstdint>
6
7namespace nk {
8
9// ============================================================
10// ValueType — element type enum
11// ============================================================
12enum class ValueType : uint8_t {
13 EMPTY,
14 DOUBLE,
15 COMPLEX,
16 LOGICAL,
17 CHAR,
18 CELL,
19 STRUCT,
20 FUNC_HANDLE,
21 INT8,
22 INT16,
23 INT32,
24 INT64,
25 UINT8,
26 UINT16,
27 UINT32,
28 UINT64,
29 SINGLE,
30 STRING,
31 OBJECT, // class instance (builtin now, user classdef later); see object_model.md
32 CSL // comma-separated list — a TRANSIENT value-list produced by c{:} / c{idx} /
33 // s.field expansion that splicing contexts (call args, [..], {..}, multi-
34 // assign) flatten. Never stored in a variable; a single-value context must
35 // collapse it (1 elem -> the elem; N -> "too many values"). Reuses
36 // HeapObject::cellData for storage. See dev-docs/memory/csl_first_class.md.
37};
38
39const char *mtypeName(ValueType t);
40size_t elementSize(ValueType t);
41bool isIntegerType(ValueType t);
42bool isFloatType(ValueType t); // double or single
43
44} // namespace nk