| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# configGenerator Class Reference

Collaboration diagram for configGenerator:

[legend]
List of all members.

## Detailed Description

Definition at line 70 of file genconf.cpp.

## Public Member Functions
| configGenerator (const string &pkgName, const string &outputDirName)
int | genConfig (const Strings_t &modules)
| main entry point of this class: iterate over all the modules (ie: library names) for each module extract component informations eventually generate the header/body/trailer python file and "Db" file
void | setConfigurableModule (const std::string &moduleName)
| customize the Module name where configurable base classes are defined
void | setConfigurableDefaultName (const std::string &defaultName)
| customize the default name for configurable instances
void | setConfigurableAlgorithm (const std::string &cfgAlgorithm)
| customize the configurable base class for Algorithm component
void | setConfigurableAlgTool (const std::string &cfgAlgTool)
| customize the configurable base class for AlgTool component
void | setConfigurableAuditor (const std::string &cfgAuditor)
| customize the configurable base class for AlgTool component
void | setConfigurableService (const std::string &cfgService)
| customize the configurable base class for Service component
## Private Member Functions
void | genComponent (const std::string &libName, const std::string &componentName, const std::string &componentType, const vector< Property * > &properties)
void | genImport (std::ostream &s, const boost::format &frmt, std::string indent)
void | genHeader (std::ostream &pyOut, std::ostream &dbOut)
void | genBody (std::ostream &pyOut, std::ostream &dbOut)
void | genTrailer (std::ostream &pyOut, std::ostream &dbOut)
void | pythonizeValue (const Property *prop, string &pvalue, string &ptype)
| handle the "marshalling" of Properties
void | pythonizeName (string &name)
| Translates a valid C++ typename into a valid python one.
## Private Attributes
string | m_pkgName
| name of the package we are processing
string | m_outputDirName
| absolute path to the directory where genconf will store auto-generated files (Configurables and ConfigurableDb)
stringstream | m_pyBuf
| buffer of auto-generated configurables
bool | m_importGaudiHandles
| switch to decide if the generated configurables need to import GaudiHandles (ie: if one of the components has a XyzHandle<T>)
stringstream | m_dbBuf
| buffer of generated configurables informations for the "Db" file The "Db" file is holding informations about the generated configurables This file is later one used by the PropertyProxy.py to locate Configurables and know their default values, host module,.
GaudiUtils::HashMap< std::string, std::string > | m_configurable
| Configurable customization.

## Constructor & Destructor Documentation

configGenerator::configGenerator | ( | const string & | pkgName,
|  | const string & | outputDirName |
| ) |  |  | `[inline]`

Definition at line 100 of file genconf.cpp.

    00101                                                  :
    00102     m_pkgName           ( pkgName ),
    00103     m_outputDirName     ( outputDirName ),
    00104     m_pyBuf             ( ),
    00105     m_importGaudiHandles( false ),
    00106     m_dbBuf             ( ),
    00107     m_configurable      ( )
    00108   {}

## Member Function Documentation

int configGenerator::genConfig | ( | const Strings_t & | modules | ) |

main entry point of this class:

- iterate over all the modules (ie: library names)
- for each module extract component informations
- eventually generate the header/body/trailer python file and "Db" file

not enough information... skip it

no Properties, so don't bother create Configurables...

: no Configurable for this component. yet... continue;

write-out files for this library

Definition at line 400 of file genconf.cpp.

