/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/DistBoss/DistBossUtil/DistBossUtil-00-00-04/DistBossUtil/GetPropertyValue.h

Go to the documentation of this file.
00001 #ifndef GET_PROPERTY_VALUE_H
00002 #define GET_PROPERTY_VALUE_H
00003 
00004 #include "GaudiKernel/IJobOptionsSvc.h"
00005 #include "GaudiKernel/Bootstrap.h"
00006 #include "GaudiKernel/StatusCode.h"
00007 #include "GaudiKernel/Parsers.h"  //in "GaudiSvc/JobOptionsSvc"
00008 
00009 namespace DistBoss {
00010 
00011 template<typename T>
00012 StatusCode GetPropertyValue(const std::string& client, const std::string& name, T& value)
00013 {
00014    static IJobOptionsSvc* jobSvc = 0;
00015 
00016    StatusCode sc;
00017 
00018    if ( jobSvc == 0 ) {
00019       sc = Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
00020       if ( sc.isFailure() ) {
00021          std::cout << "Can't get the JobOptionsSvc @ DistBoss::GetPropertyValue()" << std::endl;
00022          return sc;
00023       }
00024    }
00025 
00026    const std::vector<const Property*>* properties = jobSvc->getProperties(client);
00027    if ( properties == NULL ) {
00028       std::cout << "In DistBoss::GetPropertyValue(), can't get client: " << client << std::endl;
00029       return StatusCode::FAILURE;
00030    }
00031 
00032    for ( unsigned int i = 0; i < properties->size(); ++i ) {
00033       if ( properties->at(i)->name() == name ) {
00034          return Gaudi::Parsers::parse(value, properties->at(i)->toString());
00035       }
00036    }
00037 
00038    return StatusCode::FAILURE;
00039 }
00040 
00041 }
00042 
00043 #endif

Generated on Tue Nov 29 22:58:02 2016 for BOSS_7.0.2 by  doxygen 1.4.7