Event

Pass data between threads

Constructors

this
this(ulong code, T value)

Members

Aliases

Self
alias Self = typeof(this)
Undocumented in source.

Manifest constants

system_code
enum system_code;

ulong.max reserved system event code

Properties

as
T as [@property getter]

get data as type T

as
T as [@property getter]

get data as type T

as
T as [@property getter]

get data as type T

elapsed
ulong elapsed [@property getter]

elapsed time before create event

getUntypedData
immutable(void)[] getUntypedData [@property getter]
getUntypedData
immutable(void)[] getUntypedData [@property getter]
getUntypedData
immutable(void)[] getUntypedData [@property getter]
isSystem
bool isSystem [@property getter]

Static functions

system
auto system(SysEvData sed)

generate system event

Variables

code
ulong code;
data
PData data;

information in event

timestamp
ulong timestamp;

Examples

auto a = Event( 1, [ 0.1, 0.2, 0.3 ] );
assertEq( a.as!(double[]), [ 0.1, 0.2, 0.3 ] );
auto b = Event( 1, "some string"w );
assertEq( b.as!wstring, "some string"w );
auto c = Event( 1, "some str" );
auto d = shared Event( c );
assertEq( c.as!string, "some str" );
assertEq( d.as!string, "some str" );
assertEq( c.code, d.code );

struct TestStruct { double x, y; string info; immutable(int)[] data; }

auto ts = TestStruct( 10.1, 12.3, "hello", [1,2,3,4] );
auto e = Event( 1, ts );

auto f = shared Event( e );
auto g = immutable Event( e );
auto h = shared const Event( e );

assertEq( e.as!TestStruct, ts );
assertEq( f.as!TestStruct, ts );
assertEq( g.as!TestStruct, ts );
assertEq( h.as!TestStruct, ts );

assertEq( Event(f).as!TestStruct, ts );
assertEq( Event(g).as!TestStruct, ts );
assertEq( Event(h).as!TestStruct, ts );
static struct TestStruct { double x, y; string info; immutable(int)[] data; }
auto ts = TestStruct( 3.14, 2.7, "hello", [ 2, 3, 4 ] );

auto a = Event( 8, ts );
auto ac = const Event( a );
auto ai = immutable Event( a );
auto as = shared Event( a );
auto acs = const shared Event( a );

assertEq( a.as!TestStruct, ts );
assertEq( ac.as!TestStruct, ts );
assertEq( ai.as!TestStruct, ts );
assertEq( as.as!TestStruct, ts );
assertEq( acs.as!TestStruct, ts );

Meta