References IInterface::addRef(), std::vector< _Tp, _Alloc >::begin(), std::basic_string< _CharT, _Traits, _Alloc >::c_str(), std::cout, cout, createAppMgr(), StatusCode::disableChecking(), DsoUtils::dsoName(), std::set< _Key, _Compare, _Alloc >::end(), std::vector< _Tp, _Alloc >::end(), std::endl(), endl(), std::set< _Key, _Compare, _Alloc >::find(), std::find(), genBody(), genComponent(), genHeader(), genTrailer(), System::getLastErrorString(), IProperty::getProperties(), DsoUtils::inDso(), std::set< _Key, _Compare, _Alloc >::insert(), IProperty::interfaceID(), DsoUtils::libNativeName(), System::loadDynamicLib(), m_dbBuf, m_importGaudiHandles, m_outputDirName, m_pyBuf, name, Object, std::ios_base::out, Gaudi::Utils::Histos::path(), IInterface::queryInterface(), IInterface::release(), std::vector< _Tp, _Alloc >::reserve(), std::vector< _Tp, _Alloc >::resize(), std::basic_stringstream< _CharT, _Traits, _Alloc >::str(), Gaudi::svcLocator(), std::ios_base::trunc, and std::exception::what().

    00402 {
    00403   //--- Disable checking StatusCode -------------------------------------------
    00404   StatusCode::disableChecking();
    00405
    00406   const Strings_t::const_iterator endLib = libs.end();
    00407
    00408   const std::string gaudiSvc = "GaudiSvc";
    00409   const bool isGaudiSvc = ( std::find( libs.begin(), endLib, gaudiSvc ) != endLib );
    00410
    00411   //--- Instantiate ApplicationMgr --------------------------------------------
    00412   if ( !isGaudiSvc && createAppMgr() ) {
    00413     cout << "ERROR: ApplicationMgr can not be created. Check environment" << endl;
    00414     return EXIT_FAILURE;
    00415   }
    00416
    00417   //--- Iterate over component factories --------------------------------------
    00418   Scope factories = Scope::ByName(PLUGINSVC_FACTORY_NS);
    00419   if ( !factories ) {
    00420     cout << "ERROR: No PluginSvc factory namespace could be found" << endl;
    00421     return EXIT_FAILURE;
    00422   }
    00423
    00424   ISvcLocator* svcLoc = Gaudi::svcLocator();
    00425   IService*    dummySvc = new Service( "DummySvc", svcLoc );
    00426   dummySvc->addRef();
    00427
    00428   bool allGood = true;
    00429
    00430   // iterate over all the requested libraries
    00431   for ( Strings_t::const_iterator iLib=libs.begin(); iLib != endLib; ++iLib ) {
    00432
    00433     std::cout << ":::: processing library: " << *iLib << "..." << std::endl;
    00434
    00435     // reset state
    00436     m_importGaudiHandles = false;
    00437     m_pyBuf.str("");
    00438     m_dbBuf.str("");
    00439
    00440     // Scan the pluginSvc namespace and store the "background" of already
    00441     // alived components, so we can extract our signal later on
    00442     set<string> bkgNames;
    00443     if ( !isGaudiSvc ) {
    00444       for ( Member_Iterator it = factories.FunctionMember_Begin();
    00445             it != factories.FunctionMember_End(); ++it ) {
    00446         string ident = it->Properties().PropertyAsString("name");
    00447         if ( PluginService::Debug() > 0 ) {
    00448           cout << "::: " << ident << endl;
    00449         }
    00450         bkgNames.insert( ident );
    00451       }
    00452     }
    00453     const set<string>::const_iterator bkgNamesEnd = bkgNames.end();
    00454
    00455     //--- Load component library ----------------------------------------------
    00456     System::ImageHandle handle;
    00457     unsigned long err = System::loadDynamicLib( *iLib, &handle );
    00458     if ( err != 1 ) {
    00459       cout << "ERROR: " << System::getLastErrorString() << endl;
    00460       allGood = false;
    00461       continue;
    00462     }
    00463
    00464     for ( Member_Iterator it = factories.FunctionMember_Begin();
    00465           it != factories.FunctionMember_End();
    00466           ++it ) {
    00467       const string ident = it->Properties().PropertyAsString("name");
    00468       if ( bkgNames.find(ident) != bkgNamesEnd ) {
    00469         if ( PluginService::Debug() > 0 ) {
    00470           cout << "\t==> skipping [" << ident << "]..." << endl;
    00471         }
    00472         continue;
    00473       }
    00474
    00475       // Atlas contributed code (patch #1247)
    00476       // Skip the generation of configurables if the component does not come
    00477       // from the same library we are processing (i.e. we found a symbol that
    00478       // is coming from a library loaded by the linker).
    00479       // Windows implementation is empty.
    00480       if ( !DsoUtils::inDso( *it, DsoUtils::libNativeName(*iLib) ) ) {
    00481         cout << "WARNING: library [" << *iLib << "] requested factory "
    00482         << "from another library ["
    00483         << DsoUtils::dsoName(*it) << "]"
    00484         << " ==> [" << ident << "] !!"
    00485         << endl;
    00486         continue;
    00487       }
    00488
    00489       const string rtype = it->TypeOf().ReturnType().Name();
    00490       string type;
    00491       bool known = true;
    00492       if      ( ident == "ApplicationMgr" ) type = "ApplicationMgr";
    00493       else if ( rtype == "IInterface*" )    type = "IInterface";
    00494       else if ( rtype == "IAlgorithm*" )    type = "Algorithm";
    00495       else if ( rtype == "IService*" )      type = "Service";
    00496       else if ( rtype == "IAlgTool*" )      type = "AlgTool";
    00497       else if ( rtype == "IAuditor*" )      type = "Auditor";
    00498       else if ( rtype == "IConverter*" )    type = "Converter";
    00499       else if ( rtype == "DataObject*" )    type = "DataObject";
    00500       else                                  type = "Unknown", known = false;
    00501       string name = ident;
    00502       // handle possible problems with templated components
    00503       boost::trim(name);
    00504
    00505       cout << " - component: " << name << endl;
    00506
    00507       if ( type == "IInterface" ) {
    00510         continue;
    00511       }
    00512
    00513       if ( type == "Converter" || type == "DataObject" ) {
    00515         continue;
    00516       }
    00517
    00518       //if ( type == "ApplicationMgr" ) {
    00521       //}
    00522
    00523       if ( !known ) {
    00524         cout << "WARNING: Unknown (return) type [" << rtype << "] !!\n"
    00525              << "WARNING: component [" << ident << "] is skipped !"
    00526              << endl;
    00527         allGood = false;
    00528         continue;
    00529       }
    00530
    00531       string cname = "DefaultName";
    00532       Object dummy;
    00533       vector<void*>  args;
    00534       args.reserve( 3 );
    00535       if ( type == "AlgTool" ) {
    00536         args.resize( 3 );
    00537         args[0] = &cname;
    00538         args[1] = &type;
    00539         args[2] = dummySvc;
    00540       }
    00541       else {
    00542         args.resize( 2 );
    00543         args[0] = &cname;
    00544         args[1] = svcLoc;
    00545       }
    00546       IProperty* prop = 0;
    00547       try {
    00548         if ( type == "Algorithm" ) {
    00549           IAlgorithm* obj = static_cast<IAlgorithm*>(it->Invoke(dummy,args).Address());
    00550           prop = dynamic_cast<IProperty*>(obj);
    00551         }
    00552         else if ( type == "Service") {
    00553           IService* obj = static_cast<IService*>(it->Invoke(dummy,args).Address());
    00554           prop = dynamic_cast<IProperty*>(obj);
    00555         }
    00556         else if ( type == "AlgTool") {
    00557           IAlgTool* obj = static_cast<IAlgTool*>(it->Invoke(dummy,args).Address());
    00558           prop = dynamic_cast<IProperty*>(obj);
    00559         }
    00560         else if ( type == "Auditor") {
    00561           IAuditor* obj = static_cast<IAuditor*>(it->Invoke(dummy,args).Address());
    00562           prop = dynamic_cast<IProperty*>(obj);
    00563         }
    00564         else if ( type == "ApplicationMgr") {
    00565           //svcLoc->queryInterface(IProperty::interfaceID(), pp_cast<void>(&prop));
    00566           svcLoc->queryInterface(IProperty::interfaceID(), (void**)(&prop));
    00567         }
    00568         else {
    00569           IInterface* obj = static_cast<IInterface*>(it->Invoke(dummy,args).Address());
    00570           prop = dynamic_cast<IProperty*>(obj);
    00571         }
    00572       }
    00573       catch ( exception& e ) {
    00574         cout << "ERROR: Error instantiating " << name
    00575              << " from " << *iLib << endl;
    00576         cout << "ERROR: Got exception: " << e.what() << endl;
    00577         allGood = false;
    00578         continue;
    00579       }
    00580       catch ( ... ) {
    00581         cout << "ERROR: Error instantiating " << name
    00582              << " from " << *iLib << endl;
    00583         allGood = false;
    00584         continue;
    00585       }
    00586       if( prop ) {
    00587         genComponent( *iLib, name, type, prop->getProperties() );
    00588         prop->release();
    00589       } else {
    00590         cout << "ERROR: could not cast IInterface* object to an IProperty* !\n"
    00591              << "ERROR: return type from PluginSvc is [" << rtype << "]...\n"
    00592              << "ERROR: NO Configurable will be generated for ["
    00593              << name << "] !"
    00594              << endl;
    00595         allGood = false;
    00596       }
    00597     } //> end loop over factories
    00598
    00602     const std::string pyName = ( fs::path(m_outputDirName) /
    00603                   fs::path(*iLib+"Conf.py") ).string();
    00604     const std::string dbName = ( fs::path(m_outputDirName) /
    00605                   fs::path(*iLib+"_confDb.py") ).string();
    00606
    00607     std::fstream py( pyName.c_str(),
    00608               std::ios_base::out|std::ios_base::trunc );
    00609     std::fstream db( dbName.c_str(),
    00610               std::ios_base::out|std::ios_base::trunc );
    00611
    00612     genHeader ( py, db );
    00613     genBody   ( py, db );
    00614     genTrailer( py, db );
    00615
    00616   } //> end loop over libraries
    00617
    00618   dummySvc->release();
    00619   dummySvc = 0;
    00620
    00621   return allGood ? EXIT_SUCCESS : EXIT_FAILURE;
    00622 }

