MeVisLab Toolbox Reference
mlDirectDicomImportDPLLogger.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
5
12*/
13//----------------------------------------------------------------------------------
14#pragma once
15
16// Local includes
18
19// ML includes
21#include "mlTimeCounter.h"
22#include <FMEThirdPartyWarningsDisable.h>
23#include <string>
24#include <FMEThirdPartyWarningsRestore.h>
25
26// Logger class used in DirectDicomImport.
27#include "mlProgressLogger.h"
28
29// Some error define from windows causes trouble in logger include...
30#if defined(ERROR)
31 #define _DPL_SAVE_ERROR_DEF ERROR
32 #undef ERROR
33#endif
34
35// For the logger.
36#include "DPL_TypeDefs.h"
37#include "DPL_Logger.h"
38
39ML_START_NAMESPACE
40
41 class DirectDicomImportDPLTagValueProvider;
42
43 //----------------------------------------------------------------------------------
45 //----------------------------------------------------------------------------------
47 {
48 public:
51
53 typedef void ProgressCB(void *usrData,
54 const std::string &info,
55 float state);
56
58 virtual void setProgressCB(ProgressCB *callback = nullptr,
59 void *userData = nullptr,
60 float progressStart = 0.2f,
61 float progressRange = 0.3f);
62
64 void setProgressLogger(ProgressLogger *ddiLogger=nullptr);
65
68
70 void setVerboseLevel(unsigned int verboseLevel);
71
73 unsigned int getVerboseLevel() const;
74
77
80
84
87
88
89 protected:
93 void log( Logger::LogTypes logType, const std::string& msgArg ) override;
94
99 void log( Logger::LogTypes logType, DPL::ErrorInfo* error ) override;
100
101 private:
103 ProgressLogger *_ddiLogger;
104
106 unsigned int _verboseLevel;
107
109 bool _logPartingAndSortingInformationOn;
110
112 DirectDicomImportDPLTagValueProvider *_tagValueProvider;
113
115 ProgressCB *_updateProgressInfos;
116
118 void *_userData;
119
121 float _progressStart;
122
124 float _progressRange;
125
127 TimeCounter _timeCounter;
128
130 MLdouble _recentTime;
131
134 void _selfTest();
135
140 };
141
142ML_END_NAMESPACE
143
144// Restore previous ERROR define from Windows.
145#ifdef _DPL_SAVE_ERROR_DEF
146 #define ERROR _DPL_SAVE_ERROR_DEF
147#endif
Project global and OS specific declarations.
#define MLDIRECTDICOMIMPORT_EXPORT
Only for diagnostic purposes.
virtual void setProgressCB(ProgressCB *callback=nullptr, void *userData=nullptr, float progressStart=0.2f, float progressRange=0.3f)
Defines the currently used progress callback or resets it if nothing is passed.
void ProgressCB(void *usrData, const std::string &info, float state)
Progress callback which can be registered for DPL progress logging.
unsigned int getVerboseLevel() const
Returns verbose level.
void setProgressLogger(ProgressLogger *ddiLogger=nullptr)
Set the used ProgressLogger instance, defaults to nullptr.
DirectDicomImportDPLTagValueProvider * getTagValueProvider() const
Returns the currently set tag value provider or nullptr if not set.
void setLogPartingAndSortingInformationOn(bool on)
Enables logging of partitioning and sorting information if enabled, default is off/false.
ProgressLogger * getProgressLogger() const
Returns the currently set ProgressLogger.
void setVerboseLevel(unsigned int verboseLevel)
Verbose level (0 = only warnings and errors, other values = full information).
void log(Logger::LogTypes logType, DPL::ErrorInfo *error) override
bool isPartingAndSortingInformationOn()
Returns true if logging of partitioning and sorting information is enabled, otherwise false.
void setTagValueProvider(DirectDicomImportDPLTagValueProvider *prov=nullptr)
void log(Logger::LogTypes logType, const std::string &msgArg) override
DirectDicomImportDPLLogger(ProgressLogger *ddiLogger=nullptr)
Constructor: A class logging DPl messages to the console of the instance of a ProgressLogger.
Class to measure precise time intervals.
double MLdouble
Definition mlTypeDefs.h:216