]> git.mxchange.org Git - flightgear.git/blob - src/Main/logger.hxx
4818e44f087a414c70b50e81ebb1e045256cedf9
[flightgear.git] / src / Main / logger.hxx
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 #ifndef __cplusplus
10 # error This library requires C++
11 #endif
12
13 #ifdef HAVE_CONFIG_H
14 #  include <config.h>
15 #endif
16
17 #include <iostream>
18 #include <vector>
19
20 #include <simgear/compiler.h>
21 #include <simgear/debug/logstream.hxx>
22 #include <simgear/misc/exception.hxx>
23 #include <simgear/props/props.hxx>
24
25 SG_USING_STD(ostream);
26 SG_USING_STD(vector);
27
28 #include "fgfs.hxx"
29
30
31 /**
32  * Log any property values to any number of CSV files.
33  */
34 class FGLogger : public FGSubsystem
35 {
36 public:
37
38   FGLogger ();
39   virtual ~FGLogger ();
40
41                                 // Implementation of FGSubsystem
42   virtual void init ();
43   virtual void reinit ();
44   virtual void bind ();
45   virtual void unbind ();
46   virtual void update (double dt);
47
48 private:
49
50   /**
51    * A single instance of a log file (the logger can contain many).
52    */
53   struct Log {
54     Log ();
55     virtual ~Log ();
56     vector<SGPropertyNode *> nodes;
57     ostream * output;
58     long interval_ms;
59     double last_time_ms;
60     char delimiter;
61   };
62
63   vector<Log> _logs;
64
65 };
66
67 #endif // __LOGGER_HXX