Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooSharedProperties.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooSharedProperties.h,v 1.3 2007/05/11 09:11:30 verkerke Exp $
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
0007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
0008  *                                                                           *
0009  * Copyright (c) 2000-2005, Regents of the University of California          *
0010  *                          and Stanford University. All rights reserved.    *
0011  *                                                                           *
0012  * Redistribution and use in source and binary forms,                        *
0013  * with or without modification, are permitted according to the terms        *
0014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0015  *****************************************************************************/
0016 #ifndef ROO_ABS_SHARED_PROPERTY
0017 #define ROO_ABS_SHARED_PROPERTY
0018 
0019 #include "TObject.h"
0020 #include "TUUID.h"
0021 
0022 class RooSharedProperties : public TObject {
0023 public:
0024 
0025   RooSharedProperties() ;
0026   RooSharedProperties(const char* uuidstr) ;
0027   ~RooSharedProperties() override ;
0028   bool operator==(const RooSharedProperties& other) const ;
0029 
0030   // Copying and moving is disabled for RooSharedProperties and derived classes
0031   // because it is not meaningful. Instead, one should copy and move around
0032   // shared pointers to RooSharedProperties instances.
0033   RooSharedProperties(const RooSharedProperties&) = delete;
0034   RooSharedProperties& operator=(const RooSharedProperties&) = delete;
0035   RooSharedProperties(RooSharedProperties &&) = delete;
0036   RooSharedProperties& operator=(RooSharedProperties &&) = delete;
0037 
0038   void Print(Option_t* opts=nullptr) const override ;
0039 
0040   void increaseRefCount() { _refCount++ ; }
0041   void decreaseRefCount() { if (_refCount>0) _refCount-- ; }
0042   Int_t refCount() const { return _refCount ; }
0043 
0044   void setInSharedList() { _inSharedList = true ; }
0045   bool inSharedList() const { return _inSharedList ; }
0046 
0047    // Wrapper class to make the TUUID comparable for use as key type in std::map.
0048    class UUID {
0049    public:
0050      UUID(TUUID const& tuuid) : _uuid{tuuid} {}
0051      bool operator<(UUID const& other) const { return _uuid.Compare(other._uuid) < 0; }
0052      bool operator>(UUID const& other) const { return _uuid.Compare(other._uuid) > 0; }
0053      bool operator==(UUID const& other) const { return _uuid.Compare(other._uuid) == 0; }
0054    private:
0055      TUUID _uuid;
0056    };
0057 
0058    UUID uuid() const { return _uuid; }
0059 
0060 protected:
0061 
0062   TUUID _uuid ; ///< Unique object ID
0063   Int_t _refCount ; ///<! Use count
0064   Int_t _inSharedList ; ///<! Is in shared list
0065 
0066   ClassDefOverride(RooSharedProperties,1) // Abstract interface for shared property implementations
0067 };
0068 
0069 
0070 #endif