{# NEST event handlers template This template defines three C++ methods of the form: int modelName::handle (SpikeEvent &e) int modelName::handle (CurrentEvent &e) int modelName::handle (DataLoggingRequest& e) These methods handle receiving spike events, current injection events, and data logging requests, respectively. Template variables are: - modelName: the name of the current system - synapticEventDefs - a list of synaptic event objects that have the following fields: - pscName - descriptive name (label) of the post-synaptic conductance component - pscId - unique identifier of the post-synaptic conductance component - wthreshold - threshold for synaptic event weights - if defined, events with weight below wthreshold are discarded #} void {{modelName}}::handle(SpikeEvent & e) { int flag; assert(e.get_delay() > 0); flag = 0; {% for synapticEvent in synapticEventDefs %} if ((flag==0) && (e.get_rport() == {{synapticEvent.pscName}}_SPIKE_RECEPTOR ) && (e.get_weight() > {% if synapticEvent.wthreshold %}P_.{{synapticEvent.wthreshold}}{% else %}0.0{% endif %})) { B_.spike_{{synapticEvent.pscId}}.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()), fabs(e.get_weight()) * e.get_multiplicity()); flag = 1; } {% endfor %} } void {{modelName}}::handle(CurrentEvent& e) { assert(e.get_delay() > 0); const double_t c = e.get_current(); const double_t w = e.get_weight(); B_.currents_.add_value(e.get_rel_delivery_steps(network()->get_slice_origin()), w * c); } void {{modelName}}::handle(DataLoggingRequest& e) { B_.logger_.handle(e); }