/usr/include/simgear/debug/BufferedLogCallback.hxx is in libsimgear-dev 1:2018.1.1+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | /** \file BufferedLogCallback.hxx
* Buffer certain log messages permanently for later retrieval and display
*/
// Copyright (C) 2013 James Turner zakalawe@mac.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
#ifndef SG_DEBUG_BUFFEREDLOGCALLBACK_HXX
#define SG_DEBUG_BUFFEREDLOGCALLBACK_HXX
#include <vector>
#include <memory> // for std::unique_ptr
#include <simgear/debug/logstream.hxx>
namespace simgear
{
class BufferedLogCallback : public LogCallback
{
public:
BufferedLogCallback(sgDebugClass c, sgDebugPriority p);
virtual ~BufferedLogCallback();
/// truncate messages longer than a certain length. This is to work-around
/// for broken PUI behaviour, it can be removed once PUI is gone.
void truncateAt(unsigned int);
virtual void operator()(sgDebugClass c, sgDebugPriority p,
const char* file, int line, const std::string& aMessage);
/**
* read the stamp value associated with the log buffer. This is
* incremented whenever the log contents change, so can be used
* to poll for changes.
*/
unsigned int stamp() const;
/**
* copying a (large) vector of std::string would be very expensive.
* once logged, this call retains storage of the underlying string data,
* so when copying, it's sufficient to pass around the strings as raw
* char arrays. This means we're only copying a vector of pointers,
* which is very efficient.
*/
typedef std::vector<unsigned char*> vector_cstring;
/**
* copy the buffered log data into the provided output list
* (which will be cleared first). This method is safe to call from
* any thread.
*
* returns the stamp value of the copied data
*/
unsigned int threadsafeCopy(vector_cstring& aOutput);
private:
class BufferedLogCallbackPrivate;
std::unique_ptr<BufferedLogCallbackPrivate> d;
};
} // of namespace simgear
#endif // of SG_DEBUG_BUFFEREDLOGCALLBACK_HXX
|