void configGenerator::setConfigurableModule | ( | const std::string & | moduleName | ) | `[inline]`

customize the Module name where configurable base classes are defined

Definition at line 117 of file genconf.cpp.

References m_configurable, and System::moduleName().

    00118   {
    00119     m_configurable[ "Module" ] = moduleName;
    00120   }

void configGenerator::setConfigurableDefaultName | ( | const std::string & | defaultName | ) | `[inline]`

customize the default name for configurable instances

Definition at line 123 of file genconf.cpp.

References m_configurable.

    00124   {
    00125     m_configurable[ "DefaultName" ] = defaultName;
    00126   }

void configGenerator::setConfigurableAlgorithm | ( | const std::string & | cfgAlgorithm | ) | `[inline]`

customize the configurable base class for Algorithm component

Definition at line 129 of file genconf.cpp.

References m_configurable.

    00130   {
    00131     m_configurable[ "Algorithm" ] = cfgAlgorithm;
    00132   }

void configGenerator::setConfigurableAlgTool | ( | const std::string & | cfgAlgTool | ) | `[inline]`

customize the configurable base class for AlgTool component

Definition at line 135 of file genconf.cpp.

References m_configurable.

    00136   {
    00137     m_configurable[ "AlgTool" ] = cfgAlgTool;
    00138   }

