A class containing a journal file and some meta-data. More...
#include <journalfile.h>
Public Member Functions | |
int | addRef () |
Increase reference count of JournalFile by 1. More... | |
XsString | filename () const |
Returns the (path +) filename of the open file. More... | |
void | flush () |
Flush remaining data to disk. More... | |
JournalFile (const XsString &name, bool purge) | |
Constructor, requires a filename. More... | |
JournalFile & | operator<< (std::string const &msg) |
Appends msg to the end of the current data stream. More... | |
int | refCount () volatile const |
Returns the current ref count value. More... | |
int | removeRef () |
Decrease reference count of JournalFile by 1. More... | |
XsFile & | xsFile () |
Return the internal XsFile object, only to be used directly when absolutely necessary. More... | |
~JournalFile () | |
Destructor, flushes remaining data and closes the file. More... | |
Private Attributes | |
XsFile | m_file |
XsString | m_filename |
volatile std::atomic_int | m_refCount |
A reference counter that tracks how many Journaller objects use this file. More... | |
A class containing a journal file and some meta-data.
These objects are managed by Journaller through gJournalFileMap.
Definition at line 73 of file journalfile.h.
JournalFile::JournalFile | ( | const XsString & | name, |
bool | purge | ||
) |
Constructor, requires a filename.
name | The (path and) filename of the log file to be used |
purge | When set to true (default) the file will be cleared when opened |
Definition at line 84 of file journalfile.cpp.
JournalFile::~JournalFile | ( | ) |
Destructor, flushes remaining data and closes the file.
Definition at line 104 of file journalfile.cpp.
int JournalFile::addRef | ( | ) |
Increase reference count of JournalFile by 1.
Definition at line 125 of file journalfile.cpp.
XsString JournalFile::filename | ( | ) | const |
Returns the (path +) filename of the open file.
Definition at line 147 of file journalfile.cpp.
void JournalFile::flush | ( | ) |
Flush remaining data to disk.
Definition at line 117 of file journalfile.cpp.
JournalFile & JournalFile::operator<< | ( | std::string const & | msg | ) |
Appends msg to the end of the current data stream.
Definition at line 153 of file journalfile.cpp.
int JournalFile::refCount | ( | ) | const volatile |
Returns the current ref count value.
Definition at line 133 of file journalfile.cpp.
int JournalFile::removeRef | ( | ) |
Decrease reference count of JournalFile by 1.
Definition at line 141 of file journalfile.cpp.
|
inline |
Return the internal XsFile object, only to be used directly when absolutely necessary.
Definition at line 88 of file journalfile.h.
|
private |
Definition at line 96 of file journalfile.h.
|
private |
Definition at line 95 of file journalfile.h.
|
private |
A reference counter that tracks how many Journaller objects use this file.
Definition at line 94 of file journalfile.h.