Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooNameReg.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: RooNameReg.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_NAME_REG
0017 #define ROO_NAME_REG
0018 
0019 #include "TNamed.h"
0020 
0021 #include <memory>
0022 #include <unordered_map>
0023 #include <string>
0024 
0025 // String name registry
0026 class RooNameReg : public TNamed {
0027 public:
0028 
0029   RooNameReg(const RooNameReg& other) = delete;
0030 
0031   static RooNameReg& instance() ;
0032   const TNamed* constPtr(const char* stringPtr) ;
0033   /// Return C++ string corresponding to given TNamed pointer.
0034   inline static const char* constStr(const TNamed* ptr) {
0035     return ptr ? ptr->GetName() : nullptr;
0036   }
0037   static const TNamed* ptr(const char* stringPtr) ;
0038   /// Return C++ string corresponding to given TNamed pointer.
0039   inline static const char* str(const TNamed* ptr) {
0040     return ptr ? ptr->GetName() : nullptr;
0041   }
0042   static const TNamed* known(const char* stringPtr) ;
0043   static const std::size_t& renameCounter() ;
0044 
0045   enum {
0046     kRenamedArg = BIT(19)    ///< TNamed flag to indicate that some RooAbsArg has been renamed (flag set in new name)
0047   };
0048 
0049 protected:
0050   RooNameReg();
0051 
0052   friend class RooAbsArg;
0053   friend class RooAbsData;
0054   static void incrementRenameCounter() ;
0055 
0056   std::unordered_map<std::string,std::unique_ptr<TNamed>> _map;
0057   std::size_t _renameCounter = 0;
0058 };
0059 
0060 #endif
0061 
0062