]> git.mxchange.org Git - flightgear.git/blob - src/Main/logger.hxx
Add the AIModel based air traffic subsystem from Durk Talsma.
[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/structure/exception.hxx>
23 #include <simgear/structure/subsystem_mgr.hxx>
24 #include <simgear/props/props.hxx>
25
26 SG_USING_STD(ostream);
27 SG_USING_STD(vector);
28
29
30 /**
31  * Log any property values to any number of CSV files.
32  */
33 class FGLogger : public SGSubsystem
34 {
35 public:
36
37   FGLogger ();
38   virtual ~FGLogger ();
39
40                                 // Implementation of SGSubsystem
41   virtual void init ();
42   virtual void reinit ();
43   virtual void bind ();
44   virtual void unbind ();
45   virtual void update (double 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     double last_time_ms;
59     char delimiter;
60   };
61
62   vector<Log> _logs;
63
64 };
65
66 #endif // __LOGGER_HXX