logwriter.h

00001 // Copyright (C) 2008,2009,2010 by Philipp Münzel. All rights reserved.
00002 // Released under the terms of the license described in license.txt
00003 
00004 #ifndef LOGWRITER_H
00005 #define LOGWRITER_H
00006 
00007 #include "dllexport.h"
00008 
00009 #include "log.h"
00010 #if defined USE_QMUTEX
00011 #include "thread_policy_qt.h"
00012 #define ThreadingPolicy QThreaded
00013 #elif defined USE_BOOST_MUTEX
00014 #include "thread_policy_boost.h"
00015 #define ThreadingPolicy BoostThreaded
00016 #endif
00017 #include "concurrent_queue.h"
00018 
00019 
00020 namespace SCS {
00021 
00030 class DLL_PUBLIC LogWriter
00031 {
00032 public:
00033     virtual ~LogWriter() {}
00034 
00039     void postEntry(const LogEntry& entry);
00040 
00045     void writeEntries();
00046 
00050     virtual void writeString(const LogEntry&) = 0;
00051 
00052 private:
00053     concurrent_queue<SCS::LogEntry, ThreadingPolicy> m_queue;
00054 };
00055 
00056 }
00057 
00058 #endif // LOGWRITER_H