Debian Codegraph @

src/Main/logger.hxx

raw symbols SCIP
1 // logger.hxx - log properties.
2 // Written by David Megginson, started 2002.
3 //
4 // This file is in the Public Domain, and comes with no warranty.
5
6 #ifndef __LOGGER_HXX
7 #define __LOGGER_HXX 1
8
9 #include <memory>
10 #include <vector>
11
12 #include <simgear/compiler.h>
13 #include <simgear/io/iostreams/sgstream.hxx>
14 #include <simgear/structure/subsystem_mgr.hxx>
15 #include <simgear/props/props.hxx>
16
17 /**
18 * Log any property values to any number of CSV files.
19 */
20 class FGLogger : public SGSubsystem
21 {
22 public:
23 // Subsystem API.
24 void bind() override;
25 void init() override;
26 void reinit() override;
27 void unbind() override;
28 void update(double dt) override;
29
30 // Subsystem identification.
31 static const char* staticSubsystemClassId() { return "logger"; }
32
33 private:
34 /**
35 * A single instance of a log file (the logger can contain many).
36 */
37 struct Log {
38 Log ();
39
40 std::vector<SGPropertyNode_ptr> nodes;
41 std::unique_ptr<sg_ofstream> output;
42 long interval_ms;
43 double last_time_ms;
44 char delimiter;
45 };
46
47 std::vector< std::unique_ptr<Log> > _logs;
48 };
49
50 #endif // __LOGGER_HXX