Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooAbsCache.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $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\file RooAbsCache.cxx
19\class RooAbsCache
20\ingroup Roofitcore
21
22Abstract base class for data members of RooAbsArgs
23that cache other (composite) RooAbsArg expressions. The RooAbsCache
24interface defines the interaction between the owning RooAbsArg object
25and the cache data member to communicate server redirects, operation
26mode changes and constant term optimization management calls.
27**/
28
29#include "RooAbsCache.h"
30#include "RooAbsArg.h"
31#include "RooArgList.h"
32
34
35
36////////////////////////////////////////////////////////////////////////////////
37/// Constructor. Takes owner as argument and register cache with owner.
38
39RooAbsCache::RooAbsCache(RooAbsArg* owner) : _owner(owner)
40{
41 if (_owner) {
42 _owner->registerCache(*this) ;
43 }
44}
45
46
47////////////////////////////////////////////////////////////////////////////////
48/// Copy constructor. Takes owner as argument and registers cache with owne.
49
50RooAbsCache::RooAbsCache(const RooAbsCache&, RooAbsArg* owner ) : _owner(owner)
51{
52 if (_owner) {
53 owner->registerCache(*this) ;
54 }
55}
56
57
58////////////////////////////////////////////////////////////////////////////////
59/// Destructor. Unregisters cache with owner.
60
62{
63 if (_owner) {
64 _owner->unRegisterCache(*this) ;
65 }
66}
67
68
69////////////////////////////////////////////////////////////////////////////////
70/// Reset the owner, triggering the owner to register this cache in its list of caches.
72{
73 if (_owner) {
74 _owner->unRegisterCache(*this) ;
75 }
76 _owner = owner;
77 if (_owner) {
78 owner->registerCache(*this) ;
79 }
80}
#define ClassImp(name)
Definition Rtypes.h:377
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
void unRegisterCache(RooAbsCache &cache)
Unregister a RooAbsCache. Called from the RooAbsCache destructor.
void registerCache(RooAbsCache &cache)
Register RooAbsCache with this object.
Abstract base class for data members of RooAbsArgs that cache other (composite) RooAbsArg expressions...
Definition RooAbsCache.h:27
void setOwner(RooAbsArg *owner)
Reset the owner, triggering the owner to register this cache in its list of caches.
RooAbsArg * _owner
Pointer to owning RooAbsArg.
Definition RooAbsCache.h:61
RooAbsCache(RooAbsArg *owner=nullptr)
Constructor. Takes owner as argument and register cache with owner.
virtual ~RooAbsCache()
Destructor. Unregisters cache with owner.