NEST main@caf0ae8
 
Loading...
Searching...
No Matches
device.h
Go to the documentation of this file.
1/*
2 * device.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 DEVICE_H
24#define DEVICE_H
25
26
27// Includes from nestkernel:
28#include "nest_time.h"
29#include "nest_types.h"
30#include "node.h"
31
32
33namespace nest
34{
35
59class Device
60{
61public:
62 Device();
63 Device( const Device& n );
64 virtual ~Device()
65 {
66 }
67
69 virtual void
71 {
72 }
73
75 virtual void
77 {
78 }
79
81 virtual void pre_run_hook();
82
83 virtual void get_status( Dictionary& ) const;
84 virtual void set_status( const Dictionary& );
85
90 virtual bool is_active( Time const& T ) const = 0;
91
97 long get_t_min_() const;
98
104 long get_t_max_() const;
105
106 Time const& get_origin() const;
107 Time const& get_start() const;
108 Time const& get_stop() const;
109
110private:
111 // ----------------------------------------------------------------
112
117 {
120
123
126
127 Parameters_();
128
130 Parameters_( const Parameters_& );
131
133
134 void get( Dictionary& ) const;
135 void set( const Dictionary& );
136
137 private:
139 static void update_( const Dictionary&, const std::string&, Time& );
140 };
141
142
143 // ----------------------------------------------------------------
144
149 {
150
159 long t_min_;
160
169 long t_max_;
170 };
171
172 // ----------------------------------------------------------------
173
176};
177
178inline void
180{
181 P_.get( d );
182}
183
184inline void
186{
187 Parameters_ ptmp = P_; // temporary copy in case of errors
188 ptmp.set( d ); // throws if BadProperty
189
190 // if we get here, temporaries contain consistent set of properties
191 P_ = ptmp;
192}
193
194inline Time const&
196{
197 return P_.origin_;
198}
199
200inline Time const&
202{
203 return P_.start_;
204}
205
206inline Time const&
208{
209 return P_.stop_;
210}
211
212inline long
214{
215 return V_.t_min_;
216}
217
218inline long
220{
221 return V_.t_max_;
222}
223
224} // namespace nest
225
226#endif /* DEVICE_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Class implementing common interface and properties common for all devices.
Definition device.h:60
Time const & get_start() const
Definition device.h:201
virtual void get_status(Dictionary &) const
Definition device.h:179
virtual void pre_run_hook()
Set internal variables before calls to SimulationManager::run()
Definition device.cpp:141
Time const & get_origin() const
Definition device.h:195
virtual bool is_active(Time const &T) const =0
Returns true if the device is active at the given time stamp.
Time const & get_stop() const
Definition device.h:207
long get_t_min_() const
Return lower limit in steps.
Definition device.h:213
virtual void init_buffers()
Reset buffers.
Definition device.h:76
long get_t_max_() const
Return upper limit in steps.
Definition device.h:219
Variables_ V_
Definition device.h:175
virtual void init_state()
Reset dynamic state to that of model.
Definition device.h:70
Parameters_ P_
Definition device.h:174
virtual void set_status(const Dictionary &)
Definition device.h:185
virtual ~Device()
Definition device.h:64
Device()
Definition device.cpp:125
Definition nest_time.h:135
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
Declarations for base class Node.
Independent parameters of the model.
Definition device.h:117
static void update_(const Dictionary &, const std::string &, Time &)
Update given Time parameter including error checking.
Definition device.cpp:85
Parameters_ & operator=(const Parameters_ &)
Definition device.cpp:62
Time start_
Stop time, relative to origin. Defaults to "infinity".
Definition device.h:122
Time origin_
Origin of device time axis, relative to network time. Defaults to 0.
Definition device.h:119
void get(Dictionary &) const
Store current values in dictionary.
Definition device.cpp:77
void set(const Dictionary &)
Set values from dictionary.
Definition device.cpp:108
Parameters_()
Sets default parameter values.
Definition device.cpp:41
Time stop_
Definition device.h:125
Internal variables of the model.
Definition device.h:149
long t_min_
Time step of device activation.
Definition device.h:159
long t_max_
Time step of device deactivation.
Definition device.h:169