// Ryzom - MMORPG Framework
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
#ifndef RYAI_DEBUG_HISTORY_H
#define RYAI_DEBUG_HISTORY_H
class CDebugHistory
{
private:
typedef std::deque THistoryContainer;
public:
explicit CDebugHistory()
: _Recording(false)
{
}
virtual ~CDebugHistory() { }
void addHistory(std::string const& txt)
{
if (_Recording)
_History.push_back(txt);
}
void addHistory(char const* txt)
{
if (_Recording)
addHistory(NLMISC::toString(txt));
}
template
void addHistory(char const* txt, A a) { if (_Recording) addHistory(NLMISC::toString(txt, a)); }
template
void addHistory(char const* txt, A a, B b) { if (_Recording) addHistory(NLMISC::toString(txt, a, b)); }
template
void addHistory(char const* txt, A a, B b, C c) { if (_Recording) addHistory(NLMISC::toString(txt, a, b, c)); }
template
void addHistory(char const* txt, A a, B b, C c, D d) { if (_Recording) addHistory(NLMISC::toString(txt, a, b, c, d)); }
void setRecording(bool val) { _Recording = val; }
void writeAsInfo()
{
int j = 0;
FOREACH(itHistory, THistoryContainer, _History)
{
nlinfo("HIST %3i: %s", j, itHistory->c_str());
++j;
}
}
private:
bool _Recording;
THistoryContainer _History;
};
#endif