Logo ROOT   6.14/05
Reference Guide
RooCategoryProxy.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooCategoryProxy.h,v 1.20 2007/05/11 09:11:30 verkerke Exp $
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 #ifndef ROO_CATEGORY_PROXY
17 #define ROO_CATEGORY_PROXY
18 
19 #include "RooAbsCategory.h"
20 #include "RooArgProxy.h"
21 #include "RooAbsCategoryLValue.h"
22 
23 class RooCategoryProxy : public RooArgProxy {
24 public:
25 
26  // Constructors, assignment etc.
28  // Default constructor
29  } ;
30  RooCategoryProxy(const char* name, const char* desc, RooAbsArg* owner,
31  Bool_t valueServer=kTRUE, Bool_t shapeServer=kFALSE, Bool_t proxyOwnsArg=kFALSE) ;
32  RooCategoryProxy(const char* name, const char* desc, RooAbsArg* owner, RooAbsCategory& ref,
33  Bool_t valueServer=kTRUE, Bool_t shapeServer=kFALSE, Bool_t proxyOwnsArg=kFALSE) ;
34  RooCategoryProxy(const char* name, RooAbsArg* owner, const RooCategoryProxy& other) ;
35  virtual TObject* Clone(const char* newName=0) const { return new RooCategoryProxy(newName,_owner,*this); }
36  virtual ~RooCategoryProxy();
37 
38  // Accessors
39  inline operator Int_t() const {
40  // Facilitates use of proxy as integer
41  return ((RooAbsCategory*)_arg)->getIndex() ;
42  }
43  inline const char* label() const {
44  // Facilitates use of proxy as string value
45  return ((RooAbsCategory*)_arg)->getLabel() ;
46  }
47  inline const RooAbsCategory& arg() const {
48  // Return proxies argument
49  return (RooAbsCategory&)*_arg ;
50  }
51  inline Bool_t hasRange(const char* rangeName) const {
52  // Returns true if proxied argument has range with given name
53  return arg().hasRange(rangeName) ;
54  }
55 
56  // Modifier
57  virtual Bool_t setArg(RooAbsCategory& newRef) ;
58 
59 protected:
60 
61  RooAbsCategoryLValue* lvptr() const ;
62 
63 public:
64 
65  // LValue operations
67  // Assignment operator with index value
68  lvptr()->setIndex(index) ; return *this ;
69  }
70  RooCategoryProxy& operator=(const char* _label) {
71  // Assignment value with string value
72  lvptr()->setLabel(_label) ; return *this ;
73  }
74 
75 protected:
76 
77  ClassDef(RooCategoryProxy,1) // Proxy for a RooAbsCategory object
78 };
79 
80 #endif
const char * label() const
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)=0
RooAbsArg * _arg
Definition: RooArgProxy.h:52
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual ~RooCategoryProxy()
Destructor.
virtual TObject * Clone(const char *newName=0) const
Make a clone of an object using the Streamer facility.
#define ClassDef(name, id)
Definition: Rtypes.h:320
const RooAbsCategory & arg() const
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
RooCategoryProxy & operator=(Int_t index)
virtual Bool_t setArg(RooAbsCategory &newRef)
Change object held in proxy into newRef.
virtual const char * name() const
Definition: RooArgProxy.h:42
RooCategoryProxy & operator=(const char *_label)
virtual Bool_t hasRange(const char *) const
Definition: RooAbsArg.h:293
Bool_t hasRange(const char *rangeName) const
const Bool_t kFALSE
Definition: RtypesCore.h:88
RooAbsCategoryLValue * lvptr() const
Return RooAbsCategoryLValye pointer of contained object if it is indeed an lvalue.
RooCategoryProxy is the proxy implementation for RooAbsCategory objects A RooCategoryProxy is the gen...
Mother of all ROOT objects.
Definition: TObject.h:37
RooArgProxy is the abstact interface for RooAbsArg proxy classes.
Definition: RooArgProxy.h:24
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
RooAbsArg * _owner
Definition: RooArgProxy.h:51
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE)=0