NEST main@caf0ae8
 
Loading...
Searching...
No Matches
io_manager.h
Go to the documentation of this file.
1/*
2 * io_manager.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 IO_MANAGER_H
24#define IO_MANAGER_H
25
26// C++ includes:
27#include <string>
28
29// Includes from libnestutil:
30#include "manager_interface.h"
31
32#include "recording_backend.h"
33#include "stimulation_backend.h"
34
35namespace nest
36{
37
49{
50public:
51 IOManager();
52 ~IOManager() override;
53
54 void initialize( const bool ) override;
55 void finalize( const bool ) override;
56 void set_status( const Dictionary& ) override;
57 void get_status( Dictionary& ) override;
58
59 void set_recording_backend_status( std::string, const Dictionary& );
61
68 const std::string& get_data_prefix() const;
69
76 const std::string& get_data_path() const;
77
84 bool overwrite_files() const;
85
90 void post_run_hook();
91 void pre_run_hook();
92
97 void post_step_hook();
98
104 void cleanup() override;
105 void prepare() override;
106
107 template < class RecordingBackendT >
108 void register_recording_backend( const std::string& );
109 template < class StimulationBackendT >
110 void register_stimulation_backend( const std::string& );
111
112 bool is_valid_recording_backend( const std::string& ) const;
113 bool is_valid_stimulation_backend( const std::string& ) const;
114
132 void write( const std::string&,
133 const RecordingDevice&,
134 const Event&,
135 const std::vector< double >&,
136 const std::vector< long >& );
137
138 void enroll_recorder( const std::string&, const RecordingDevice&, const Dictionary& );
139 void enroll_stimulator( const std::string&, StimulationDevice&, const Dictionary& );
140
141 void set_recording_value_names( const std::string& backend_name,
142 const RecordingDevice& device,
143 const std::vector< std::string >& double_value_names,
144 const std::vector< std::string >& long_value_names );
145
146 void check_recording_backend_device_status( const std::string&, const Dictionary& );
147 void get_recording_backend_device_defaults( const std::string&, Dictionary& );
148 void get_recording_backend_device_status( const std::string&, const RecordingDevice&, Dictionary& );
149
150private:
151 void set_data_path_prefix_( const Dictionary& );
152
153 std::string data_path_;
154 std::string data_prefix_;
156
160 std::map< std::string, RecordingBackend* > recording_backends_;
161
165 std::map< std::string, StimulationBackend* > stimulation_backends_;
166};
167
168inline const std::string&
170{
171 return data_path_;
172}
173
174inline const std::string&
176{
177 return data_prefix_;
178}
179
180inline bool
182{
183 return overwrite_files_;
184}
185
186} // namespace nest
187
188#endif /* #ifndef IO_MANAGER_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Encapsulate information sent between nodes.
Definition event.h:103
Manager to handle everything related to input and output.
Definition io_manager.h:49
void set_status(const Dictionary &) override
Set the status of the manager.
Definition io_manager.cpp:195
void pre_run_hook()
Definition io_manager.cpp:234
~IOManager() override
Definition io_manager.cpp:64
void register_stimulation_backend(const std::string &)
Definition io_manager_impl.h:47
void register_recording_backend(const std::string &)
Definition io_manager_impl.h:33
void get_status(Dictionary &) override
Retrieve the status of the manager.
Definition io_manager.cpp:212
void get_recording_backend_device_status(const std::string &, const RecordingDevice &, Dictionary &)
Definition io_manager.cpp:385
void cleanup() override
Finalize all registered recording backends after a call to SimulationManager::simulate() or Simulatio...
Definition io_manager.cpp:282
void set_recording_value_names(const std::string &backend_name, const RecordingDevice &device, const std::vector< std::string > &double_value_names, const std::vector< std::string > &long_value_names)
Definition io_manager.cpp:364
void set_recording_backend_status(std::string, const Dictionary &)
Definition io_manager.cpp:189
const std::string & get_data_path() const
The path for files written by devices.
Definition io_manager.h:169
void initialize(const bool) override
Prepare manager for operation.
Definition io_manager.cpp:69
const std::string & get_data_prefix() const
The prefix for files written by devices.
Definition io_manager.h:175
IOManager()
Definition io_manager.cpp:59
std::map< std::string, StimulationBackend * > stimulation_backends_
A mapping from names to registered stimulation backends.
Definition io_manager.h:165
bool is_valid_recording_backend(const std::string &) const
Definition io_manager.cpp:295
void check_recording_backend_device_status(const std::string &, const Dictionary &)
Definition io_manager.cpp:373
Dictionary get_recording_backend_status(std::string)
Definition io_manager.cpp:203
void write(const std::string &, const RecordingDevice &, const Event &, const std::vector< double > &, const std::vector< long > &)
Send device data to a given recording backend.
Definition io_manager.cpp:307
void post_step_hook()
Clean up in all registered recording backends after a single simulation step by calling the backends'...
Definition io_manager.cpp:260
bool overwrite_files() const
Indicate if existing data files should be overwritten.
Definition io_manager.h:181
void get_recording_backend_device_defaults(const std::string &, Dictionary &)
Definition io_manager.cpp:379
void enroll_recorder(const std::string &, const RecordingDevice &, const Dictionary &)
Definition io_manager.cpp:317
std::string data_prefix_
Prefix for all files written by devices.
Definition io_manager.h:154
void prepare() override
Definition io_manager.cpp:269
bool overwrite_files_
If true, overwrite existing data files.
Definition io_manager.h:155
void enroll_stimulator(const std::string &, StimulationDevice &, const Dictionary &)
Definition io_manager.cpp:333
bool is_valid_stimulation_backend(const std::string &) const
Definition io_manager.cpp:301
std::map< std::string, RecordingBackend * > recording_backends_
A mapping from names to registered recording backends.
Definition io_manager.h:160
void set_data_path_prefix_(const Dictionary &)
Definition io_manager.cpp:143
void post_run_hook()
Clean up in all registered recording backends after a single call to run by calling the backends' pos...
Definition io_manager.cpp:247
void finalize(const bool) override
Take down manager after operation.
Definition io_manager.cpp:115
std::string data_path_
Path for all files written by devices.
Definition io_manager.h:153
Interface for kernel manager classes.
Definition manager_interface.h:46
Base class for all recording devices.
Definition recording_device.h:157
Base class for common properties of StimulationDevices.
Definition stimulation_device.h:154
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33