Logo ROOT   6.16/01
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"
22
24public:
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
59protected:
60
62
63public:
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
75protected:
76
77 ClassDef(RooCategoryProxy,1) // Proxy for a RooAbsCategory object
78};
79
80#endif
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:324
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
virtual Bool_t hasRange(const char *) const
Definition: RooAbsArg.h:293
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)=0
virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE)=0
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
RooArgProxy is the abstact interface for RooAbsArg proxy classes.
Definition: RooArgProxy.h:24
RooAbsArg * _owner
Definition: RooArgProxy.h:51
virtual const char * name() const
Definition: RooArgProxy.h:42
RooAbsArg * _arg
Definition: RooArgProxy.h:52
RooCategoryProxy is the proxy implementation for RooAbsCategory objects A RooCategoryProxy is the gen...
RooCategoryProxy & operator=(Int_t index)
virtual Bool_t setArg(RooAbsCategory &newRef)
Change object held in proxy into newRef.
const RooAbsCategory & arg() const
Bool_t hasRange(const char *rangeName) const
RooCategoryProxy & operator=(const char *_label)
const char * label() const
virtual TObject * Clone(const char *newName=0) const
Make a clone of an object using the Streamer facility.
RooAbsCategoryLValue * lvptr() const
Return RooAbsCategoryLValye pointer of contained object if it is indeed an lvalue.
virtual ~RooCategoryProxy()
Destructor.
Mother of all ROOT objects.
Definition: TObject.h:37