Give terrasync a buffered log.

This commit is contained in:
James Turner
2013-02-08 19:37:47 +00:00
parent 318c5000ce
commit 768a8c1062
2 changed files with 14 additions and 0 deletions

View File

@@ -60,6 +60,7 @@
#include <simgear/misc/strutils.hxx>
#include <simgear/threads/SGQueue.hxx>
#include <simgear/misc/sg_dir.hxx>
#include <simgear/debug/BufferedLogCallback.hxx>
#ifdef HAVE_SVN_CLIENT_H
# ifdef HAVE_LIBSVN_CLIENT_1
@@ -683,6 +684,10 @@ SGTerraSync::SGTerraSync(SGPropertyNode_ptr root) :
_userCbData(NULL)
{
_svnThread = new SvnThread();
_log = new BufferedLogCallback(SG_TERRAIN, SG_INFO);
_log->truncateAt(255);
sglog().addCallback(_log);
}
SGTerraSync::~SGTerraSync()
@@ -690,6 +695,8 @@ SGTerraSync::~SGTerraSync()
_tiedProperties.Untie();
delete _svnThread;
_svnThread = NULL;
sglog().removeCallback(_log);
delete _log;
}
void SGTerraSync::init()

View File

@@ -31,6 +31,8 @@ namespace simgear
{
const int NOWHERE = -9999;
class BufferedLogCallback;
typedef void (*SGTerraSyncCallback)(void* userData, long tileIndex);
class SGTerraSync : public SGSubsystem
@@ -49,6 +51,10 @@ public:
bool schedulePosition(int lat, int lon);
void setTileRefreshCb(SGTerraSyncCallback refreshCb, void* userData = NULL);
/// retrive the associated log object, for displaying log
/// output somewhere (a UI, presumably)
BufferedLogCallback* log() const
{ return _log; }
protected:
void syncAirportsModels();
void syncArea(int lat, int lon);
@@ -67,6 +73,7 @@ private:
SGTerraSyncCallback _refreshCb;
void* _userCbData;
simgear::TiedPropertyList _tiedProperties;
BufferedLogCallback* _log;
};
}