SFrame 3.6
plug-ins/include/SSummedVar.h
Go to the documentation of this file.
00001 // Dear emacs, this is -*- c++ -*-
00002 // $Id: SSummedVar.h 229 2010-12-01 11:35:33Z krasznaa $
00003 /***************************************************************************
00004  * @Project: SFrame - ROOT-based analysis framework for ATLAS
00005  * @Package: Plug-ins
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_PLUGINS_SSummedVar_H
00015 #define SFRAME_PLUGINS_SSummedVar_H
00016 
00017 // STL include(s):
00018 #include <map>
00019 
00020 // ROOT include(s):
00021 #include <TNamed.h>
00022 #include <TString.h>
00023 
00024 // SFrame include(s):
00025 #include "core/include/SError.h"
00026 
00027 // Forward declaration(s):
00028 class TCollection;
00029 class ISCycleBaseHist;
00030 
00043 template< class Type >
00044 class ProofSummedVar : public TNamed {
00045 
00046 public:
00048    ProofSummedVar( const char* name = 0, const char* title = 0 );
00050    virtual Int_t Merge( TCollection* coll );
00052    Type m_member;
00053 
00054 #ifndef DOXYGEN_IGNORE
00055    ClassDef( ProofSummedVar, 1 );
00056 #endif // DOXYGEN_IGNORE
00057 
00058 }; // class ProofSummedVar
00059 
00078 template< class Type >
00079 class SSummedVar {
00080 
00081 public:
00083    typedef Type ValueType;
00084 
00086    SSummedVar( const char* name, ISCycleBaseHist* parent );
00087 
00089    operator Type&();
00091    operator const Type&() const;
00092 
00094    Type& operator*();
00096    Type* operator->();
00097 
00099    Type& GetReference();
00101    Type* GetPointer();
00102 
00104    const Type& operator*() const;
00106    const Type* operator->() const;
00107 
00109    const Type& GetReference() const;
00111    const Type* GetPointer() const;
00112 
00113 private:
00115    ProofSummedVar< Type >* GetObject() const throw( SError );
00116 
00117    TString                         m_objName; 
00118    ISCycleBaseHist*                m_parent; 
00119    mutable ProofSummedVar< Type >* m_object; 
00120 
00121 }; // class SSummedVar
00122 
00123 //
00124 // Include template implementation:
00125 //
00126 #ifndef __CINT__
00127 #include "SSummedVar.icc"
00128 #endif // __CINT__
00129 
00130 #endif // SFRAME_PLUGINS_SSummedVar_H