void configGenerator::setConfigurableAuditor | ( | const std::string & | cfgAuditor | ) | `[inline]`

customize the configurable base class for AlgTool component

Definition at line 141 of file genconf.cpp.

References m_configurable.

    00142   {
    00143     m_configurable[ "Auditor" ] = cfgAuditor;
    00144   }

void configGenerator::setConfigurableService | ( | const std::string & | cfgService | ) | `[inline]`

customize the configurable base class for Service component

Definition at line 147 of file genconf.cpp.

References m_configurable.

    00148   {
    00149     m_configurable[ "Service" ] = cfgService;
    00150     m_configurable[ "ApplicationMgr" ] = cfgService;
    00151   }

void configGenerator::genComponent | ( | const std::string & | libName,
|  | const std::string & | componentName,
|  | const std::string & | componentType,
|  | const vector< Property * > & | properties |
| ) |  |  | `[private]`

Definition at line 714 of file genconf.cpp.

References std::vector< _Tp, _Alloc >::begin(), std::vector< _Tp, _Alloc >::end(), flush(), m_configurable, m_dbBuf, m_outputDirName, m_pkgName, m_pyBuf, Gaudi::Utils::Histos::path(), py_tab, pythonizeName(), pythonizeValue(), and std::setw().

Referenced by genConfig().

    00719 {
    00720   string cname = componentName;
    00721   pythonizeName(cname);
    00722
    00723   typedef GaudiUtils::HashMap<std::string, std::string> PropertyDoc_t;
    00724   PropertyDoc_t propDoc;
    00725
    00726   m_pyBuf << "\n";
    00727   m_pyBuf << "class " << cname
    00728           << "( " << m_configurable[componentType] << " ) :"
    00729           << "\n";
    00730   m_pyBuf << "  __slots__ = { \n";
    00731   for ( vector<Property*>::const_iterator it = properties.begin() ;
    00732         it != properties.end(); ++it ) {
    00733     const string pname  = (*it)->name();
    00734     string pvalue, ptype;
    00735     pythonizeValue( (*it), pvalue, ptype );
    00736     m_pyBuf << "    '" << pname << "' : " << pvalue <<", # " << ptype << "\n";
    00737
    00738     if ( (*it)->documentation() != "none" ) {
    00739       propDoc[pname] = (*it)->documentation();
    00740     }
    00741
    00742   }
    00743   m_pyBuf << "  }\n";
    00744   m_pyBuf << "  _propertyDocDct = { \n";
    00745   for ( PropertyDoc_t::const_iterator iProp = propDoc.begin();
    00746         iProp != propDoc.end();
    00747         ++iProp ) {
    00748     m_pyBuf << std::setw(5)
    00749             << "'"       << iProp->first  << "' : "
    00750             << "\"\"\" "  << iProp->second << " \"\"\",\n";
    00751   }
    00752   m_pyBuf << "  }\n";
    00753
    00754   m_pyBuf
    00755     << "  def __init__(self, name = " << m_configurable["DefaultName"]
    00756                                       << ", **kwargs):\n"
    00757     << "      super(" << cname << ", self).__init__(name)\n"
    00758     << "      for n,v in kwargs.items():\n"
    00759     << "         setattr(self, n, v)\n"
    00760     << "  def getDlls( self ):\n"
    00761     << "      return '" << libName << "'\n"
    00762     << "  def getType( self ):\n"
    00763     << "      return '" << componentName  << "'\n"
    00764     << "  pass # class " << cname << "\n"
    00765     << flush;
    00766
    00767   // name of the auto-generated module
    00768   const string pyName = ( fs::path(m_outputDirName) /
    00769                           fs::path(libName+"Conf.py") ).string();
    00770   const string modName = fs::basename( fs::path( pyName ).leaf() );
    00771
    00772   // now the db part
    00773   m_dbBuf
    00774     << py_tab << "cfgDb.add( configurable = '" << cname << "',\n"
    00775     << py_tab << "           package = '" << m_pkgName << "',\n"
    00776     << py_tab << "           module  = '" << m_pkgName << "." << modName << "',\n"
    00777     << py_tab << "           lib     = '" << libName << "' )\n"
    00778     << flush;
    00779
    00780 }

