SFrame 3.6
|
00001 // Dear emacs, this is -*- c++ -*- 00002 // $Id: SCycleBaseConfig.h 331 2012-11-20 17:12:44Z krasznaa $ 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_SCycleBaseConfig_H 00015 #define SFRAME_CORE_SCycleBaseConfig_H 00016 00017 // STL include(s): 00018 #include <vector> 00019 #include <map> 00020 #include <string> 00021 #include <set> 00022 00023 // ROOT include(s): 00024 #include "TList.h" 00025 00026 // Local include(s): 00027 #include "ISCycleBaseConfig.h" 00028 #include "SCycleBaseBase.h" 00029 #include "SError.h" 00030 #include "SCycleConfig.h" 00031 00032 // Forward declaration(s): 00033 class TXMLNode; 00034 00047 class SCycleBaseConfig : public virtual ISCycleBaseConfig, 00048 public virtual SCycleBaseBase { 00049 00050 public: 00052 SCycleBaseConfig(); 00053 00055 void Initialize( TXMLNode* ) throw( SError ); 00056 00058 const SCycleConfig& GetConfig() const; 00060 SCycleConfig& GetConfig(); 00062 virtual void SetConfig( const SCycleConfig& config ); 00063 00065 virtual const TList& GetConfigurationObjects() const; 00066 00068 virtual void SetConfInput( TList* input ); 00070 virtual TList* GetConfInput() const; 00071 00073 void DeclareProperty( const std::string& name, std::string& value ); 00075 void DeclareProperty( const std::string& name, int& value ); 00077 void DeclareProperty( const std::string& name, double& value ); 00079 void DeclareProperty( const std::string& name, bool& value ); 00081 void DeclareProperty( const std::string& name, std::vector< std::string >& value ); 00083 void DeclareProperty( const std::string& name, std::vector< int >& value ); 00085 void DeclareProperty( const std::string& name, std::vector< double >& value ); 00087 void DeclareProperty( const std::string& name, std::vector< bool >& value ); 00088 00090 void AddConfigObject( TObject* object ); 00092 TObject* GetConfigObject( const char* name ) const; 00093 00094 protected: 00096 virtual SInputData InitializeInputData( TXMLNode* ) throw( SError ); 00098 virtual void InitializeUserConfig( TXMLNode* ) throw( SError ); 00099 00101 void SetProperty( const std::string& name, 00102 const std::string& value ) throw( SError ); 00103 00105 std::string DecodeEnvVar( const std::string& value ) const; 00106 00108 SCycleConfig m_config; 00109 00110 private: 00112 bool ToBool( const std::string& value ) throw( SError ); 00114 template< typename T > 00115 void AddUserOptions( const std::map< const std::string, T* >& prefs ); 00116 00117 // 00118 // These are the object used to handle the preferences of the 00119 // derived classes. Note that because of some "improvements" in 00120 // the ROOT code, now these have to be very strictly hidden from 00121 // the dictionary generation. 00122 // 00123 #ifndef __MAKECINT__ 00124 std::set< std::string > m_configuredPrefs; 00125 std::map< const std::string, std::string* > m_stringPrefs; 00126 std::map< const std::string, int* > m_intPrefs; 00127 std::map< const std::string, double* > m_doublePrefs; 00128 std::map< const std::string, bool* > m_boolPrefs; 00129 std::map< const std::string, std::vector< std::string >* > m_stringListPrefs; 00130 std::map< const std::string, std::vector< int >* > m_intListPrefs; 00131 std::map< const std::string, std::vector< double >* > m_doubleListPrefs; 00132 std::map< const std::string, std::vector< bool >* > m_boolListPrefs; 00133 #endif // __MAKECINT__ 00134 00135 // 00136 // The TList has to be hidden from the dictionary generator because one 00137 // of the internal components of TList doesn't have a dictionary. This 00138 // produces a WARNING message when the CINT dictionary knows about this 00139 // variable. 00140 // 00141 #ifndef __MAKECINT__ 00142 00143 TList m_configList; 00144 #endif // __MAKECINT__ 00145 00146 TList* m_input; 00147 00148 #ifndef DOXYGEN_IGNORE 00149 ClassDef( SCycleBaseConfig, 0 ); 00150 #endif // DOXYGEN_IGNORE 00151 00152 }; // class SCycleBaseConfig 00153 00154 #endif // SFRAME_CORE_SCycleBaseConfig_H