00001 #ifndef EDG_WORKLOAD_COMMON_CONFIGURATION_CONFIGURATION_H
00002 #define EDG_WORKLOAD_COMMON_CONFIGURATION_CONFIGURATION_H
00003
00004 #include <string>
00005 #include <memory>
00006
00007 #include "ModuleType.h"
00008
00009 namespace classad { class ClassAd; }
00010
00011 COMMON_NAMESPACE_BEGIN {
00012
00013 namespace configuration {
00014
00015
00016 class JCConfiguration;
00017 class LMConfiguration;
00018 class NSConfiguration;
00019 class WMConfiguration;
00020 class CommonConfiguration;
00021
00022 class Configuration {
00023 public:
00024 Configuration( const std::string &filename, const ModuleType &type );
00025 Configuration( const ModuleType &type );
00026
00027 ~Configuration( void );
00028
00029 inline ModuleType::module_type get_module( void ) const { return this->c_mtype.get_codetype(); }
00030
00031 inline const JCConfiguration *jc( void ) const { return this->c_jc.get(); }
00032 inline const LMConfiguration *lm( void ) const { return this->c_lm.get(); }
00033 inline const NSConfiguration *ns( void ) const { return this->c_ns.get(); }
00034 inline const WMConfiguration *wm( void ) const { return this->c_wm.get(); }
00035 inline const CommonConfiguration *common( void ) const { return this->c_common.get(); }
00036
00037 inline static const Configuration *instance( void ) { return c_s_instance; }
00038
00039 classad::ClassAd *get_classad( void );
00040
00041 private:
00042 void createConfiguration( const std::string &filename );
00043 void loadFile( const char *filename );
00044
00045 std::auto_ptr<JCConfiguration> c_jc;
00046 std::auto_ptr<LMConfiguration> c_lm;
00047 std::auto_ptr<NSConfiguration> c_ns;
00048 std::auto_ptr<WMConfiguration> c_wm;
00049 std::auto_ptr<CommonConfiguration> c_common;
00050 std::auto_ptr<classad::ClassAd> c_read;
00051 ModuleType c_mtype;
00052
00053 static const Configuration *c_s_instance;
00054 static const char *c_s_paths[];
00055
00056 Configuration( const Configuration &c );
00057 Configuration &operator=( const Configuration &c );
00058 };
00059
00060 };
00061
00062 } COMMON_NAMESPACE_END;
00063
00064 #endif
00065
00066
00067
00068