uCalc API Version: 2.1.3-preview.2 Released: 6/17/2026

Warning

uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.

DataTypes = [DataTypesAccessor]

Property

Product: 

Fast Math Parser

Class: 

uCalcBase

Provides access to the collection of all data types registered within the uCalc instance.

Remarks

📂 Accessing Data Types

The DataTypes property provides access to the collection of all DataType objects registered within the current uCalc instance. It is the primary tool for runtime introspection of the engine's type system.

This collection includes all built-in types (like Double, Int32, String) as well as any custom data types you have defined using the Define method.

⚙️ Usage

The returned DataTypesAccessor object behaves like a standard collection, allowing you to:

  • Iterate through all data types using a foreach loop.
  • Access a specific data type by its index.
  • Get the total number of defined types.

This is invaluable for building dynamic tools on top of uCalc, such as:

  • Debuggers and Inspectors: Programmatically list all available types and their properties.
  • Dynamic UI: Populate a dropdown menu with a list of valid types for a variable definition.
  • Code Generators: Write tools that can understand the uCalc type system to generate host-language code.

✨ Why uCalc? (Comparative Analysis)

  • vs. Native Reflection (C# typeof, C++ RTTI): Native reflection systems inspect the types available in the entire compiled application or assembly. DataTypes is more focused and safer; it operates only within the sandboxed context of a specific uCalc instance. It reveals the types known to the parser, not the entire host application. This makes it a tailored, lightweight introspection mechanism for the domain of expression evaluation.

Examples

Lists the names of all standard data types registered in the current uCalc instance.
				
					using uCalcSoftware;

var uc = new uCalc();
foreach(var Item in uc.DataTypes) {
   Console.WriteLine(Item.Name);
}
				
			
anytype
bool
bool
int8u
complex
double
single
int
int16
int16u
int
int32u
int64
int64u
int8
int8u
int
omnitype
pointer
sametypeas
single
size_t
string
void
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   for(auto Item : uc.DataTypes()) {
      cout << Item.Name() << endl;
   }
}
				
			
anytype
bool
bool
int8u
complex
double
single
int
int16
int16u
int
int32u
int64
int64u
int8
int8u
int
omnitype
pointer
sametypeas
single
size_t
string
void
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      For Each Item In uc.DataTypes
         Console.WriteLine(Item.Name)
      Next
   End Sub
End Module
				
			
anytype
bool
bool
int8u
complex
double
single
int
int16
int16u
int
int32u
int64
int64u
int8
int8u
int
omnitype
pointer
sametypeas
single
size_t
string
void