ROOT  6.06/09
Reference Guide
RooSentinel.cxx
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * @(#)root/roofitcore:$Id$
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 
17 //////////////////////////////////////////////////////////////////////////////
18 //
19 // BEGIN_HTML
20 // RooSentinel is a special purposes singleton class that terminates
21 // all other RooFit singleton services when the process exists.
22 //
23 // All function RooFit singleton services are created on the heap with
24 // a static wrapper function to avoid the 'static initialization order fiasco'
25 // but are not automatically destroyed at the end of the session. This class
26 // installs an atexit() function that takes care of this
27 // END_HTML
28 //
29 
30 #include "RooFit.h"
31 
32 #include "RooSentinel.h"
33 #include "RooSentinel.h"
34 #include "RooMinuit.h"
35 #include "RooMsgService.h"
36 #include "RooNumIntConfig.h"
37 #include "RooNumIntFactory.h"
38 #include "RooNumGenFactory.h"
39 #include "RooNumGenConfig.h"
40 #include "RooNameReg.h"
41 #include "RooArgSet.h"
42 #include "RooRealConstant.h"
43 #include "RooResolutionModel.h"
45 
47 
48 static void CleanUpRooFitAtExit()
49 {
50  // Clean up function called at program termination before global objects go out of scope.
62 }
63 
64 
65 
66 ////////////////////////////////////////////////////////////////////////////////
67 /// Install atexit handler that calls CleanupRooFitAtExit()
68 /// on program termination
69 
71 {
72  if (!_active) {
73  _active = kTRUE ;
74  atexit(CleanUpRooFitAtExit) ;
75  }
76 }
77 
78 
79 
static void cleanup()
Static function called by RooSentinel atexit() handler to cleanup at end of program.
static void CleanUpRooFitAtExit()
Definition: RooSentinel.cxx:48
static Bool_t _active
Definition: RooSentinel.h:28
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
static void cleanup()
Cleanup routine called by atexit() handler installed by RooSentinel.
static void cleanup()
Cleanup function called by atexit() handler installed by RooSentinel to delete global objects on heap...
Definition: RooNameReg.cxx:77
static void cleanup()
Cleanup function called by atexit() handler installed by RooSentinel to delete all global object upon...
static void cleanup()
Cleanup hook for RooSentinel atexit handler.
static void cleanup()
Cleanup method called by atexit handler installed by RooSentinel to delete all global heap objects wh...
Definition: RooMinuit.cxx:89
static void cleanup()
Cleanup routine called by atexit() handler installed by RooSentinel.
static void activate()
Install atexit handler that calls CleanupRooFitAtExit() on program termination.
Definition: RooSentinel.cxx:70
static void cleanup()
Clear memoery pool on exit to avoid reported memory leaks.
Definition: RooArgSet.cxx:83
static void cleanup()
Function called by atexit() handler installed by RooSentinel to cleanup global objects at end of job...
static void cleanup()
Cleanup function register with RooSentinel for cleanup in atexit()
static void cleanup()
Function called by atexit() handler installed by RooSentinel to cleanup global objects at end of job...
const Bool_t kTRUE
Definition: Rtypes.h:91