Logo ROOT  
Reference Guide
RooSharedProperties.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooSharedProperties.h,v 1.3 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_ABS_SHARED_PROPERTY
17#define ROO_ABS_SHARED_PROPERTY
18
19#include "TObject.h"
20#include "TUUID.h"
21#include "TString.h"
22
24public:
25
27 RooSharedProperties(const char* uuidstr) ;
28 ~RooSharedProperties() override ;
29 bool operator==(const RooSharedProperties& other) const ;
30
31 // Copying and moving is disabled for RooSharedProperties and derived classes
32 // because it is not meaningful. Instead, one should copy and move around
33 // shared pointers to RooSharedProperties instances.
38
39 void Print(Option_t* opts=0) const override ;
40
42 void decreaseRefCount() { if (_refCount>0) _refCount-- ; }
43 Int_t refCount() const { return _refCount ; }
44
45 void setInSharedList() { _inSharedList = true ; }
46 bool inSharedList() const { return _inSharedList ; }
47
48 // Wrapper class to make the TUUID comparable for use as key type in std::map.
49 class UUID {
50 public:
51 UUID(TUUID const& tuuid) : _uuid{tuuid} {}
52 bool operator<(UUID const& other) const { return _uuid.Compare(other._uuid) < 0; }
53 bool operator>(UUID const& other) const { return _uuid.Compare(other._uuid) > 0; }
54 bool operator==(UUID const& other) const { return _uuid.Compare(other._uuid) == 0; }
55 private:
57 };
58
59 UUID uuid() const { return _uuid; }
60
61protected:
62
63 TUUID _uuid ; ///< Unique object ID
64 Int_t _refCount ; ///<! Use count
65 Int_t _inSharedList ; ///<! Is in shared list
66
67 ClassDefOverride(RooSharedProperties,1) // Abstract interface for shared property implementations
68};
69
70
71#endif
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
bool operator>(UUID const &other) const
bool operator==(UUID const &other) const
bool operator<(UUID const &other) const
Class RooSharedProperties is the base class for shared properties that can be stored in RooSharedProp...
RooSharedProperties & operator=(const RooSharedProperties &)=delete
bool operator==(const RooSharedProperties &other) const
Return true of unique id of this property is equal to that of other.
void Print(Option_t *opts=0) const override
Printing interface.
RooSharedProperties(const RooSharedProperties &)=delete
~RooSharedProperties() override
Destructor.
RooSharedProperties()
Default constructor.
RooSharedProperties & operator=(RooSharedProperties &&)=delete
RooSharedProperties(RooSharedProperties &&)=delete
TUUID _uuid
Unique object ID.
Int_t _refCount
! Use count
Int_t _inSharedList
! Is in shared list
Mother of all ROOT objects.
Definition: TObject.h:37
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
Definition: TUUID.h:42
Int_t Compare(const TUUID &u) const
Compare two UUIDs "lexically" and return.
Definition: TUUID.cxx:636