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