Logo ROOT   6.12/07
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 
71 
72  // IO names
73  fIONames.fWeightFileDir = "weights";
74  fIONames.fWeightFileExtension = "weights";
75  fIONames.fOptionsReferenceFileDir = "optionInfo";
76 }
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// destructor
80 
82 {
83  delete fLogger;
84 }
85 
86 ////////////////////////////////////////////////////////////////////////////////
87 /// static function: destroy TMVA instance
88 
90 {
91 #if __cplusplus > 199711L
92  delete fgConfigPtr.exchange(0);
93 #else
94  if (fgConfigPtr != 0) { delete fgConfigPtr; fgConfigPtr = 0;}
95 #endif
96 }
97 
98 ////////////////////////////////////////////////////////////////////////////////
99 /// static function: returns TMVA instance
100 
102 {
103 #if __cplusplus > 199711L
104  if(!fgConfigPtr) {
105  TMVA::Config* tmp = new Config();
106  TMVA::Config* expected = 0;
107  if(! fgConfigPtr.compare_exchange_strong(expected,tmp) ) {
108  //another thread beat us to the switch
109  delete tmp;
110  }
111  }
112  return *fgConfigPtr;
113 #else
114  return fgConfigPtr ? *fgConfigPtr :*(fgConfigPtr = new Config());
115 #endif
116 }
117 
TString fOptionsReferenceFileDir
Definition: Config.h:109
Int_t fMaxNumOfAllowedVariablesForScatterPlots
Definition: Config.h:95
static Config * fgConfigPtr
Definition: Config.h:123
Config & gConfig()
static Config & Instance()
static function: returns TMVA instance
Definition: Config.cxx:101
MsgLogger * fLogger
Definition: Config.h:138
Singleton class for global configuration settings used by TMVA.
Definition: Config.h:53
TString fWeightFileDir
Definition: Config.h:107
class TMVA::Config::IONames fIONames
TString fWeightFileExtension
Definition: Config.h:108
class TMVA::Config::VariablePlotting fVariablePlotting
const Bool_t kFALSE
Definition: RtypesCore.h:88
#define ClassImp(name)
Definition: Rtypes.h:359
static void DestroyInstance()
static function: destroy TMVA instance
Definition: Config.cxx:89
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual ~Config()
destructor
Definition: Config.cxx:81
Config()
constructor - set defaults
Definition: Config.cxx:55