SFrame 3.6
core/include/STreeTypeDecoder.h
Go to the documentation of this file.
00001 // Dear emacs, this is -*- c++ -*-
00002 // $Id$
00003 /***************************************************************************
00004  * @Project: SFrame - ROOT-based analysis framework for ATLAS
00005  * @Package: Core
00006  *
00007  * @author Stefan Ask       <Stefan.Ask@cern.ch>           - Manchester
00008  * @author David Berge      <David.Berge@cern.ch>          - CERN
00009  * @author Johannes Haller  <Johannes.Haller@cern.ch>      - Hamburg
00010  * @author A. Krasznahorkay <Attila.Krasznahorkay@cern.ch> - CERN/Debrecen
00011  *
00012  ***************************************************************************/
00013 
00014 #ifndef SFRAME_CORE_STreeTypeDecoder_H
00015 #define SFRAME_CORE_STreeTypeDecoder_H
00016 
00017 // STL include(s):
00018 #include <map>
00019 
00020 // ROOT include(s):
00021 #include <TString.h>
00022 
00045 class STreeTypeDecoder {
00046 
00047 public:
00049    static STreeTypeDecoder* Instance();
00050 
00052    void AddType( const TString& xmlName, const TString& name, Int_t code );
00053 
00055    const TString& GetName( Int_t code ) const;
00057    Int_t GetCode( const TString& name ) const;
00058 
00060    const TString& GetXMLName( Int_t code ) const;
00062    Int_t GetXMLCode( const TString& name ) const;
00063 
00064 private:
00066    STreeTypeDecoder();
00067 
00068    std::map< TString, Int_t > m_forwardMap; 
00069    std::map< Int_t, TString > m_reverseMap; 
00070 
00072    std::map< TString, Int_t > m_xmlForwardMap;
00074    std::map< Int_t, TString > m_xmlReverseMap;
00075 
00077    static const TString m_unknownName;
00079    static const Int_t   m_unknownCode;
00080 
00081    static STreeTypeDecoder* m_instance; 
00082 
00083 }; // class STreeTypeDecoder
00084 
00085 #endif // SFRAME_CORE_STreeTypeDecoder_H