Event

Pass data between threads

Constructors

this
this(ulong code, in T value)

Members

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

1 auto a = Event( 1, [ 0.1, 0.2, 0.3 ] );
2 assertEq( a.as!(double[]), [ 0.1, 0.2, 0.3 ] );
3 auto b = Event( 1, "some string"w );
4 assertEq( b.as!wstring, "some string"w );
5 auto c = Event( 1, "some str" );
6 auto d = shared Event( c );
7 assertEq( c.as!string, "some str" );
8 assertEq( d.as!string, "some str" );
9 assertEq( c.code, d.code );
10 
11 struct TestStruct { double x, y; string info; immutable(int)[] data; }
12 
13 auto ts = TestStruct( 10.1, 12.3, "hello", [1,2,3,4] );
14 auto e = Event( 1, ts );
15 
16 auto f = shared Event( e );
17 auto g = immutable Event( e );
18 auto h = shared const Event( e );
19 
20 assertEq( e.as!TestStruct, ts );
21 assertEq( f.as!TestStruct, ts );
22 assertEq( g.as!TestStruct, ts );
23 assertEq( h.as!TestStruct, ts );
24 
25 assertEq( Event(f).as!TestStruct, ts );
26 assertEq( Event(g).as!TestStruct, ts );
27 assertEq( Event(h).as!TestStruct, ts );
1 static struct TestStruct { double x, y; string info; immutable(int)[] data; }
2 auto ts = TestStruct( 3.14, 2.7, "hello", [ 2, 3, 4 ] );
3 
4 auto a = Event( 8, ts );
5 auto ac = const Event( a );
6 auto ai = immutable Event( a );
7 auto as = shared Event( a );
8 auto acs = const shared Event( a );
9 
10 assertEq( a.as!TestStruct, ts );
11 assertEq( ac.as!TestStruct, ts );
12 assertEq( ai.as!TestStruct, ts );
13 assertEq( as.as!TestStruct, ts );
14 assertEq( acs.as!TestStruct, ts );

Meta