/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 *    File: $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
// RooAbsCacheElement is the abstract base class for objects to be stored
// in RooAbsCache cache manager objects. Each storage element has an 
// interface to pass on calls for server redirection, operation mode
// change calls and constant term optimization management calls
// END_HTML
//
//
//


#include "RooFit.h"
#include "RooAbsCacheElement.h"
#include "RooAbsArg.h"
#include "RooArgList.h"

using namespace std;

ClassImp(RooAbsCacheElement) 
   ;


//_____________________________________________________________________________
Bool_t RooAbsCacheElement::redirectServersHook(const RooAbsCollection& /*newServerList*/, Bool_t /*mustReplaceAll*/, 
					       Bool_t /*nameChange*/, Bool_t /*isRecursive*/) 
{ 
  // Interface for server redirect calls
  return kFALSE ; 
} 



//_____________________________________________________________________________
void RooAbsCacheElement::printCompactTreeHook(std::ostream&, const char *, Int_t , Int_t )
{
  // Hook function to print cache guts in tree printing mode of RooAbsArgs
}



//_____________________________________________________________________________
void RooAbsCacheElement::operModeHook(RooAbsArg::OperMode) 
{
  // Interface for operation mode change calls
} 



//_____________________________________________________________________________
void RooAbsCacheElement::optimizeCacheMode(const RooArgSet& obs, RooArgSet& optNodes, RooLinkedList& processedNodes) 
{
  // Interface for cache optimization calls. The default implementation is to forward all these
  // calls to all contained RooAbsArg objects as publicized through containedArg()
  
  RooArgList list = containedArgs(OptimizeCaching) ;
  TIterator* iter = list.createIterator() ;
  RooAbsArg* arg ;
  while((arg=(RooAbsArg*)iter->Next())) {    
    arg->optimizeCacheMode(obs, optNodes, processedNodes) ;
  }
  delete iter ;
}



//_____________________________________________________________________________
void RooAbsCacheElement::findConstantNodes(const RooArgSet& obs, RooArgSet& cacheList, RooLinkedList& processedNodes) 
{
  // Interface for constant term optimization calls. The default implementation is to forward all these
  // calls to all contained RooAbsArg objects as publicized through containedArg()

  RooArgList list = containedArgs(FindConstantNodes) ;
  TIterator* iter = list.createIterator() ;
  RooAbsArg* arg ;
  while((arg=(RooAbsArg*)iter->Next())) {    
    arg->findConstantNodes(obs,cacheList, processedNodes) ;
  }
  delete iter ;
}
 RooAbsCacheElement.cxx:1
 RooAbsCacheElement.cxx:2
 RooAbsCacheElement.cxx:3
 RooAbsCacheElement.cxx:4
 RooAbsCacheElement.cxx:5
 RooAbsCacheElement.cxx:6
 RooAbsCacheElement.cxx:7
 RooAbsCacheElement.cxx:8
 RooAbsCacheElement.cxx:9
 RooAbsCacheElement.cxx:10
 RooAbsCacheElement.cxx:11
 RooAbsCacheElement.cxx:12
 RooAbsCacheElement.cxx:13
 RooAbsCacheElement.cxx:14
 RooAbsCacheElement.cxx:15
 RooAbsCacheElement.cxx:16
 RooAbsCacheElement.cxx:17
 RooAbsCacheElement.cxx:18
 RooAbsCacheElement.cxx:19
 RooAbsCacheElement.cxx:20
 RooAbsCacheElement.cxx:21
 RooAbsCacheElement.cxx:22
 RooAbsCacheElement.cxx:23
 RooAbsCacheElement.cxx:24
 RooAbsCacheElement.cxx:25
 RooAbsCacheElement.cxx:26
 RooAbsCacheElement.cxx:27
 RooAbsCacheElement.cxx:28
 RooAbsCacheElement.cxx:29
 RooAbsCacheElement.cxx:30
 RooAbsCacheElement.cxx:31
 RooAbsCacheElement.cxx:32
 RooAbsCacheElement.cxx:33
 RooAbsCacheElement.cxx:34
 RooAbsCacheElement.cxx:35
 RooAbsCacheElement.cxx:36
 RooAbsCacheElement.cxx:37
 RooAbsCacheElement.cxx:38
 RooAbsCacheElement.cxx:39
 RooAbsCacheElement.cxx:40
 RooAbsCacheElement.cxx:41
 RooAbsCacheElement.cxx:42
 RooAbsCacheElement.cxx:43
 RooAbsCacheElement.cxx:44
 RooAbsCacheElement.cxx:45
 RooAbsCacheElement.cxx:46
 RooAbsCacheElement.cxx:47
 RooAbsCacheElement.cxx:48
 RooAbsCacheElement.cxx:49
 RooAbsCacheElement.cxx:50
 RooAbsCacheElement.cxx:51
 RooAbsCacheElement.cxx:52
 RooAbsCacheElement.cxx:53
 RooAbsCacheElement.cxx:54
 RooAbsCacheElement.cxx:55
 RooAbsCacheElement.cxx:56
 RooAbsCacheElement.cxx:57
 RooAbsCacheElement.cxx:58
 RooAbsCacheElement.cxx:59
 RooAbsCacheElement.cxx:60
 RooAbsCacheElement.cxx:61
 RooAbsCacheElement.cxx:62
 RooAbsCacheElement.cxx:63
 RooAbsCacheElement.cxx:64
 RooAbsCacheElement.cxx:65
 RooAbsCacheElement.cxx:66
 RooAbsCacheElement.cxx:67
 RooAbsCacheElement.cxx:68
 RooAbsCacheElement.cxx:69
 RooAbsCacheElement.cxx:70
 RooAbsCacheElement.cxx:71
 RooAbsCacheElement.cxx:72
 RooAbsCacheElement.cxx:73
 RooAbsCacheElement.cxx:74
 RooAbsCacheElement.cxx:75
 RooAbsCacheElement.cxx:76
 RooAbsCacheElement.cxx:77
 RooAbsCacheElement.cxx:78
 RooAbsCacheElement.cxx:79
 RooAbsCacheElement.cxx:80
 RooAbsCacheElement.cxx:81
 RooAbsCacheElement.cxx:82
 RooAbsCacheElement.cxx:83
 RooAbsCacheElement.cxx:84
 RooAbsCacheElement.cxx:85
 RooAbsCacheElement.cxx:86
 RooAbsCacheElement.cxx:87
 RooAbsCacheElement.cxx:88
 RooAbsCacheElement.cxx:89
 RooAbsCacheElement.cxx:90
 RooAbsCacheElement.cxx:91
 RooAbsCacheElement.cxx:92
 RooAbsCacheElement.cxx:93
 RooAbsCacheElement.cxx:94
 RooAbsCacheElement.cxx:95
 RooAbsCacheElement.cxx:96
 RooAbsCacheElement.cxx:97