/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 * @(#)root/roofitcore:$Id$
 * Authors:                                                                  *
 *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
 *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
 *                                                                           *
 * Copyright (c) 2000-2005, Regents of the University of California          *
 *                          and Stanford University. All rights reserved.    *
 *                                                                           *
 * Redistribution and use in source and binary forms,                        *
 * with or without modification, are permitted according to the terms        *
 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
 *****************************************************************************/

//////////////////////////////////////////////////////////////////////////////
//
// BEGIN_HTML
// RooSentinel is a special purposes singleton class that terminates
// all other RooFit singleton services when the process exists. 
//
// All function RooFit singleton services are created on the heap with
// a static wrapper function to avoid the 'static initialization order fiasco'
// but are not automatically destroyed at the end of the session. This class
// installs an atexit() function that takes care of this
// END_HTML
//

#include "RooFit.h"

#include "RooSentinel.h"
#include "RooSentinel.h"
#include "RooMinuit.h"
#include "RooMsgService.h"
#include "RooNumIntConfig.h"
#include "RooNumIntFactory.h"
#include "RooNumGenFactory.h"
#include "RooNumGenConfig.h"
#include "RooNameReg.h"
#include "RooArgSet.h"
#include "RooRealConstant.h"
#include "RooResolutionModel.h"
#include "RooExpensiveObjectCache.h"

Bool_t RooSentinel::_active = kFALSE ;

static void CleanUpRooFitAtExit()
{
  // Clean up function called at program termination before global objects go out of scope.
  RooMinuit::cleanup() ;
  RooMsgService::cleanup() ;
  RooNumIntConfig::cleanup() ;
  RooNumGenConfig::cleanup() ;
  RooNumIntFactory::cleanup() ;
  RooNumGenFactory::cleanup() ;
  RooNameReg::cleanup() ;
  RooArgSet::cleanup() ;
  RooRealConstant::cleanup() ;
  RooResolutionModel::cleanup() ;
  RooExpensiveObjectCache::cleanup() ;
}



//_____________________________________________________________________________
void RooSentinel::activate()
{
  // Install atexit handler that calls CleanupRooFitAtExit()
  // on program termination

  if (!_active) {
    _active = kTRUE ;
    atexit(CleanUpRooFitAtExit) ;
  }
}


 
 RooSentinel.cxx:1
 RooSentinel.cxx:2
 RooSentinel.cxx:3
 RooSentinel.cxx:4
 RooSentinel.cxx:5
 RooSentinel.cxx:6
 RooSentinel.cxx:7
 RooSentinel.cxx:8
 RooSentinel.cxx:9
 RooSentinel.cxx:10
 RooSentinel.cxx:11
 RooSentinel.cxx:12
 RooSentinel.cxx:13
 RooSentinel.cxx:14
 RooSentinel.cxx:15
 RooSentinel.cxx:16
 RooSentinel.cxx:17
 RooSentinel.cxx:18
 RooSentinel.cxx:19
 RooSentinel.cxx:20
 RooSentinel.cxx:21
 RooSentinel.cxx:22
 RooSentinel.cxx:23
 RooSentinel.cxx:24
 RooSentinel.cxx:25
 RooSentinel.cxx:26
 RooSentinel.cxx:27
 RooSentinel.cxx:28
 RooSentinel.cxx:29
 RooSentinel.cxx:30
 RooSentinel.cxx:31
 RooSentinel.cxx:32
 RooSentinel.cxx:33
 RooSentinel.cxx:34
 RooSentinel.cxx:35
 RooSentinel.cxx:36
 RooSentinel.cxx:37
 RooSentinel.cxx:38
 RooSentinel.cxx:39
 RooSentinel.cxx:40
 RooSentinel.cxx:41
 RooSentinel.cxx:42
 RooSentinel.cxx:43
 RooSentinel.cxx:44
 RooSentinel.cxx:45
 RooSentinel.cxx:46
 RooSentinel.cxx:47
 RooSentinel.cxx:48
 RooSentinel.cxx:49
 RooSentinel.cxx:50
 RooSentinel.cxx:51
 RooSentinel.cxx:52
 RooSentinel.cxx:53
 RooSentinel.cxx:54
 RooSentinel.cxx:55
 RooSentinel.cxx:56
 RooSentinel.cxx:57
 RooSentinel.cxx:58
 RooSentinel.cxx:59
 RooSentinel.cxx:60
 RooSentinel.cxx:61
 RooSentinel.cxx:62
 RooSentinel.cxx:63
 RooSentinel.cxx:64
 RooSentinel.cxx:65
 RooSentinel.cxx:66
 RooSentinel.cxx:67
 RooSentinel.cxx:68
 RooSentinel.cxx:69
 RooSentinel.cxx:70
 RooSentinel.cxx:71
 RooSentinel.cxx:72
 RooSentinel.cxx:73
 RooSentinel.cxx:74
 RooSentinel.cxx:75
 RooSentinel.cxx:76
 RooSentinel.cxx:77
 RooSentinel.cxx:78
 RooSentinel.cxx:79