NEST main@caf0ae8
 
Loading...
Searching...
No Matches
connector_base_impl.h
Go to the documentation of this file.
1/*
2 * connector_base_impl.h
3 *
4 * This file is part of NEST.
5 *
6 * Copyright (C) 2004 The NEST Initiative
7 *
8 * NEST is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * NEST is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#include "connector_base.h"
24
25// Includes from nestkernel:
26#include "kernel_manager.h"
27
28// Includes from models:
29#include "weight_recorder.h"
30
31#ifndef CONNECTOR_BASE_IMPL_H
32#define CONNECTOR_BASE_IMPL_H
33
34namespace nest
35{
36
37template < typename ConnectionT >
38void
40 const unsigned int lcid,
41 Event& e,
42 const CommonSynapseProperties& cp )
43{
44 // If the pointer to the receiver node in the event is invalid,
45 // the event was not sent, and a WeightRecorderEvent is therefore not created.
46 if ( cp.get_weight_recorder() and e.receiver_is_valid() )
47 {
48 // Create new event to record the weight and copy relevant content.
50 wr_e.set_port( e.get_port() );
51 wr_e.set_rport( e.get_rport() );
52 wr_e.set_stamp( e.get_stamp() );
53 // Sender is not available for SecondaryEvents, and not needed, so we do not
54 // set it to avoid undefined behavior.
55 wr_e.set_sender_node_id( kernel().connection_manager.get_source_node_id( tid, syn_id_, lcid ) );
56 wr_e.set_weight( e.get_weight() );
57 wr_e.set_delay_steps( e.get_delay_steps() );
58 wr_e.set_receiver( *static_cast< Node* >( cp.get_weight_recorder() ) );
59 // Set the node_id of the postsynaptic node as receiver node ID
60 wr_e.set_receiver_node_id( e.get_receiver_node_id() );
61 wr_e();
62 }
63}
64
65} // of namespace nest
66
67#endif
Class containing the common properties for all connections of a certain type.
Definition common_synapse_properties.h:50
weight_recorder * get_weight_recorder() const
Get weight_recorder.
Definition common_synapse_properties.h:98
void send_weight_event(const size_t tid, const unsigned int lcid, Event &e, const CommonSynapseProperties &cp) override
Definition connector_base_impl.h:39
Encapsulate information sent between nodes.
Definition event.h:103
void set_receiver(Node &)
Change pointer to receiving Node.
Definition event.h:914
void set_port(size_t p)
Set the port number.
Definition event.h:1046
void set_stamp(Time const &)
Set the time stamp of the event.
Definition event.h:978
void set_weight(double t)
Set weight of the event.
Definition event.h:966
void set_sender_node_id(const size_t)
Change node ID of sending Node.
Definition event.h:926
void set_delay_steps(long)
Set the transmission delay of the event.
Definition event.h:1016
void set_rport(size_t p)
Set the receiver port number (r-port).
Definition event.h:1052
Base class for all NEST network objects.
Definition node.h:99
Event for recording the weight of a spike.
Definition event.h:459
void set_receiver_node_id(size_t)
Change node ID of receiving Node.
Definition event.h:492
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
KernelManager & kernel()
Definition kernel_manager.h:311