Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
Monitor.h
Go to the documentation of this file.
1 /*
2 * Copyright 2014-2018 Friedemann Zenke
3 *
4 * This file is part of Auryn, a simulation package for plastic
5 * spiking neural networks.
6 *
7 * Auryn is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Auryn is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Auryn. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * If you are using Auryn or parts of it for your work please cite:
21 * Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations
22 * of spiking neural networks using general-purpose computers.
23 * Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076
24 */
25 
26 #ifndef MONITOR_H_
27 #define MONITOR_H_
28 
29 #include "auryn_definitions.h"
30 #include "AurynVector.h"
31 #include "Device.h"
32 #include "System.h"
33 #include <fstream>
34 #include <string>
35 #include <algorithm>
36 
37 namespace auryn {
38 
39  class System;
40 
47  class Monitor : public Device
48  {
49  private:
51  void init(std::string filename);
52 
54  void free();
55 
56  protected:
58  std::ofstream outfile;
59 
62 
65 
66 
68  virtual void open_output_file(std::string filename);
69 
70 
72  virtual void virtual_serialize(boost::archive::binary_oarchive & ar, const unsigned int version ) ;
73  virtual void virtual_serialize(boost::archive::binary_iarchive & ar, const unsigned int version ) ;
74 
75  public:
77  bool active;
78 
80  virtual void flush();
81 
83  Monitor(std::string filename, std::string default_extension = "dat");
84 
86  Monitor();
87 
90 
92  virtual ~Monitor();
93  };
94 
95  extern System * sys;
96  extern Logger * logger;
97 }
98 
99 #endif /*MONITOR_H_*/
Abstract base class for all Monitor objects.
Definition: Monitor.h:47
Class that implements system wide variables and methods to manage and run simulations.
Definition: System.h:70
virtual void flush()
Flush to file.
Definition: Monitor.cpp:85
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
std::string generate_filename(std::string name_hint="")
Generates a default filename from the device ID.
Definition: Monitor.cpp:63
void init()
Standard initializer to be called by the constructor.
Definition: Device.cpp:32
std::ofstream outfile
Definition: Monitor.h:58
Definition: ABSConnection.h:38
A generic logger class that logs to screen and a log-file.
Definition: Logger.h:48
Monitor()
Constructor which does not open a text file for output.
Definition: Monitor.cpp:47
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
bool active
Standard active switch.
Definition: Monitor.h:77
virtual void virtual_serialize(boost::archive::binary_oarchive &ar, const unsigned int version)
Definition: Monitor.cpp:91
std::string fname
Definition: Monitor.h:61
std::string default_file_extension
Definition: Monitor.h:64
virtual ~Monitor()
Standard destructor.
Definition: Monitor.cpp:75
virtual void open_output_file(std::string filename)
Definition: Monitor.cpp:52
Abstract base class for all Device, Stimulator, etc objects.
Definition: Device.h:47
std::string string
Standard library string type which is imported into Auryn namespace.
Definition: auryn_definitions.h:156