1 module eventy.signal;
2 
3 import eventy.event : Event;
4 
5 /**
6 * Signal
7 *
8 * Represents a signal handler that handles a given set of typeIDs
9 * which means that it contains an associated function to be run
10 * on handling of a given Event
11 */
12 //alias EventHandler = void function(Event);
13 
14 public abstract class Signal
15 {
16     /* TypeIDs this signal handler associates with */
17     private ulong[] typeIDs;
18 
19     /* Signal handler */
20     //private EventHandler handler;
21 
22     this(ulong[] typeIDs)
23     {
24         this.typeIDs = typeIDs;
25     }
26 
27     /**
28     * Returns true if this signal handles the given typeID
29     * false otherwise
30     */
31     public bool handles(ulong typeID)
32     {
33         /* FIXME: Implement */
34         foreach(ulong id; typeIDs)
35         {
36             if(id == typeID)
37             {
38                 return true;
39             }
40         }
41 
42         return false;
43     }
44 
45     public void registerTypeID(ulong typeID)
46     {
47 
48     }
49 
50     public void deregisterTypeID(ulong typeID)
51     {
52         
53     }
54 
55     public abstract void handler(Event);
56 }