Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
23public:
24
26 RooSharedProperties(const char* uuidstr) ;
27 ~RooSharedProperties() override ;
28 bool operator==(const RooSharedProperties& other) const ;
29
30 // Copying and moving is disabled for RooSharedProperties and derived classes
31 // because it is not meaningful. Instead, one should copy and move around
32 // shared pointers to RooSharedProperties instances.
37
38 void Print(Option_t* opts=nullptr) const override ;
39
41 void decreaseRefCount() { if (_refCount>0) _refCount-- ; }
42 Int_t refCount() const { return _refCount ; }
43
44 void setInSharedList() { _inSharedList = true ; }
45 bool inSharedList() const { return _inSharedList ; }
46
47 // Wrapper class to make the TUUID comparable for use as key type in std::map.
48 class UUID {
49 public:
50 UUID(TUUID const& tuuid) : _uuid{tuuid} {}
51 bool operator<(UUID const& other) const { return _uuid.Compare(other._uuid) < 0; }
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 private:
56 };
57
58 UUID uuid() const { return _uuid; }
59
60protected:
61
62 TUUID _uuid ; ///< Unique object ID
63 Int_t _refCount ; ///<! Use count
64 Int_t _inSharedList ; ///<! Is in shared list
65
66 ClassDefOverride(RooSharedProperties,1) // Abstract interface for shared property implementations
67};
68
69
70#endif
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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.
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
void Print(Option_t *opts=nullptr) const override
Printing interface.
Int_t _inSharedList
! Is in shared list
Mother of all ROOT objects.
Definition TObject.h:41
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