NEST  2.6.0,not_revisioned_source_dir@0
connector_model.h
Go to the documentation of this file.
1 /*
2  * connector_model.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 #ifndef CONNECTOR_MODEL_H
24 #define CONNECTOR_MODEL_H
25 
26 #include "nest_time.h"
27 #include "dictutils.h"
28 #include "nest.h"
29 #include <cmath>
30 
31 namespace nest
32 {
33  class ConnectorBase;
34  class CommonSynapseProperties;
35  class TimeConverter;
36  class Node;
37 
39  {
40 
41  public:
42  ConnectorModel(Network & net, const std::string);
43  ConnectorModel(const ConnectorModel &, const std::string);
44  virtual ~ConnectorModel() {}
45 
46  size_t get_num_connections() const;
47 
48  const Time & get_min_delay() const { return min_delay_; }
49  const Time & get_max_delay() const { return max_delay_; }
50 
51  void update_delay_extrema(const double_t mindelay_cand, const double_t maxdelay_cand);
52 
58  virtual ConnectorBase * add_connection(Node & src, Node & tgt, ConnectorBase* conn, synindex syn_id,
59  double_t delay=NAN, double_t weight=NAN) = 0;
60  virtual ConnectorBase * add_connection(Node & src, Node & tgt, ConnectorBase* conn, synindex syn_id,
62 
63  virtual ConnectorModel* clone(std::string) const = 0;
64 
65  virtual void calibrate(const TimeConverter & tc) = 0;
66 
67  virtual void get_status(DictionaryDatum &) const = 0;
68  virtual void set_status(const DictionaryDatum &) = 0;
69 
70  virtual const CommonSynapseProperties & get_common_properties() const = 0;
71 
72  virtual void set_syn_id(synindex syn_id) = 0;
73 
74 
81 
92 
93  std::string get_name() const { return name_; }
94 
96 
97  Network & network() const { return net_; }
98 
99  protected:
107  std::string name_;
108 
109  }; // ConnectorModel
110 
111 
112  template < typename ConnectionT >
114  {
115  typename ConnectionT::CommonPropertiesType cp_;
116  ConnectionT default_connection_;
118 
119  public:
120 
121  GenericConnectorModel(Network & net, const std::string name)
122  : ConnectorModel(net, name),
123  receptor_type_(0)
124  {}
125 
126  GenericConnectorModel(const GenericConnectorModel &cm, const std::string name)
127  : ConnectorModel(cm, name),
128  cp_(cm.cp_),
131  {}
132 
133  ConnectorBase* add_connection(Node& src, Node& tgt, ConnectorBase* conn, synindex syn_id,
135  ConnectorBase* add_connection(Node& src, Node& tgt, ConnectorBase* conn, synindex syn_id,
137 
138  ConnectorModel* clone(std::string) const;
139 
140  void calibrate(const TimeConverter &tc);
141 
142  void get_status(DictionaryDatum &) const;
143  void set_status(const DictionaryDatum &);
144 
145  typename ConnectionT::CommonPropertiesType const & get_common_properties() const { return cp_; }
146 
147  void set_syn_id(synindex syn_id);
148 
149  ConnectionT const & get_default_connection() const { return default_connection_; }
150 
151  private:
152 
153  void used_default_delay();
154 
155  ConnectorBase * add_connection(Node& src, Node& tgt, ConnectorBase* conn, synindex syn_id,
156  ConnectionT& c, rport receptor_type);
157 
158  }; // GenericConnectorModel
159 
160 inline
162 {
163  return num_connections_;
164 }
165 
166 
167 } // namespace nest
168 
169 #endif /* #ifndef CONNECTOR_MODEL_H */
ConnectionT default_connection_
Definition: connector_model.h:116
bool default_delay_needs_check_
Flag indicating, that the default delay must be checked.
Definition: connector_model.h:104
double_t weight
Weight of a connection.
Definition: nest.h:170
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
ConnectionT::CommonPropertiesType cp_
Definition: connector_model.h:115
virtual ~ConnectorModel()
Definition: connector_model.h:44
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
const Time & get_max_delay() const
Definition: connector_model.h:49
void set_status(const DictionaryDatum &)
Definition: connector_model_impl.h:136
ConnectionT const & get_default_connection() const
Definition: connector_model.h:149
Definition: connector_base.h:88
void assert_two_valid_delays_steps(long_t, long_t)
Raise exception if either of the two delays in steps is invalid.
Definition: connector_model.cpp:113
const Time & get_min_delay() const
Definition: connector_model.h:48
GenericConnectorModel(const GenericConnectorModel &cm, const std::string name)
Definition: connector_model.h:126
ConnectorModel * clone(std::string) const
Definition: connector_model_impl.h:89
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
virtual ConnectorBase * add_connection(Node &src, Node &tgt, ConnectorBase *conn, synindex syn_id, double_t delay=NAN, double_t weight=NAN)=0
NAN is a special value in cmath, which describes double values that are not a number.
virtual const CommonSynapseProperties & get_common_properties() const =0
Time max_delay_
Maximal delay of all created synapses.
Definition: connector_model.h:102
virtual void set_status(const DictionaryDatum &)=0
ConnectorModel(Network &net, const std::string)
Definition: connector_model.cpp:30
Network & net_
The Network instance.
Definition: connector_model.h:100
ConnectionT::CommonPropertiesType const & get_common_properties() const
Definition: connector_model.h:145
virtual void get_status(DictionaryDatum &) const =0
Network & network() const
Definition: connector_model.h:97
size_t num_connections_
The number of connections registered with this type.
Definition: connector_model.h:103
std::string get_name() const
Definition: connector_model.h:93
bool get_user_set_delay_extrema() const
Definition: connector_model.h:95
Definition: nest_time.h:130
virtual void calibrate(const TimeConverter &tc)=0
virtual void set_syn_id(synindex syn_id)=0
void set_syn_id(synindex syn_id)
Definition: connector_model_impl.h:230
GenericConnectorModel(Network &net, const std::string name)
Definition: connector_model.h:121
size_t get_num_connections() const
Definition: connector_model.h:161
rport receptor_type_
Definition: connector_model.h:117
Main administrative interface to the network.
Definition: network.h:135
Time min_delay_
Minimal delay of all created synapses.
Definition: connector_model.h:101
Class to convert times from one representation to another.
Definition: nest_timeconverter.h:45
void used_default_delay()
Definition: connector_model_impl.h:216
virtual ConnectorModel * clone(std::string) const =0
double double_t
Double precision floating point numbers.
Definition: nest.h:93
std::string name_
Definition: connector_model.h:107
bool user_set_delay_extrema_
Flag indicating if the user set the delay extrema.
Definition: connector_model.h:105
bool used_default_delay_
Definition: connector_model.h:106
Class containing the common properties for all connections of a certain type.
Definition: common_synapse_properties.h:44
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
void get_status(DictionaryDatum &) const
Definition: connector_model_impl.h:110
long_t delay
Delay of a connection.
Definition: nest.h:178
Default types used by the NEST kernel.
Base class for all NEST network objects.
Definition: node.h:96
void calibrate(const TimeConverter &tc)
Definition: connector_model_impl.h:95
void assert_valid_delay_ms(double_t)
Raise exception if delay value in milliseconds is invalid.
Definition: connector_model.cpp:67
const Name c("c")
Specific to Izhikevich 2003.
Definition: nest_names.h:62
Definition: connector_model.h:38
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
Definition: connector_model.h:113
ConnectorBase * add_connection(Node &src, Node &tgt, ConnectorBase *conn, synindex syn_id, double_t weight, double_t delay)
delay and weight have the default value NAN.
Definition: connector_model_impl.h:242
void update_delay_extrema(const double_t mindelay_cand, const double_t maxdelay_cand)
Definition: connector_model.cpp:53