PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusLogger.cxx
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2  Program: Plus
3  Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4  See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #include "PlusConfigure.h"
8 #include "PlusCommon.h"
9 #include "vtkPlusLogger.h"
10 
11 //-----------------------------------------------------------------------------
12 namespace
13 {
14  vtkIGSIOSimpleRecursiveCriticalSection LoggerCreationCriticalSection;
15 }
16 
17 //-------------------------------------------------------
18 vtkPlusLogger::vtkPlusLogger()
19 {
20 }
21 
22 //-------------------------------------------------------
23 vtkPlusLogger::~vtkPlusLogger()
24 {
25 }
26 
27 //-------------------------------------------------------
28 vtkIGSIOLogger* vtkPlusLogger::Instance()
29 {
30  if (m_pInstance == NULL)
31  {
32  igsioLockGuard<vtkIGSIOSimpleRecursiveCriticalSection> loggerCreationGuard(&LoggerCreationCriticalSection);
33  if (m_pInstance != NULL)
34  {
35  return m_pInstance;
36  }
37 
38  vtkPlusLogger* newLoggerInstance = new vtkPlusLogger;
39  // lock the instance even before making it available to make sure the instance is fully
40  // initialized before anybody uses it
41  igsioLockGuard<vtkIGSIORecursiveCriticalSection> critSectionGuard(newLoggerInstance->m_CriticalSection);
42  m_pInstance = newLoggerInstance;
43 
44  vtkPlusConfig::GetInstance(); // set the log file name from the XML config
45  std::string strVersion = std::string("Software version: ") +
47 
48 #ifdef _DEBUG
49  strVersion += " (debug build)";
50 #endif
51 
52  m_pInstance->LogMessage(LOG_LEVEL_INFO, strVersion, "vtkPlusLogger", __LINE__);
53  }
54 
55  return m_pInstance;
56 }
Class to abstract away specific sequence file read/write details.
Definition: vtkPlusLogger.h:21
static vtkPlusConfig * GetInstance()
static vtkIGSIOLogger * Instance()
vtkPlusCommonExport std::string GetPlusLibVersionString()
Definition: PlusCommon.cxx:30