void configGenerator::genImport | ( | std::ostream & | s,
|  | const boost::format & | frmt,
|  | std::string | indent |
| ) |  |  | `[private]`

Definition at line 624 of file genconf.cpp.

References flush(), format(), m_configurable, std::basic_string< _CharT, _Traits, _Alloc >::npos, py_tab, and Gaudi::Units::s.

Referenced by genHeader().

    00626                                                        {
    00627
    00628   std::string::size_type pos = 0, nxtpos = 0;
    00629   std::string mod;
    00630
    00631   while ( std::string::npos != pos ){
    00632     // find end of module name
    00633     nxtpos = m_configurable["Module"].find_first_of(',',pos);
    00634
    00635     // Prepare import string
    00636     mod = m_configurable["Module"].substr(pos,nxtpos-pos);
    00637     std::ostringstream import;
    00638     import << boost::format(frmt) % mod;
    00639
    00640     // append a normal import or a try/excpet enclosed one depending
    00641     // on availability of a fall-back bodule (next in the list)
    00642     if ( std::string::npos == nxtpos ) {
    00643       // last possible module
    00644       s << indent << import.str() << "\n" << flush;
    00645       pos = std::string::npos;
    00646     } else {
    00647       // we have a fallback for this
    00648       s << indent << "try:\n"
    00649         << indent << py_tab << import.str() << "\n"
    00650         << indent << "except ImportError:\n"
    00651         << flush;
    00652       pos = nxtpos+1;
    00653     }
    00654     // increase indentation level for next iteration
    00655     indent += py_tab;
    00656   }
    00657 }

void configGenerator::genHeader | ( | std::ostream & | pyOut,
|  | std::ostream & | dbOut |
| ) |  |  | `[private]`

Definition at line 660 of file genconf.cpp.

References flush(), format(), genImport(), m_importGaudiHandles, and py_tab.

