NEST main@a355080
 
Loading...
Searching...
No Matches
music_event_in_proxy.h
Go to the documentation of this file.
1/*
2 * music_event_in_proxy.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 MUSIC_EVENT_IN_PROXY_H
24#define MUSIC_EVENT_IN_PROXY_H
25
26// Generated includes:
27#include "config.h"
28
29#ifdef HAVE_MUSIC
30
31// C++ includes:
32#include <vector>
33
34// Includes from nestkernel:
35#include "connection.h"
36#include "device_node.h"
37#include "event.h"
38#include "nest_types.h"
39
40namespace nest
41{
42void register_music_event_in_proxy( const std::string& name );
43
44/* BeginUserDocs: device, MUSIC, spike
45
46Short description
47+++++++++++++++++
48
49A device which receives spikes from MUSIC
50
51Description
52+++++++++++
53
54A ``music_event_in_proxy`` can be used to pass spikes to nodes within NEST
55which are received from another application.
56
57It uses the MUSIC library to receive spike events from other
58applications. The ``music_event_in_proxy`` represents one channel on a port
59to which MUSIC can connect an event source. The music_event_in_proxy can
60be connected to local neurons or devices within NEST to receive
61the events. Multiple ``music_in_proxies`` can be configured to listen
62on the same port, but each channel can only listened to by a
63single proxy.
64
65This model is only available if NEST was compiled with MUSIC.
66
67Parameters
68++++++++++
69
70The following properties are available in the status Dictionary:
71
72============== ======== =======================================================
73 port_name string The name of the MUSIC input port to listen to (default:
74 event_in)
75 music_channel integer The MUSIC global index on the input port to listen to
76 registered boolean A bool indicating if the port has been already
77 registered with the corresponding MUSIC event handler
78============== ======== =======================================================
79
80The parameters port_name and music_channel can be set using SetStatus.
81The acceptable latency of the MUSIC input port can be set using the
82command SetAcceptableLatency.
83
84See also
85++++++++
86
87SetAcceptableLatency, music_event_out_proxy, music_cont_in_proxy, music_message_in_proxy
88
89Examples using this model
90+++++++++++++++++++++++++
91
92.. listexamples:: music_event_in_proxy
93
94EndUserDocs */
95
96class music_event_in_proxy : public DeviceNode
97{
98
99public:
100 music_event_in_proxy();
101 music_event_in_proxy( const music_event_in_proxy& );
102
103 bool
104 has_proxies() const override
105 {
106 return false;
107 }
108 bool
109 one_node_per_process() const override
110 {
111 return true;
112 }
113 bool
114 local_receiver() const override
115 {
116 return true;
117 }
118
124 using Node::handle;
125 using Node::handles_test_event;
126
127 void handle( SpikeEvent& );
128 size_t send_test_event( Node&, size_t, synindex, bool );
129
130 void get_status( Dictionary& ) const;
131 void set_status( const Dictionary& );
132
133private:
134 void init_buffers_();
135 void pre_run_hook();
136
137 void
138 update( Time const&, const long, const long )
139 {
140 }
141
142 // ------------------------------------------------------------
143 struct State_;
144
145 struct Parameters_
146 {
147 std::string port_name_;
148 long channel_;
149
150 Parameters_();
151
152 void get( Dictionary& ) const;
153
157 void set( const Dictionary&, State_& );
158 };
159
160 // ------------------------------------------------------------
161
162 struct State_
163 {
164 bool registered_;
166
167 State_();
168
169 void get( Dictionary& ) const;
171 void set( const Dictionary&, const Parameters_& );
172 };
173
174 // ------------------------------------------------------------
175
176 Parameters_ P_;
177 State_ S_;
178};
179
180inline size_t
181music_event_in_proxy::send_test_event( Node& target, size_t receptor_type, synindex, bool )
182{
183 SpikeEvent e;
184 e.set_sender( *this );
185
186 return target.handles_test_event( e, receptor_type );
187}
188
189} // namespace
190
191#endif
192
193#endif /* #ifndef MUSIC_EVENT_IN_PROXY_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
const std::string target("target")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
const double e
Definition numerics.cpp:32