This repository has been archived by the owner on Jan 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathstdpmodule.cpp
109 lines (93 loc) · 3.73 KB
/
stdpmodule.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* stdpmodule.cpp
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* NEST is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see <http://www.gnu.org/licenses/>.
*
*/
// include necessary NEST headers
#include "config.h"
#include "network.h"
#include "model.h"
#include "dynamicloader.h"
#include "genericmodel.h"
#include "booldatum.h"
#include "integerdatum.h"
#include "tokenarray.h"
#include "exceptions.h"
#include "sliexceptions.h"
#include "nestmodule.h"
#include "connector_model_impl.h"
#include "target_identifier.h"
// include headers with your own stuff
#include "stdpmodule.h"
#include "stdp_triplet_connection.h"
#include "stdp_triplet_node.h"
#include "stdp_longterm_node.h"
// -- Interface to dynamic module loader ---------------------------------------
/*
* The dynamic module loader must be able to find your module.
* You make the module known to the loader by defining an instance of your
* module class in global scope. This instance must have the name
*
* <modulename>_LTX_mod
*
* The dynamicloader can then load modulename and search for symbol "mod" in it.
*/
stdpmodule::STDPModule stdpmodule_LTX_mod;
// -- DynModule functions ------------------------------------------------------
stdpmodule::STDPModule::STDPModule() {
#ifdef LINKED_MODULE
// register this module at the dynamic loader
// this is needed to allow for linking in this module at compile time
// all registered modules will be initialized by the main app's dynamic loader
nest::DynamicLoaderModule::registerLinkedModule(this);
#endif
}
stdpmodule::STDPModule::~STDPModule() {}
const std::string stdpmodule::STDPModule::name(void) const {
return std::string("STDP Module"); // Return name of the module
}
const std::string stdpmodule::STDPModule::commandstring(void) const {
// Instruct the interpreter to load mymodule-init.sli
return std::string("(stdpmodule-init) run");
}
//------------------------------------------------------------------------------
void stdpmodule::STDPModule::init(SLIInterpreter *i) {
/* Register a neuron or device model.
Give node type as template argument and the name as second argument.
The first argument is always a reference to the network.
*/
nest::register_model<STDPTripletNeuron>(nest::NestModule::get_network(),
"stdp_triplet_node");
nest::register_model<STDPLongNeuron>(nest::NestModule::get_network(),
"stdp_longterm_node");
/* Register a synapse type.
Give synapse type as template argument and the name as second argument.
The first argument is always a reference to the network.
There are two choices for the template argument:
- nest::TargetIdentifierPtrRport
- nest::TargetIdentifierIndex
The first is the standard and you should usually stick to it.
nest::TargetIdentifierIndex reduces the memory requirement of synapses
even further, but limits the number of available rports. Please see
Kunkel et al, Front Neurofinfom 8:78 (2014), Sec 3.3.2, for details.
*/
nest::register_connection_model<
STDPTripletConnection<nest::TargetIdentifierPtrRport> >(
nest::NestModule::get_network(), "stdp_triplet_all_in_one_synapse");
}