haxe/src/haxe/Timer.cs
// Generated by Haxe 4.3.7
#pragma warning disable 109, 114, 219, 429, 168, 162
namespace haxe {
public class Timer : global::haxe.lang.HxObject {
public Timer(global::haxe.lang.EmptyObject empty) {
}
public Timer(int time_ms) {
global::haxe.Timer.__hx_ctor_haxe_Timer(this, time_ms);
}
protected static void __hx_ctor_haxe_Timer(global::haxe.Timer __hx_this, int time_ms) {
__hx_this.run = ( (( global::haxe.Timer___hx_ctor_haxe_Timer_134__Fun.__hx_current != null )) ? (global::haxe.Timer___hx_ctor_haxe_Timer_134__Fun.__hx_current) : (global::haxe.Timer___hx_ctor_haxe_Timer_134__Fun.__hx_current = ((global::haxe.Timer___hx_ctor_haxe_Timer_134__Fun) (new global::haxe.Timer___hx_ctor_haxe_Timer_134__Fun()) )) );
{
__hx_this.thread = ((global::sys.thread._Thread.HaxeThread) (global::sys.thread._Thread.HaxeThread.current()) );
global::haxe.Timer _gthis = __hx_this;
__hx_this.eventHandler = global::sys.thread._Thread.Thread_Impl_.get_events(__hx_this.thread).repeat(new global::haxe.Timer___hx_ctor_haxe_Timer_81__Fun(_gthis), time_ms);
}
}
public static global::haxe.Timer delay(global::haxe.lang.Function f, int time_ms) {
global::haxe.Timer t = new global::haxe.Timer(((int) (time_ms) ));
t.run = new global::haxe.Timer_delay_147__Fun(t, f);
return t;
}
public static T measure<T>(global::haxe.lang.Function f, object pos) {
double t0 = global::haxe.Timer.stamp();
T r = global::haxe.lang.Runtime.genericCast<T>(f.__hx_invoke0_o());
global::haxe.Log.trace.__hx_invoke2_o(default(double), global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.toString(( global::haxe.Timer.stamp() - t0 )), "s"), default(double), pos);
return r;
}
public static double stamp() {
return global::Sys.time();
}
public global::sys.thread._Thread.HaxeThread thread;
public global::sys.thread._EventLoop.RegularEvent eventHandler;
public virtual void stop() {
global::sys.thread._Thread.Thread_Impl_.get_events(this.thread).cancel(this.eventHandler);
}
public global::haxe.lang.Function run;
public override object __hx_setField(string field, int hash, object @value, bool handleProperties) {
unchecked {
switch (hash) {
case 5695307:
{
this.run = ((global::haxe.lang.Function) (@value) );
return @value;
}
case 1445635792:
{
this.eventHandler = ((global::sys.thread._EventLoop.RegularEvent) (@value) );
return @value;
}
case 247036618:
{
this.thread = ((global::sys.thread._Thread.HaxeThread) (@value) );
return @value;
}
default:
{
return base.__hx_setField(field, hash, @value, handleProperties);
}
}
}
}
public override object __hx_getField(string field, int hash, bool throwErrors, bool isCheck, bool handleProperties) {
unchecked {
switch (hash) {
case 5695307:
{
return this.run;
}
case 1281093634:
{
return ((global::haxe.lang.Function) (new global::haxe.lang.Closure(this, "stop", 1281093634)) );
}
case 1445635792:
{
return this.eventHandler;
}
case 247036618:
{
return this.thread;
}
default:
{
return base.__hx_getField(field, hash, throwErrors, isCheck, handleProperties);
}
}
}
}
public override object __hx_invokeField(string field, int hash, object[] dynargs) {
unchecked {
switch (hash) {
case 1281093634:
{
this.stop();
break;
}
default:
{
return base.__hx_invokeField(field, hash, dynargs);
}
}
return null;
}
}
public override void __hx_getFields(global::Array<string> baseArr) {
baseArr.push("run");
baseArr.push("eventHandler");
baseArr.push("thread");
base.__hx_getFields(baseArr);
}
}
}
#pragma warning disable 109, 114, 219, 429, 168, 162
namespace haxe {
public class Timer___hx_ctor_haxe_Timer_134__Fun : global::haxe.lang.Function {
public Timer___hx_ctor_haxe_Timer_134__Fun() : base(0, 0) {
}
public static global::haxe.Timer___hx_ctor_haxe_Timer_134__Fun __hx_current;
public override object __hx_invoke0_o() {
return null;
}
}
}
#pragma warning disable 109, 114, 219, 429, 168, 162
namespace haxe {
public class Timer___hx_ctor_haxe_Timer_81__Fun : global::haxe.lang.Function {
public Timer___hx_ctor_haxe_Timer_81__Fun(global::haxe.Timer _gthis) : base(0, 0) {
this._gthis = _gthis;
}
public override object __hx_invoke0_o() {
this._gthis.run.__hx_invoke0_o();
return null;
}
public global::haxe.Timer _gthis;
}
}
#pragma warning disable 109, 114, 219, 429, 168, 162
namespace haxe {
public class Timer_delay_147__Fun : global::haxe.lang.Function {
public Timer_delay_147__Fun(global::haxe.Timer t, global::haxe.lang.Function f) : base(0, 0) {
this.t = t;
this.f = f;
}
public override object __hx_invoke0_o() {
this.t.stop();
this.f.__hx_invoke0_o();
return null;
}
public global::haxe.Timer t;
public global::haxe.lang.Function f;
}
}