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
|
|
|
|
|
|
|
|
#ifndef __cplusplus
|
|
|
|
# error This library requires C++
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <simgear/compiler.h>
|
|
|
|
#include <simgear/debug/logstream.hxx>
|
|
|
|
#include <simgear/misc/exception.hxx>
|
|
|
|
#include <simgear/misc/props.hxx>
|
|
|
|
|
2002-03-12 20:01:54 +00:00
|
|
|
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
|
2002-03-12 16:29:00 +00:00
|
|
|
#include <iostream>
|
|
|
|
SG_USING_STD(ostream);
|
2002-03-12 20:01:54 +00:00
|
|
|
#endif
|
2002-03-12 16:29:00 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
SG_USING_STD(vector);
|
|
|
|
|
|
|
|
#include "fgfs.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Log any property values to any number of CSV files.
|
|
|
|
*/
|
|
|
|
class FGLogger : public FGSubsystem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
FGLogger ();
|
|
|
|
virtual ~FGLogger ();
|
|
|
|
|
|
|
|
// Implementation of FGSubsystem
|
|
|
|
virtual void init ();
|
|
|
|
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 ();
|
|
|
|
vector<SGPropertyNode *> nodes;
|
|
|
|
ostream * output;
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
vector<Log> _logs;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __LOGGER_HXX
|