/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 *    File: $Id$
 * Authors:                                                                  *
 *   WV, Wouter Verkerke, NIKHEF, verkerke@nikhef.nl                         *
 *                                                                           *
 * Copyright (c) 2000-2008, NIKHEF, Regents of the University of California  *
 *                          and Stanford University. All rights reserved.    *
 *                                                                           *
 *****************************************************************************/

//////////////////////////////////////////////////////////////////////////////
// 
// BEGIN_HTML
// RooCFunction1Binding is a templated implementation of class RooAbsReal that binds 
// generic C(++) functions to a RooAbsReal argument thus allowing generic C++
// functions to be used as RooFit functions. Instances of function binding
// classes are fully functional RooFit function objects with one exception:
// if the bound function is _not_ a standard TMath or MathMore function the
// class cannot be persisted in a RooWorkspace without registering the function
// pointer first using RooCFunction1Binding<T1,T2>::register().
// END_HTML
//

#include "Riostream.h" 
#include "RooCFunction1Binding.h" 
#include "RooCintUtils.h"

using namespace std ;

#ifndef ROOFIT_R__NO_CLASS_TEMPLATE_SPECIALIZATION
#define ROOFIT_R__NO_CLASS_TEMPLATE_SPECIALIZATION
templateClassImp(RooCFunction1Binding) 
templateClassImp(RooCFunction1Ref) 
#endif 


template<> RooCFunction1Map<double,double>* RooCFunction1Ref<double,double>::_fmap = 0 ;
template<> RooCFunction1Map<double,int>* RooCFunction1Ref<double,int>::_fmap = 0 ;

template<>
RooCFunction1Map<double,double>& RooCFunction1Ref<double,double>::fmap()
 {
    // Return reference to function pointer-to-name mapping service
    if (!_fmap) {
      _fmap = new RooCFunction1Map<double,double> ;
    }
    return *_fmap ;
  }

template<>
RooCFunction1Map<double,int>& RooCFunction1Ref<double,int>::fmap()
 {
    // Return reference to function pointer-to-name mapping service
    if (!_fmap) {
      _fmap = new RooCFunction1Map<double,int> ;
    }
    return *_fmap ;
 }

namespace RooFit {

  RooAbsReal* bindFunction(const char* name,CFUNCD1D func,RooAbsReal& x) {
    return new RooCFunction1Binding<Double_t,Double_t>(name,name,func,x) ;
  }

  RooAbsReal* bindFunction(const char* name,CFUNCD1I func,RooAbsReal& x) {
    return new RooCFunction1Binding<Double_t,Int_t>(name,name,func,x) ;
  }

  RooAbsPdf* bindPdf(const char* name,CFUNCD1D func,RooAbsReal& x) {
    return new RooCFunction1PdfBinding<Double_t,Double_t>(name,name,func,x) ;
  }

  RooAbsPdf* bindPdf(const char* name,CFUNCD1I func,RooAbsReal& x) {
    return new RooCFunction1PdfBinding<Double_t,Int_t>(name,name,func,x) ;
  }

}



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