Enzo
Loading...
Searching...
No Matches
enzo::expr::CompiledScript Class Reference

A compiled daslang program ready to run. More...

#include <DasRuntime.h>

Classes

struct  Impl
 

Public Member Functions

bool evalFloat (const String &functionName, const ExpressionContext *context, floatT &result, String &error)
 Evaluates an exported function as a float.
 
bool evalInt (const String &functionName, const ExpressionContext *context, intT &result, String &error)
 Evaluates an exported function as an integer.
 
bool evalString (const String &functionName, const ExpressionContext *context, String &result, String &error)
 Evaluates an exported function as a string.
 

Friends

class DasRuntime
 

Detailed Description

A compiled daslang program ready to run.

Reused across many evaluations so the cost of compiling is paid once. Each eval helper runs an exported function by name and returns its result.

Example

String error;
auto script = DasRuntime::instance().compile("expr", source, error);
floatT result = 0;
script->evalFloat("__eval__", result, error);
Note
daslang types stay inside the implementation so consumers never include daslang headers.

Member Function Documentation

◆ evalFloat()

bool enzo::expr::CompiledScript::evalFloat ( const String & functionName,
const ExpressionContext * context,
floatT & result,
String & error )

Evaluates an exported function as a float.

Returns
True on success, false when the function is missing or panics.

◆ evalInt()

bool enzo::expr::CompiledScript::evalInt ( const String & functionName,
const ExpressionContext * context,
intT & result,
String & error )

Evaluates an exported function as an integer.

Returns
True on success, false when the function is missing or panics.

◆ evalString()

bool enzo::expr::CompiledScript::evalString ( const String & functionName,
const ExpressionContext * context,
String & result,
String & error )

Evaluates an exported function as a string.

Returns
True on success, false when the function is missing or panics.

The documentation for this class was generated from the following files: