Public Member Functions | Private Attributes | List of all members
JournalFile Class Reference

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...
 
JournalFileoperator<< (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...
 
XsFilexsFile ()
 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ JournalFile()

JournalFile::JournalFile ( const XsString name,
bool  purge 
)

Constructor, requires a filename.

Parameters
nameThe (path and) filename of the log file to be used
purgeWhen set to true (default) the file will be cleared when opened

Definition at line 84 of file journalfile.cpp.

◆ ~JournalFile()

JournalFile::~JournalFile ( )

Destructor, flushes remaining data and closes the file.

Definition at line 104 of file journalfile.cpp.

Member Function Documentation

◆ addRef()

int JournalFile::addRef ( )

Increase reference count of JournalFile by 1.

Returns
The new ref count value

Definition at line 125 of file journalfile.cpp.

◆ filename()

XsString JournalFile::filename ( ) const

Returns the (path +) filename of the open file.

Definition at line 147 of file journalfile.cpp.

◆ flush()

void JournalFile::flush ( )

Flush remaining data to disk.

Definition at line 117 of file journalfile.cpp.

◆ operator<<()

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.

◆ refCount()

int JournalFile::refCount ( ) const volatile

Returns the current ref count value.

Returns
The ref count value

Definition at line 133 of file journalfile.cpp.

◆ removeRef()

int JournalFile::removeRef ( )

Decrease reference count of JournalFile by 1.

Returns
The new ref count value

Definition at line 141 of file journalfile.cpp.

◆ xsFile()

XsFile& JournalFile::xsFile ( )
inline

Return the internal XsFile object, only to be used directly when absolutely necessary.

Definition at line 88 of file journalfile.h.

Member Data Documentation

◆ m_file

XsFile JournalFile::m_file
private

Definition at line 96 of file journalfile.h.

◆ m_filename

XsString JournalFile::m_filename
private

Definition at line 95 of file journalfile.h.

◆ m_refCount

volatile std::atomic_int JournalFile::m_refCount
private

A reference counter that tracks how many Journaller objects use this file.

Definition at line 94 of file journalfile.h.


The documentation for this class was generated from the following files:


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:21