NEST  2.6.0,not_revisioned_source_dir@0
music_cont_in_proxy.h
Go to the documentation of this file.
1 /*
2  * music_cont_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_CONT_IN_PROXY_H
24 #define MUSIC_CONT_IN_PROXY_H
25 
26 #include "config.h"
27 #ifdef HAVE_MUSIC
28 
29 #include <vector>
30 #include "nest.h"
31 #include "node.h"
32 #include "communicator.h"
33 #include "arraydatum.h"
34 
35 #include "mpi.h"
36 #include "music.hh"
37 
38 /*BeginDocumentation
39 
40 Name: music_cont_in_proxy - A device which receives continuous data from MUSIC.
41 
42 Description:
43 A music_cont_in_proxy can be used to receive continuous data from
44 remote MUSIC applications in NEST.
45 
46 It uses the MUSIC library to receive the data from other applications.
47 The music_cont_in_proxy represents a complete port to which MUSIC can
48 connect and send data. The music_cont_in_proxy can queried using
49 GetStatus to retrieve the messages.
50 
51 Parameters:
52 The following properties are available in the status dictionary:
53 
54 port_name - The name of the MUSIC input port to listen to (default:
55  cont_in)
56 port_width - The width of the MUSIC input port
57 data - The data received on the port as vector of doubles
58 published - A bool indicating if the port has been already published
59  with MUSIC
60 
61 The parameter port_name can be set using SetStatus.
62 
63 Examples:
64 /music_cont_in_proxy Create /mcip Set
65 10 Simulate
66 mcip GetStatus /data get /gaze_directions Set
67 
68 Author: Jochen Martin Eppler
69 FirstVersion: July 2010
70 Availability: Only when compiled with MUSIC
71 
72 SeeAlso: music_event_out_proxy, music_event_in_proxy, music_message_in_proxy
73 */
74 
75 namespace nest
76 {
82  class music_cont_in_proxy : public Node
83  {
84 
85  public:
88 
89  bool has_proxies() const {return false;}
90  bool one_node_per_process() const {return true;}
91 
92  void get_status(DictionaryDatum &) const;
93  void set_status(const DictionaryDatum &);
94 
95  private:
96 
97  void init_state_(const Node&);
98  void init_buffers_();
99  void calibrate();
100 
101  void update(Time const &, const long_t, const long_t) {}
102 
103  // ------------------------------------------------------------
104 
105  struct State_;
106 
107  struct Parameters_ {
108  std::string port_name_;
109 
110  Parameters_();
111  Parameters_(const Parameters_&);
112 
113  void get(DictionaryDatum&) const;
114  void set(const DictionaryDatum&, State_&);
115  };
116 
117  // ------------------------------------------------------------
118 
119  struct State_ {
120  bool published_;
122 
123  State_();
124 
125  void get(DictionaryDatum&) const;
126  void set(const DictionaryDatum&, const Parameters_&);
127  };
128 
129  // ------------------------------------------------------------
130 
131  struct Buffers_ {
132  std::vector<double> data_;
133  };
134 
135  // ------------------------------------------------------------
136 
137  struct Variables_ {
138  MUSIC::ContInputPort *MP_;
139  };
140 
141  // ------------------------------------------------------------
142 
147  };
148 
149 } // namespace
150 
151 #endif
152 
153 #endif /* #ifndef MUSIC_CONT_IN_PROXY_H */
void set(const DictionaryDatum &, State_ &)
Set values from dicitonary.
Definition: music_cont_in_proxy.cpp:63
Definition: lockptrdatum.h:40
Declarations for base class Node.
Buffers_ B_
Definition: music_cont_in_proxy.h:145
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: music_cont_in_proxy.h:101
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: music_cont_in_proxy.cpp:111
State_()
Sets default state value.
Definition: music_cont_in_proxy.cpp:49
Parameters_()
Sets default parameter values.
Definition: music_cont_in_proxy.cpp:41
Definition: music_cont_in_proxy.h:131
Definition: music_cont_in_proxy.h:137
music_cont_in_proxy()
Definition: music_cont_in_proxy.cpp:87
Definition: music_cont_in_proxy.h:107
Definition: music_cont_in_proxy.h:119
Definition: nest_time.h:130
Emit spikes at times received from another application via a MUSIC port.
Definition: music_cont_in_proxy.h:82
void set(const DictionaryDatum &, const Parameters_ &)
Set values from dicitonary.
Definition: music_cont_in_proxy.cpp:79
std::string port_name_
the name of MUSIC port to connect to
Definition: music_cont_in_proxy.h:108
int port_width_
the width of the MUSIC port
Definition: music_cont_in_proxy.h:121
State_ S_
Definition: music_cont_in_proxy.h:144
MUSIC::ContInputPort * MP_
The MUSIC cont port for input of data.
Definition: music_cont_in_proxy.h:138
Parameters_ P_
Definition: music_cont_in_proxy.h:143
bool published_
indicates whether this node has been published already with MUSIC
Definition: music_cont_in_proxy.h:120
std::vector< double > data_
The buffer for incoming data.
Definition: music_cont_in_proxy.h:132
bool has_proxies() const
Returns true if the node has proxies on remote threads.
Definition: music_cont_in_proxy.h:89
bool one_node_per_process() const
Returns true if the node exists only once per process, but does not have proxies on remote threads...
Definition: music_cont_in_proxy.h:90
void get_status(DictionaryDatum &) const
Definition: music_cont_in_proxy.cpp:146
void set_status(const DictionaryDatum &)
Definition: music_cont_in_proxy.cpp:154
Default types used by the NEST kernel.
void init_state_(const Node &)
Private function to initialize the state of a node to model defaults.
Definition: music_cont_in_proxy.cpp:104
Base class for all NEST network objects.
Definition: node.h:96
Variables_ V_
Definition: music_cont_in_proxy.h:146
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
void calibrate()
Re-calculate dependent parameters of the node.
Definition: music_cont_in_proxy.cpp:114