ROOT logo
/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 * @(#)root/roofitcore:$Id: RooCategoryProxy.cxx 28963 2009-06-12 15:47:45Z wouter $
 * 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
// RooCategoryProxy is the proxy implementation for RooAbsCategory objects
// A RooCategoryProxy is the general mechanism to store references
// to RooAbsCategoriess inside a RooAbsArg
//
// RooCategoryProxy provides a cast operator to Int_t and 'const char*', allowing
// the proxy to functions a Int_t/'const char*' on the right hand side of expressions.
// END_HTML
//


#include "RooFit.h"
#include "Riostream.h"
#include "RooArgSet.h"
#include "RooCategoryProxy.h"

ClassImp(RooCategoryProxy)
;


//_____________________________________________________________________________
RooCategoryProxy::RooCategoryProxy(const char* Name, const char* desc, RooAbsArg* owner,
				   Bool_t valueServer, Bool_t shapeServer, Bool_t ownArg) : 
  RooArgProxy(Name, desc, owner, valueServer, shapeServer, ownArg)
{
  // Constructor with owner and proxied category object
}



//_____________________________________________________________________________
RooCategoryProxy::RooCategoryProxy(const char* Name, const char* desc, RooAbsArg* owner, RooAbsCategory& ref,
				   Bool_t valueServer, Bool_t shapeServer, Bool_t ownArg) : 
  RooArgProxy(Name, desc, owner, ref, valueServer, shapeServer, ownArg)
{
  // Constructor with owner and proxied category object
}



//_____________________________________________________________________________
RooCategoryProxy::RooCategoryProxy(const char* Name, RooAbsArg* owner, const RooCategoryProxy& other) : 
  RooArgProxy(Name, owner, other) 
{
  // Copy constructor
}



//_____________________________________________________________________________
RooCategoryProxy::~RooCategoryProxy() 
{
  // Destructor
}



//_____________________________________________________________________________
RooAbsCategoryLValue* RooCategoryProxy::lvptr() const 
{
  // Return RooAbsCategoryLValye pointer of contained object if
  // it is indeed an lvalue

  // Assert that the held arg is an LValue
  RooAbsCategoryLValue* Lvptr = dynamic_cast<RooAbsCategoryLValue*>(_arg) ;
  if (!Lvptr) {
    cout << "RooCategoryProxy(" << name() << ")::INTERNAL error, expected " << _arg->GetName() << " to be an lvalue" << endl ;
    assert(0) ;
  }
  return Lvptr ;
}



//_____________________________________________________________________________
Bool_t RooCategoryProxy::setArg(RooAbsCategory& newRef) 
{
  // Change object held in proxy into newRef
  if (absArg()) {
    if (TString(arg().GetName()!=newRef.GetName())) {
      newRef.setAttribute(Form("ORIGNAME:%s",arg().GetName())) ;
    }
    return changePointer(RooArgSet(newRef),kTRUE) ;
  } else {
    return changePointer(RooArgSet(newRef),kFALSE,kTRUE);
  }
}
 RooCategoryProxy.cxx:1
 RooCategoryProxy.cxx:2
 RooCategoryProxy.cxx:3
 RooCategoryProxy.cxx:4
 RooCategoryProxy.cxx:5
 RooCategoryProxy.cxx:6
 RooCategoryProxy.cxx:7
 RooCategoryProxy.cxx:8
 RooCategoryProxy.cxx:9
 RooCategoryProxy.cxx:10
 RooCategoryProxy.cxx:11
 RooCategoryProxy.cxx:12
 RooCategoryProxy.cxx:13
 RooCategoryProxy.cxx:14
 RooCategoryProxy.cxx:15
 RooCategoryProxy.cxx:16
 RooCategoryProxy.cxx:17
 RooCategoryProxy.cxx:18
 RooCategoryProxy.cxx:19
 RooCategoryProxy.cxx:20
 RooCategoryProxy.cxx:21
 RooCategoryProxy.cxx:22
 RooCategoryProxy.cxx:23
 RooCategoryProxy.cxx:24
 RooCategoryProxy.cxx:25
 RooCategoryProxy.cxx:26
 RooCategoryProxy.cxx:27
 RooCategoryProxy.cxx:28
 RooCategoryProxy.cxx:29
 RooCategoryProxy.cxx:30
 RooCategoryProxy.cxx:31
 RooCategoryProxy.cxx:32
 RooCategoryProxy.cxx:33
 RooCategoryProxy.cxx:34
 RooCategoryProxy.cxx:35
 RooCategoryProxy.cxx:36
 RooCategoryProxy.cxx:37
 RooCategoryProxy.cxx:38
 RooCategoryProxy.cxx:39
 RooCategoryProxy.cxx:40
 RooCategoryProxy.cxx:41
 RooCategoryProxy.cxx:42
 RooCategoryProxy.cxx:43
 RooCategoryProxy.cxx:44
 RooCategoryProxy.cxx:45
 RooCategoryProxy.cxx:46
 RooCategoryProxy.cxx:47
 RooCategoryProxy.cxx:48
 RooCategoryProxy.cxx:49
 RooCategoryProxy.cxx:50
 RooCategoryProxy.cxx:51
 RooCategoryProxy.cxx:52
 RooCategoryProxy.cxx:53
 RooCategoryProxy.cxx:54
 RooCategoryProxy.cxx:55
 RooCategoryProxy.cxx:56
 RooCategoryProxy.cxx:57
 RooCategoryProxy.cxx:58
 RooCategoryProxy.cxx:59
 RooCategoryProxy.cxx:60
 RooCategoryProxy.cxx:61
 RooCategoryProxy.cxx:62
 RooCategoryProxy.cxx:63
 RooCategoryProxy.cxx:64
 RooCategoryProxy.cxx:65
 RooCategoryProxy.cxx:66
 RooCategoryProxy.cxx:67
 RooCategoryProxy.cxx:68
 RooCategoryProxy.cxx:69
 RooCategoryProxy.cxx:70
 RooCategoryProxy.cxx:71
 RooCategoryProxy.cxx:72
 RooCategoryProxy.cxx:73
 RooCategoryProxy.cxx:74
 RooCategoryProxy.cxx:75
 RooCategoryProxy.cxx:76
 RooCategoryProxy.cxx:77
 RooCategoryProxy.cxx:78
 RooCategoryProxy.cxx:79
 RooCategoryProxy.cxx:80
 RooCategoryProxy.cxx:81
 RooCategoryProxy.cxx:82
 RooCategoryProxy.cxx:83
 RooCategoryProxy.cxx:84
 RooCategoryProxy.cxx:85
 RooCategoryProxy.cxx:86
 RooCategoryProxy.cxx:87
 RooCategoryProxy.cxx:88
 RooCategoryProxy.cxx:89
 RooCategoryProxy.cxx:90
 RooCategoryProxy.cxx:91
 RooCategoryProxy.cxx:92
 RooCategoryProxy.cxx:93
 RooCategoryProxy.cxx:94
 RooCategoryProxy.cxx:95
 RooCategoryProxy.cxx:96
 RooCategoryProxy.cxx:97
 RooCategoryProxy.cxx:98
 RooCategoryProxy.cxx:99
 RooCategoryProxy.cxx:100
 RooCategoryProxy.cxx:101
 RooCategoryProxy.cxx:102
 RooCategoryProxy.cxx:103
 RooCategoryProxy.cxx:104
 RooCategoryProxy.cxx:105