Logo ROOT   6.10/09
Reference Guide
Config.cxx
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Joerg Stelzer, Fredrik Tegenfeldt, Helge Voss
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : Config *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Implementation *
12  * *
13  * Authors (alphabetical): *
14  * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15  * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
16  * Fredrik Tegenfeldt <Fredrik.Tegenfeldt@cern.ch> - Iowa State U., USA *
17  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, GER *
18  * *
19  * Copyright (c) 2006: *
20  * CERN, Switzerland *
21  * Iowa State U., USA *
22  * MPI-K Heidelberg, Germany *
23  * *
24  * Redistribution and use in source and binary forms, with or without *
25  * modification, are permitted according to the terms listed in LICENSE *
26  * (http://mva.sourceforge.net/license.txt) *
27  **********************************************************************************/
28 
29 /*! \class TMVA::Config
30 \ingroup TMVA
31 
32 Singleton class for global configuration settings used by TMVA.
33 
34 */
35 
36 #include "TMVA/Config.h"
37 #include "TMVA/MsgLogger.h"
38 
39 #include "Rtypes.h"
40 #include "TString.h"
41 
43 
44 #if __cplusplus > 199711L
45 std::atomic<TMVA::Config*> TMVA::Config::fgConfigPtr{ 0 };
46 #else
48 #endif
49 
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 /// constructor - set defaults
54 
56  fUseColoredConsole ( kTRUE ),
57  fSilent ( kFALSE ),
58  fWriteOptionsReference( kFALSE ),
59  fDrawProgressBar ( kFALSE ),
60  fLogger ( new MsgLogger("Config") )
61 {
62  // plotting
67 
70 
71  // IO names
72  fIONames.fWeightFileDir = "weights";
73  fIONames.fWeightFileExtension = "weights";
74  fIONames.fOptionsReferenceFileDir = "optionInfo";
75 }
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 /// destructor
79 
81 {
82  delete fLogger;
83 }
84 
85 ////////////////////////////////////////////////////////////////////////////////
86 /// static function: destroy TMVA instance
87 
89 {
90 #if __cplusplus > 199711L
91  delete fgConfigPtr.exchange(0);
92 #else
93  if (fgConfigPtr != 0) { delete fgConfigPtr; fgConfigPtr = 0;}
94 #endif
95 }
96 
97 ////////////////////////////////////////////////////////////////////////////////
98 /// static function: returns TMVA instance
99 
101 {
102 #if __cplusplus > 199711L
103  if(!fgConfigPtr) {
104  TMVA::Config* tmp = new Config();
105  TMVA::Config* expected = 0;
106  if(! fgConfigPtr.compare_exchange_strong(expected,tmp) ) {
107  //another thread beat us to the switch
108  delete tmp;
109  }
110  }
111  return *fgConfigPtr;
112 #else
113  return fgConfigPtr ? *fgConfigPtr :*(fgConfigPtr = new Config());
114 #endif
115 }
116 
TString fOptionsReferenceFileDir
Definition: Config.h:98
Int_t fMaxNumOfAllowedVariablesForScatterPlots
Definition: Config.h:84
static Config * fgConfigPtr
Definition: Config.h:112
Config & gConfig()
static Config & Instance()
static function: returns TMVA instance
Definition: Config.cxx:100
MsgLogger * fLogger
Definition: Config.h:127
Singleton class for global configuration settings used by TMVA.
Definition: Config.h:49
TString fWeightFileDir
Definition: Config.h:96
class TMVA::Config::IONames fIONames
TString fWeightFileExtension
Definition: Config.h:97
class TMVA::Config::VariablePlotting fVariablePlotting
const Bool_t kFALSE
Definition: RtypesCore.h:92
#define ClassImp(name)
Definition: Rtypes.h:336
static void DestroyInstance()
static function: destroy TMVA instance
Definition: Config.cxx:88
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:91
virtual ~Config()
destructor
Definition: Config.cxx:80
Config()
constructor - set defaults
Definition: Config.cxx:55