]> git.mxchange.org Git - flightgear.git/blob - src/Main/logger.hxx
Added a new 'delimiter' property to allow an alternative delimiter to
[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 <simgear/compiler.h>
18 #include <simgear/debug/logstream.hxx>
19 #include <simgear/misc/exception.hxx>
20 #include <simgear/misc/props.hxx>
21
22 #include <iostream>
23 SG_USING_STD(ostream);
24
25 #include <vector>
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 bind ();
44   virtual void unbind ();
45   virtual void update (int dt);
46
47 private:
48
49   /**
50    * A single instance of a log file (the logger can contain many).
51    */
52   struct Log {
53     Log ();
54     virtual ~Log ();
55     vector<SGPropertyNode *> nodes;
56     ostream * output;
57     long interval_ms;
58     long last_time_ms;
59     char delimiter;
60   };
61
62   vector<Log> _logs;
63
64 };
65
66 #endif // __LOGGER_HXX