48 lines
966 B
C++
48 lines
966 B
C++
#ifndef _LOGFILE_LOGFILE_HPP_
|
|
#define _LOGFILE_LOGFILE_HPP_
|
|
#ifndef _COMMON_PUREVIEWOFFILE_HPP_
|
|
#include <common/pview.hpp>
|
|
#endif
|
|
#ifndef _COMMON_FILEMAP_HPP_
|
|
#include <common/filemap.hpp>
|
|
#endif
|
|
#ifndef _THREAD_EVENT_HPP_
|
|
#include <thread/event.hpp>
|
|
#endif
|
|
#ifndef _THREAD_MUTEX_HPP_
|
|
#include <thread/mutex.hpp>
|
|
#endif
|
|
#ifndef _FILEIO_FILEIO_HPP_
|
|
#include <fileio/fileio.hpp>
|
|
#endif
|
|
|
|
class LogFile
|
|
{
|
|
public:
|
|
LogFile(const String &strLogName=String("LOGFILE"));
|
|
virtual ~LogFile();
|
|
BOOL writeLine(const String &strLine);
|
|
BOOL write(const String &strLine);
|
|
BOOL write(Block<String> &strLines);
|
|
BOOL read(String &strLine);
|
|
BOOL read(Block<String> &strLines);
|
|
void synchronize(void);
|
|
private:
|
|
void log(const String &msg);
|
|
|
|
FileMap mFileMap;
|
|
PureViewOfFile mFileView;
|
|
Event mIOEvent;
|
|
Event mIOAckEvent;
|
|
Mutex mMutex;
|
|
BOOL mIsAckPending;
|
|
FileIO mLogFile;
|
|
};
|
|
|
|
inline
|
|
BOOL LogFile::writeLine(const String &strLine)
|
|
{
|
|
return write(strLine);
|
|
}
|
|
#endif
|