Referenced by genConfig().

    00663 {
    00664   // python file part
    00665   time_t rawtime;
    00666   time( &rawtime );
    00667   py << "#" << ctime(&rawtime) //<< "\n"
    00668      << "\"\"\"Automatically generated. DO NOT EDIT please\"\"\"\n";
    00669   if ( m_importGaudiHandles ) {
    00670     py << "from GaudiKernel.GaudiHandles import *\n";
    00671   }
    00672
    00673   genImport(py,boost::format("from %1%.Configurable import *"));
    00674
    00675   // db file part
    00676   db << "##  -*- python -*-  \n"
    00677      << "# db file automatically generated by genconf on: "
    00678      << ctime(&rawtime); // << "\n";
    00679   db << "## insulates outside world against anything bad that could happen\n"
    00680      << "## also prevents global scope pollution\n"
    00681      << "def _fillCfgDb():\n";
    00682   genImport(db,boost::format("from %1%.ConfigurableDb import CfgDb"),py_tab);
    00683
    00684   db << "\n"
    00685      << py_tab << "# get a handle on the repository of Configurables\n"
    00686      << py_tab << "cfgDb = CfgDb()\n"
    00687      << "\n"
    00688      << py_tab << "# populate the repository with informations on Configurables \n"
    00689      << "\n"
    00690      << flush;
    00691 }

void configGenerator::genBody | ( | std::ostream & | pyOut,
|  | std::ostream & | dbOut |
| ) |  |  | `[inline, private]`

Definition at line 160 of file genconf.cpp.

References flush(), m_dbBuf, m_pyBuf, and std::basic_stringstream< _CharT, _Traits, _Alloc >::str().

Referenced by genConfig().

    00161                                     {
    00162     pyOut << m_pyBuf.str() << flush;
    00163     dbOut << m_dbBuf.str() << flush;
    00164   }

void configGenerator::genTrailer | ( | std::ostream & | pyOut,
|  | std::ostream & | dbOut |
| ) |  |  | `[private]`

Definition at line 693 of file genconf.cpp.

References std::flush(), m_pkgName, and py_tab.

Referenced by genConfig().

    00696 {
    00697   // db file part
    00698   db << py_tab << "return #_fillCfgDb\n"
    00699      << "# fill cfgDb at module import...\n"
    00700      << "try:\n"
    00701      << py_tab << "_fillCfgDb()\n"
    00702      << py_tab << "#house cleaning...\n"
    00703      << py_tab << "del _fillCfgDb\n"
    00704      << "except Exception,err:\n"
    00705      << py_tab << "print \"Py:ConfigurableDb   ERROR Problem with [%s] content!"
    00706                << "\" % __name__\n"
    00707      << py_tab << "print \"Py:ConfigurableDb   ERROR\",err\n"
    00708      << py_tab << "print \"Py:ConfigurableDb   ERROR   ==> culprit is package ["
    00709                << m_pkgName << "] !\"\n"
    00710      << std::flush;
    00711 }

void configGenerator::pythonizeValue | ( | const Property * | prop,
|  | string & | pvalue,
|  | string & | ptype |
| ) |  |  | `[private]`

handle the "marshalling" of Properties

Definition at line 793 of file genconf.cpp.

References std::cout, std::endl(), m_importGaudiHandles, Property::name(), std::basic_string< _CharT, _Traits, _Alloc >::npos, GaudiHandleArrayBase::pythonRepr(), GaudiHandleBase::pythonRepr(), Property::toString(), Property::type_info(), GaudiHandleArrayProperty::value(), and GaudiHandleProperty::value().

