forked from ChristophKirst/SimKernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsim_io.h
61 lines (44 loc) · 1.21 KB
/
sim_io.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/***************************************************************************
sim_io.h - Sim object's message and error objects
Christoph Kirst
Max Planck Institue for Dynamics and Self-Organisation
HU Berlin, BCCN Göttingen & Berlin (2008)
****************************************************************************/
#ifndef SIM_IO_H
#define SIM_IO_H
#include <string>
#include <sstream>
#include "sim_signals.h"
//#include <iostream>
//#define SIO_DEBUG(s1,s2) std::cout << "SimIO DEBUG: " << s1 << " " << s2 << std::endl; std::cout.flush();
#define SIO_DEBUG(s1,s2)
class Sim;
class SimIO
{
private:
Sim* sim;
std::string msg;
public:
SimIO(Sim* sim_);
~SimIO();
template <typename T>
SimIO& operator << (T tex)
{
SIO_DEBUG("Operator <<", tex)
std::ostringstream str;
str << tex;
msg += str.str();
return (*this);
}
SimIO& operator << (const SimSignal& sig);
// endl.
SimIO& operator << (SimIO& (*io) (SimIO&));
void endline();
void flush(const SimSignal& sig = Message);
void release(const SimSignal& sig = Warning);
void output_level(const SimSignal& sig);
};
// endl
SimIO& Endl (SimIO& m);
#endif