ROOT  6.06/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 #include "TMVA/Config.h"
30 #include "TMVA/MsgLogger.h"
31 
33 
34 #if __cplusplus > 199711L
35 std::atomic<TMVA::Config*> TMVA::Config::fgConfigPtr{ 0 };
36 #else
37 TMVA::Config* TMVA::Config::fgConfigPtr = 0;
38 #endif
39 
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// constructor - set defaults
44 
46  fUseColoredConsole ( kTRUE ),
47  fSilent ( kFALSE ),
48  fWriteOptionsReference( kFALSE ),
49  fDrawProgressBar ( kTRUE ),
50  fLogger ( new MsgLogger("Config") )
51 {
52  // plotting
57 
60 
61  // IO names
62  fIONames.fWeightFileDir = "weights";
63  fIONames.fWeightFileExtension = "weights";
64  fIONames.fOptionsReferenceFileDir = "optionInfo";
65 }
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// destructor
69 
71 {
72  delete fLogger;
73 }
74 
75 ////////////////////////////////////////////////////////////////////////////////
76 /// static function: destroy TMVA instance
77 
79 {
80 #if __cplusplus > 199711L
81  delete fgConfigPtr.exchange(0);
82 #else
83  if (fgConfigPtr != 0) { delete fgConfigPtr; fgConfigPtr = 0;}
84 #endif
85 }
86 
87 ////////////////////////////////////////////////////////////////////////////////
88 /// static function: returns TMVA instance
89 
91 {
92 #if __cplusplus > 199711L
93  if(!fgConfigPtr) {
94  TMVA::Config* tmp = new Config();
95  TMVA::Config* expected = 0;
96  if(! fgConfigPtr.compare_exchange_strong(expected,tmp) ) {
97  //another thread beat us to the switch
98  delete tmp;
99  }
100  }
101  return *fgConfigPtr;
102 #else
103  return fgConfigPtr ? *fgConfigPtr :*(fgConfigPtr = new Config());
104 #endif
105 }
106 
TString fOptionsReferenceFileDir
Definition: Config.h:102
Int_t fMaxNumOfAllowedVariablesForScatterPlots
Definition: Config.h:88
Config & gConfig()
static Config & Instance()
static function: returns TMVA instance
Definition: Config.cxx:90
const Bool_t kFALSE
Definition: Rtypes.h:92
TString fWeightFileDir
Definition: Config.h:100
class TMVA::Config::IONames fIONames
TString fWeightFileExtension
Definition: Config.h:101
class TMVA::Config::VariablePlotting fVariablePlotting
#define ClassImp(name)
Definition: Rtypes.h:279
static void DestroyInstance()
static function: destroy TMVA instance
Definition: Config.cxx:78
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual ~Config()
destructor
Definition: Config.cxx:70
Config()
constructor - set defaults
Definition: Config.cxx:45