NEST
2.6.0,not_revisioned_source_dir@0
|
Base class for all recording devices. More...
#include <recording_device.h>
Classes | |
struct | Buffers_ |
struct | Parameters_ |
struct | State_ |
Public Types | |
enum | Mode { SPIKE_DETECTOR, MULTIMETER, SPIN_DETECTOR } |
Device mode. More... | |
Public Member Functions | |
RecordingDevice (const Node &, Mode, const std::string &, bool, bool, bool=false) | |
Create recording device information. More... | |
RecordingDevice (const Node &, const RecordingDevice &) | |
Copy from prototype member. More... | |
virtual | ~RecordingDevice () |
void | init_parameters (const RecordingDevice &) |
void | init_state (const RecordingDevice &) |
void | init_buffers () |
Close file stream. More... | |
void | calibrate () |
Ensure streams are open for writing. More... | |
void | finalize () |
Flush output stream if requested. More... | |
void | record_event (const Event &, bool endrecord=true) |
Record common information for one event. More... | |
template<typename ValueT > | |
void | print_value (const ValueT &, bool endrecord=true) |
Print single item of type ValueT. More... | |
bool | is_active (Time const &T) const |
Indicate if recording device is active. More... | |
void | get_status (DictionaryDatum &) const |
void | set_status (const DictionaryDatum &) |
Set properties of recording device. More... | |
template<typename DataT > | |
void | set_status (const DictionaryDatum &, DataT &t) |
Special version for recorders that need to have their data cleared. More... | |
bool | to_screen () const |
bool | to_file () const |
bool | to_memory () const |
bool | to_accumulator () const |
void | set_precise (bool use_precise, long precision) |
Public Member Functions inherited from nest::Device | |
Device () | |
Device (const Device &n) | |
virtual | ~Device () |
virtual void | init_parameters (const Device &) |
Reset parameters to those of model; also resets state. More... | |
virtual void | init_state (const Device &) |
Reset dynamic state to that of model. More... | |
long_t | get_t_min_ () const |
Return lower limit in steps. More... | |
long_t | get_t_max_ () const |
Return upper limit in steps. More... | |
Time const & | get_origin () const |
Time const & | get_start () const |
Time const & | get_stop () const |
Private Member Functions | |
void | print_time_ (std::ostream &, const Time &, double offset) |
Print the time-stamp according to the recorder's flags. More... | |
void | print_id_ (std::ostream &, index) |
Print a node's global ID and/or address, according to the recorder's flags. More... | |
void | print_weight_ (std::ostream &, double) |
Print the weight of an event. More... | |
void | store_data_ (index, const Time &, double, double) |
Store data in internal structure. More... | |
void | clear_data_ () |
Clear data in internal structure, and call clear_data_hook(). More... | |
void | flush_stream_ () |
Flush output stream (not std::cout). More... | |
const std::string | build_filename_ () const |
Build filename from parts. More... | |
Private Attributes | |
const Node & | node_ |
node to which device instance belongs More... | |
const Mode | mode_ |
operating mode, depends on owning node More... | |
Parameters_ | P_ |
State_ | S_ |
Buffers_ | B_ |
Buffers_ | V_ |
Base class for all recording devices.
Recording devices collect data and output it to the screen, store it internally or write it to files. This class provides for time windowing of data registration, temporary storage of data and output of data to files.
If the device is configured to record from start to stop, this is interpreted as (start, stop], i.e., the earliest recorded event will have time stamp start+1, as it was generated during the update step (start, start+1].
Class RecordingDevice by itself manages the identity and time of the recorded events, including precise event times, but not any additional data about the events. Use class AnalogRecordingDevice if you need to store additional data; that class also provides sampling at a given interval.
Device mode.
Enumerator | |
---|---|
SPIKE_DETECTOR | |
MULTIMETER | |
SPIN_DETECTOR |
nest::RecordingDevice::RecordingDevice | ( | const Node & | n, |
Mode | mode, | ||
const std::string & | file_ext, | ||
bool | withtime, | ||
bool | withgid, | ||
bool | withweight = false |
||
) |
Create recording device information.
Node | of which the device is member. |
Mode | of recording device. |
Default | file name extension, excluding ".". |
Default | value for withtime property |
Default | value for withgid property |
Default | value for withweight property |
nest::RecordingDevice::RecordingDevice | ( | const Node & | n, |
const RecordingDevice & | d | ||
) |
Copy from prototype member.
Node | of which the device is member. |
Prototype | member to copy |
|
inlinevirtual |
|
private |
Build filename from parts.
References nest::Network::get_data_path(), nest::Network::get_data_prefix(), nest::Communicator::get_num_virtual_processes(), and nest::Node::network().
|
virtual |
Ensure streams are open for writing.
Reimplemented from nest::Device.
References assert(), nest::names::binary, nest::Device::calibrate(), SLIInterpreter::M_ERROR, SLIInterpreter::M_INFO, nest::Network::message(), nest::Node::network(), nest::Network::overwrite_files(), and nest::names::scientific.
Referenced by nest::Multimeter::calibrate().
|
private |
Clear data in internal structure, and call clear_data_hook().
|
virtual |
Flush output stream if requested.
Reimplemented from nest::Device.
References SLIInterpreter::M_ERROR, nest::Network::message(), and nest::Node::network().
Referenced by nest::spin_detector::finalize(), nest::spike_detector::finalize(), and nest::Multimeter::finalize().
|
private |
Flush output stream (not std::cout).
|
inlinevirtual |
Reimplemented from nest::Device.
References nest::names::element_type, nest::RecordingDevice::Parameters_::get(), nest::RecordingDevice::State_::get(), nest::Device::get_status(), P_, nest::names::recorder, and S_.
|
virtual |
Close file stream.
Reimplemented from nest::Device.
References nest::Device::init_buffers().
Referenced by nest::Multimeter::init_buffers_().
void nest::RecordingDevice::init_parameters | ( | const RecordingDevice & | pr | ) |
References nest::Device::init_parameters(), P_, and S_.
void nest::RecordingDevice::init_state | ( | const RecordingDevice & | pr | ) |
References nest::Device::init_state(), and S_.
Referenced by nest::Multimeter::init_state_().
|
inlinevirtual |
Indicate if recording device is active.
The argument is the time stamp of the event, and the device is active if start_ < T <= stop_.
Implements nest::Device.
References nest::Time::get_steps(), nest::Device::get_t_max_(), and nest::Device::get_t_min_().
|
private |
Print a node's global ID and/or address, according to the recorder's flags.
|
private |
Print the time-stamp according to the recorder's flags.
The following combinations are possible: time_in_steps & precise_times: give steps and offsets separately time_in_steps : give steps, ignore offsets precise_times: give time in ms, take into account offsets none set : give time in ms, ignore offsets
References nest::Time::get_ms(), and nest::Time::get_steps().
void nest::RecordingDevice::print_value | ( | const ValueT & | value, |
bool | endrecord = true |
||
) |
Print single item of type ValueT.
endrecord | pass false if more data is to come on same line. |
References B_, nest::RecordingDevice::Buffers_::fs_, P_, nest::RecordingDevice::Parameters_::to_file_, and nest::RecordingDevice::Parameters_::to_screen_.
Referenced by nest::Multimeter::print_value_().
|
private |
Print the weight of an event.
void nest::RecordingDevice::record_event | ( | const Event & | event, |
bool | endrecord = true |
||
) |
Record common information for one event.
This function extracts sender and time information from the given event and handles it as specified by the Recorder settings. The following information is extracted:
endrecord | pass false if more data is to come on same line |
References nest::names::offset.
Referenced by nest::Multimeter::handle().
|
inline |
|
virtual |
Set properties of recording device.
Setting properties of recording devices is special:
Reimplemented from nest::Device.
References nest::RecordingDevice::State_::clear_events(), nest::RecordingDevice::Parameters_::set(), nest::RecordingDevice::State_::set(), and nest::Device::set_status().
Referenced by set_status().
void nest::RecordingDevice::set_status | ( | const DictionaryDatum & | d, |
DataT & | t | ||
) |
Special version for recorders that need to have their data cleared.
This version of set_status() should be used by recording devices that need to clear their own data upon setting n_events to 0.
dictionary | with parameters to set |
t | is pointer to the data that is to be cleared, must support t->clear() |
References nest::RecordingDevice::State_::events_, S_, and set_status().
|
private |
Store data in internal structure.
References nest::Time::get_ms(), and nest::Time::get_steps().
|
inline |
References P_, and nest::RecordingDevice::Parameters_::to_accumulator_.
Referenced by nest::Multimeter::add_data_(), and nest::Multimeter::handle().
|
inline |
References P_, and nest::RecordingDevice::Parameters_::to_file_.
|
inline |
References P_, and nest::RecordingDevice::Parameters_::to_memory_.
Referenced by nest::Multimeter::handle().
|
inline |
References P_, and nest::RecordingDevice::Parameters_::to_screen_.
|
private |
Referenced by print_value().
|
private |
operating mode, depends on owning node
Referenced by nest::RecordingDevice::Parameters_::get(), and nest::RecordingDevice::Parameters_::set().
|
private |
node to which device instance belongs
|
private |
Referenced by get_status(), init_parameters(), print_value(), set_precise(), to_accumulator(), to_file(), to_memory(), and to_screen().
|
private |
Referenced by get_status(), init_parameters(), init_state(), and set_status().
|
private |