Referenced by genComponent().

    00796 {
    00797   const std::string cvalue = p->toString();
    00798   const type_info& ti = *p->type_info();
    00799   if ( ti == typeid(bool) ) {
    00800     pvalue = ( cvalue == "0" || cvalue == "False" || cvalue == "false" )
    00801            ? "False"
    00802            : "True";
    00803     ptype  = "bool";
    00804   }
    00805   else if ( ti == typeid(char)  || ti == typeid(signed char)
    00806             || ti == typeid(unsigned char)  ||
    00807             ti == typeid(short) || ti == typeid(unsigned short) ||
    00808             ti == typeid(int)   || ti == typeid(unsigned int)   ||
    00809             ti == typeid(long)  || ti == typeid(unsigned long) ) {
    00810     pvalue = cvalue;
    00811     ptype  = "int";
    00812   }
    00813   else if ( ti == typeid(long long) || ti == typeid(unsigned long long) ) {
    00814     pvalue = cvalue + "L";
    00815     ptype  = "long";
    00816   }
    00817   else if ( ti == typeid(float) || ti == typeid(double) ) {
    00818     // forces python to handle this as a float: put a dot in there...
    00819     pvalue = boost::to_lower_copy(cvalue);
    00820     if ( pvalue == "nan" ) {
    00821       pvalue = "float('nan')";
    00822       std::cout << "WARNING: default value for ["
    00823                 << p->name() << "] is NaN !!"
    00824                 << std::endl;
    00825     } else if ( std::string::npos == pvalue.find(".") &&
    00826                 std::string::npos == pvalue.find("e")  ) {
    00827       pvalue = cvalue + ".0";
    00828     }
    00829     ptype  = "float";
    00830   }
    00831   else if ( ti == typeid(string) ) {
    00832
    00833     pvalue = "'"+cvalue+"'";
    00834     ptype  = "str";
    00835   }
    00836   else if ( ti == typeid(GaudiHandleBase) ) {
    00837     m_importGaudiHandles = true;
    00838     const GaudiHandleProperty& hdl
    00839       = dynamic_cast<const GaudiHandleProperty&>(*p);
    00840     const GaudiHandleBase&     base = hdl.value();
    00841
    00842     pvalue = base.pythonRepr();
    00843     ptype  = "GaudiHandle";
    00844   }
    00845   else if ( ti == typeid(GaudiHandleArrayBase) ) {
    00846     m_importGaudiHandles = true;
    00847     const GaudiHandleArrayProperty& hdl
    00848       = dynamic_cast<const GaudiHandleArrayProperty&>(*p);
    00849     const GaudiHandleArrayBase&     base = hdl.value();
    00850
    00851     pvalue = base.pythonRepr();
    00852     ptype  = "GaudiHandleArray";
    00853   }
    00854   else {
    00855     pvalue = cvalue;
    00856     ptype  = "list";
    00857   }
    00858 }

void configGenerator::pythonizeName | ( | string & | name | ) | `[private]`

Translates a valid C++ typename into a valid python one.

Definition at line 782 of file genconf.cpp.

Referenced by genComponent().

    00784 {
    00785   static string  in("<>&*,: ().");
    00786   static string out("__rp__s___");
    00787   for ( string::iterator i = name.begin(); i != name.end(); ++i ) {
    00788     if ( in.find(*i) != string::npos ) *i = out[in.find(*i)];
    00789   }
    00790 }

## Member Data Documentation

string configGenerator::m_pkgName`[private]`

name of the package we are processing

Definition at line 73 of file genconf.cpp.

Referenced by genComponent(), and genTrailer().

string configGenerator::m_outputDirName`[private]`

absolute path to the directory where genconf will store auto-generated files (Configurables and ConfigurableDb)

Definition at line 77 of file genconf.cpp.

Referenced by genComponent(), and genConfig().

stringstream configGenerator::m_pyBuf`[private]`

buffer of auto-generated configurables

Definition at line 80 of file genconf.cpp.

Referenced by genBody(), genComponent(), and genConfig().

bool configGenerator::m_importGaudiHandles`[private]`

switch to decide if the generated configurables need to import GaudiHandles (ie: if one of the components has a XyzHandle<T>)

Definition at line 84 of file genconf.cpp.

Referenced by genConfig(), genHeader(), and pythonizeValue().

stringstream configGenerator::m_dbBuf`[private]`

buffer of generated configurables informations for the "Db" file The "Db" file is holding informations about the generated configurables This file is later one used by the PropertyProxy.py to locate Configurables and know their default values, host module,.

..

Definition at line 90 of file genconf.cpp.

Referenced by genBody(), genComponent(), and genConfig().

GaudiUtils::HashMap<std::string, std::string> configGenerator::m_configurable`[private]`

Configurable customization.

Contains customization for:

- Name of the module where configurable base classes are defined
- Name of the configurable base class for the Algorithm component
- Name of the configurable base class for the AlgTool component
- Name of the configurable base class for the Service component

Definition at line 97 of file genconf.cpp.

Referenced by genComponent(), genImport(), setConfigurableAlgorithm(), setConfigurableAlgTool(), setConfigurableAuditor(), setConfigurableDefaultName(), setConfigurableModule(), and setConfigurableService().

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/src/Util/genconf.cpp