2002-03-12 16:29:00 +00:00
|
|
|
// logger.hxx - log properties.
|
|
|
|
// Written by David Megginson, started 2002.
|
|
|
|
//
|
|
|
|
// This file is in the Public Domain, and comes with no warranty.
|
|
|
|
|
|
|
|
#ifndef __LOGGER_HXX
|
|
|
|
#define __LOGGER_HXX 1
|
|
|
|
|
2008-06-02 21:09:51 +00:00
|
|
|
#include <iosfwd>
|
2002-12-31 18:26:02 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2002-03-12 16:29:00 +00:00
|
|
|
#include <simgear/compiler.h>
|
2003-09-24 17:20:55 +00:00
|
|
|
#include <simgear/structure/subsystem_mgr.hxx>
|
2002-03-12 16:29:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Log any property values to any number of CSV files.
|
|
|
|
*/
|
2003-09-24 17:20:55 +00:00
|
|
|
class FGLogger : public SGSubsystem
|
2002-03-12 16:29:00 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
FGLogger ();
|
|
|
|
virtual ~FGLogger ();
|
|
|
|
|
2003-09-24 17:20:55 +00:00
|
|
|
// Implementation of SGSubsystem
|
2002-03-12 16:29:00 +00:00
|
|
|
virtual void init ();
|
2003-02-01 17:59:52 +00:00
|
|
|
virtual void reinit ();
|
2002-03-12 16:29:00 +00:00
|
|
|
virtual void bind ();
|
|
|
|
virtual void unbind ();
|
2002-05-11 16:28:50 +00:00
|
|
|
virtual void update (double dt);
|
2002-03-12 16:29:00 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A single instance of a log file (the logger can contain many).
|
|
|
|
*/
|
|
|
|
struct Log {
|
|
|
|
Log ();
|
|
|
|
virtual ~Log ();
|
2008-06-02 21:09:10 +00:00
|
|
|
std::vector<SGPropertyNode_ptr> nodes;
|
|
|
|
std::ostream * output;
|
2002-03-12 16:29:00 +00:00
|
|
|
long interval_ms;
|
2002-04-20 14:52:43 +00:00
|
|
|
double last_time_ms;
|
2002-03-12 19:55:49 +00:00
|
|
|
char delimiter;
|
2002-03-12 16:29:00 +00:00
|
|
|
};
|
|
|
|
|
2008-06-02 21:09:10 +00:00
|
|
|
std::vector<Log> _logs;
|
2002-03-12 16:29:00 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __LOGGER_HXX
|