diff options
author | Jan Huwald <jh@sotun.de> | 2012-05-07 19:53:27 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2012-05-07 19:53:27 (GMT) |
commit | 00b209240138660db1ded3ef3870023964ce6e4e (patch) | |
tree | 8ffaec780b060bdc478929aa714b8af2ee760671 /code/core/event.h |
Diffstat (limited to 'code/core/event.h')
-rw-r--r-- | code/core/event.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/code/core/event.h b/code/core/event.h new file mode 100644 index 0000000..20d348a --- /dev/null +++ b/code/core/event.h @@ -0,0 +1,74 @@ +#ifndef EVENT_H +#define EVENT_H + +class Event { +public: + double time; + int type; + + Event(double ti, int ty) : time(ti), type(ty) {} + void execute(); + void free(); + bool operator>(Event &e1); // comparison of two events regarding their order in the event list; spike events are processed prior to non-spike events (as spikes are incoming and non-spike are intrinsic and depending on all events up to the present) + +private: + Event() {}; +}; + +class Spike : public Event { +public: + int dst; + double current; + + Spike(double time, int type, int dst, double current) : Event(time, type), dst(dst), current(current) {} + void execute(); +}; + + +class ExternalSpike : public Spike { +public: + ExternalSpike(double time, int dst, double current) : Spike(time, 1, dst, current) {} + void execute(); +}; + +class InternalSpike : public Spike { +public: + Synapse *synapse; + + InternalSpike(double time, int dst, double current, Synapse *synapse) : Spike(time, 0, dst, current), synapse(synapse) {} + void execute(); +}; + +class IntrinsicNeuron : public Event { +public: + int dst; + + IntrinsicNeuron(double time, int dst) : Event(time, 3), dst(dst) {} + void execute(); +}; + +class ExternalNoise : public Event { +public: + ExternalNoise(double time) : Event(time, 2) {} + void execute(); +}; + +class VirtualEvent : public Event { +public: + VirtualEvent(double time) : Event(time, 4) {} + virtual void vexecute() {} + virtual ~VirtualEvent() {} +}; + +class GlobalUpdate : public VirtualEvent { +public: + GlobalUpdate(double time) : VirtualEvent(time) {} + virtual void vexecute(); +}; + +class PEventGreater { +public: + bool operator() (Event *e1, Event *e2) { return *e1 > *e2; } +}; + +#endif // EVENT_H |