NorMIT-nav  18.04
An IGT application
cxLog.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXLOG_H
13 #define CXLOG_H
14 
15 #include "cxResourceExport.h"
16 
17 #include <QMetaType>
18 #include <QObject>
19 #include <QMutex>
20 #include <QDateTime>
21 #include <QFile>
22 #include "boost/shared_ptr.hpp"
23 #include "cxDefinitions.h"
24 #include "cxAudio.h"
25 #include <sstream>
26 #include "cxTypeConversions.h"
27 #include "cxLogger.h"
28 #include "cxLogMessage.h"
29 
30 class QString;
31 class QDomNode;
32 class QDomDocument;
33 class QFile;
34 class QTextStream;
35 
42 namespace cx
43 {
44 typedef boost::shared_ptr<class MessageObserver> MessageObserverPtr;
45 typedef boost::shared_ptr<class MessageListener> MessageListenerPtr;
46 typedef boost::shared_ptr<class LogThread> LogThreadPtr;
47 typedef boost::shared_ptr<class Log> LogPtr;
48 
55 class cxResource_EXPORT Log : public QObject
56 {
57  Q_OBJECT
58 
59 public:
60  virtual ~Log();
61 
62  QString getLoggingFolder() const;
63  void setLoggingFolder(QString absoluteLoggingFolderPath);
64 
65  void installObserver(MessageObserverPtr observer, bool resend);
66  void uninstallObserver(MessageObserverPtr observer);
67 
68 signals:
69  void loggingFolderChanged();
70 
71 protected:
72  virtual LogThreadPtr createWorker() = 0;
73 
74 protected slots:
75  virtual void onEmittedMessage(Message message) {}
76 
77 protected:
78  Log();
79 
80  void initializeObject();
81  void startThread();
82  void stopThread();
83 
84  QString getDefaultLogPath() const;
85  QString mLogPath;
86  boost::shared_ptr<class QThread> mThread;
87  LogThreadPtr mWorker;
88 private:
89  Log(const Log&);
90  Log& operator=(const Log&);
91 };
92 
93 
94 } //namespace cx
95 
100 #endif // CXLOG_H
virtual void onEmittedMessage(Message message)
Definition: cxLog.h:75
QString mLogPath
Definition: cxLog.h:85
boost::shared_ptr< class QThread > mThread
Definition: cxLog.h:86
boost::shared_ptr< class Log > LogPtr
Definition: cxLog.h:47
boost::shared_ptr< class MessageObserver > MessageObserverPtr
Definition: cxLog.h:44
Definition: cxLog.h:55
LogThreadPtr mWorker
Definition: cxLog.h:87
boost::shared_ptr< class LogThread > LogThreadPtr
Definition: cxLog.h:46
boost::shared_ptr< class MessageListener > MessageListenerPtr
Definition: cxLog.h:45
Namespace for all CustusX production code.