NEST main@caf0ae8
 
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
105 {
106 return false;
107 }
108 bool
109 one_node_per_process() const
110 {
111 return true;
112 }
113
119 using Node::handle;
120 using Node::handles_test_event;
121
122 void handle( SpikeEvent& );
123 size_t send_test_event( Node&, size_t, synindex, bool );
124
125 void get_status( Dictionary& ) const;
126 void set_status( const Dictionary& );
127
128private:
129 void init_buffers_();
130 void pre_run_hook();
131
132 void
133 update( Time const&, const long, const long )
134 {
135 }
136
137 // ------------------------------------------------------------
138 struct State_;
139
140 struct Parameters_
141 {
142 std::string port_name_;
143 long channel_;
144
145 Parameters_();
146
147 void get( Dictionary& ) const;
148
152 void set( const Dictionary&, State_& );
153 };
154
155 // ------------------------------------------------------------
156
157 struct State_
158 {
159 bool registered_;
161
162 State_();
163
164 void get( Dictionary& ) const;
166 void set( const Dictionary&, const Parameters_& );
167 };
168
169 // ------------------------------------------------------------
170
171 Parameters_ P_;
172 State_ S_;
173};
174
175inline size_t
176music_event_in_proxy::send_test_event( Node& target, size_t receptor_type, synindex, bool )
177{
178 SpikeEvent e;
179 e.set_sender( *this );
180
181 return target.handles_test_event( e, receptor_type );
182}
183
184} // namespace
185
186#endif
187
188#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