]> git.mxchange.org Git - flightgear.git/blob - src/Main/logger.hxx
There was an integer overflow in the way elapsed_time_ms. Because the
[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 #ifndef SG_HAVE_NATIVE_SGI_COMPILERS
23 #include <iostream>
24 SG_USING_STD(ostream);
25 #endif
26
27 #include <vector>
28 SG_USING_STD(vector);
29
30 #include "fgfs.hxx"
31
32
33 /**
34  * Log any property values to any number of CSV files.
35  */
36 class FGLogger : public FGSubsystem
37 {
38 public:
39
40   FGLogger ();
41   virtual ~FGLogger ();
42
43                                 // Implementation of FGSubsystem
44   virtual void init ();
45   virtual void bind ();
46   virtual void unbind ();
47   virtual void update (int dt);
48
49 private:
50
51   /**
52    * A single instance of a log file (the logger can contain many).
53    */
54   struct Log {
55     Log ();
56     virtual ~Log ();
57     vector<SGPropertyNode *> nodes;
58     ostream * output;
59     long interval_ms;
60     double last_time_ms;
61     char delimiter;
62   };
63
64   vector<Log> _logs;
65
66 };
67
68 #endif // __LOGGER_HXX