Logo ROOT  
Reference Guide
RooNameReg.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooNameReg.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_NAME_REG
17 #define ROO_NAME_REG
18 
19 #include "TNamed.h"
20 
21 #include <memory>
22 #include <unordered_map>
23 #include <string>
24 
25 class RooNameReg : public TNamed {
26 public:
27 
28  static RooNameReg& instance() ;
29  virtual ~RooNameReg();
30  const TNamed* constPtr(const char* stringPtr) ;
31  const char* constStr(const TNamed* namePtr) ;
32  static const TNamed* ptr(const char* stringPtr) ;
33  static const char* str(const TNamed* ptr) ;
34  static const TNamed* known(const char* stringPtr) ;
35 
36  enum {
37  kRenamedArg = BIT(19) // TNamed flag to indicate that some RooAbsArg has been renamed (flag set in new name)
38  };
39 
40 protected:
41  RooNameReg();
42 // RooNameReg(Int_t hashSize = 31) ;
43  RooNameReg(const RooNameReg& other) = delete;
44 
45  std::unordered_map<std::string,std::unique_ptr<TNamed>> _map;
46 
47 // ClassDef(RooNameReg,1) // String name registry
48 };
49 
50 #endif
51 
52 
RooNameReg::instance
static RooNameReg & instance()
Return reference to singleton instance.
Definition: RooNameReg.cxx:51
RooNameReg::~RooNameReg
virtual ~RooNameReg()
Destructor.
Definition: RooNameReg.cxx:43
RooNameReg
RooNameReg is a registry for const char* names.
Definition: RooNameReg.h:25
RooNameReg::ptr
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
Definition: RooNameReg.cxx:93
TNamed.h
RooNameReg::RooNameReg
RooNameReg()
Definition: RooNameReg.cxx:36
RooNameReg::_map
std::unordered_map< std::string, std::unique_ptr< TNamed > > _map
Definition: RooNameReg.h:45
RooNameReg::constPtr
const TNamed * constPtr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
Definition: RooNameReg.cxx:61
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
BIT
#define BIT(n)
Definition: Rtypes.h:85
RooNameReg::kRenamedArg
@ kRenamedArg
Definition: RooNameReg.h:37
RooNameReg::constStr
const char * constStr(const TNamed *namePtr)
Return C++ string corresponding to given TNamed pointer.
Definition: RooNameReg.cxx:83
RooNameReg::RooNameReg
RooNameReg(const RooNameReg &other)=delete
RooNameReg::str
static const char * str(const TNamed *ptr)
Return C++ string corresponding to given TNamed pointer.
Definition: RooNameReg.cxx:103
RooNameReg::known
static const TNamed * known(const char *stringPtr)
If the name is already known, return its TNamed pointer. Otherwise return 0 (don't register the name)...
Definition: RooNameReg.cxx:113