| The Gaudi Framework v28r2p1 (f1a77ff4)

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Member Functions | Private Attributes | List of all members
configGenerator Class Reference
Collaboration diagram for configGenerator:
[legend]

## Public Member Functions
| configGenerator (const string &pkgName, const string &outputDirName)
int | genConfig (const Strings_t &modules, const string &userModule)
| main entry point of this class: More...
void | setConfigurableModule (const std::string &moduleName)
| customize the Module name where configurable base classes are defined More...
void | setConfigurableDefaultName (const std::string &defaultName)
| customize the default name for configurable instances More...
void | setConfigurableAlgorithm (const std::string &cfgAlgorithm)
| customize the configurable base class for Algorithm component More...
void | setConfigurableAlgTool (const std::string &cfgAlgTool)
| customize the configurable base class for AlgTool component More...
void | setConfigurableAuditor (const std::string &cfgAuditor)
| customize the configurable base class for AlgTool component More...
void | setConfigurableService (const std::string &cfgService)
| customize the configurable base class for Service component More...

## Private Member Functions
int | genComponent (const std::string &libName, const std::string &componentName, const std::string &componentType, const vector< PropertyBase * > &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 PropertyBase *prop, string &pvalue, string &ptype)
| handle the "marshalling" of Properties More...
void | pythonizeName (string &name)
| Translates a valid C++ typename into a valid python one. More...

## Private Attributes
string | m_pkgName
| name of the package we are processing More...
string | m_outputDirName
| absolute path to the directory where genconf will store auto-generated files (Configurables and ConfigurableDb) More...
stringstream | m_pyBuf
| buffer of auto-generated configurables More...
bool | m_importGaudiHandles
| switch to decide if the generated configurables need to import GaudiHandles (ie: if one of the components has a XyzHandle<T>) More...
bool | m_importDataObjectHandles
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,... More...
GaudiUtils::HashMap< std::string, std::string > | m_configurable
| Configurable customization. More...

## Detailed Description

Definition at line 106 of file genconf.cpp.

## Constructor & Destructor Documentation

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

Definition at line 138 of file genconf.cpp.

139 : m_pkgName( pkgName )
140 , m_outputDirName( outputDirName )
141 , m_pyBuf()
142 , m_importGaudiHandles( false )
143 , m_importDataObjectHandles( false )
144 , m_dbBuf()
145 , m_configurable()
146 {
147 }
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:135
configGenerator::m_pyBuf
stringstream m_pyBuf
buffer of auto-generated configurables
Definition: genconf.cpp:116
configGenerator::m_importDataObjectHandles
bool m_importDataObjectHandles
Definition: genconf.cpp:122
configGenerator::m_dbBuf
stringstream m_dbBuf
buffer of generated configurables informations for the "Db" file The "Db" file is holding information...
Definition: genconf.cpp:128
configGenerator::m_outputDirName
string m_outputDirName
absolute path to the directory where genconf will store auto-generated files (Configurables and Confi...
Definition: genconf.cpp:113
configGenerator::m_importGaudiHandles
bool m_importGaudiHandles
switch to decide if the generated configurables need to import GaudiHandles (ie: if one of the compon...
Definition: genconf.cpp:120
configGenerator::m_pkgName
string m_pkgName
name of the package we are processing
Definition: genconf.cpp:109

## Member Function Documentation

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

Definition at line 182 of file genconf.cpp.

183 {
184 pyOut << m_pyBuf.str() << flush;
185 dbOut << m_dbBuf.str() << flush;
186 }
configGenerator::m_pyBuf
stringstream m_pyBuf
buffer of auto-generated configurables
Definition: genconf.cpp:116
std::stringstream::str
T str(T...args)
configGenerator::m_dbBuf
stringstream m_dbBuf
buffer of generated configurables informations for the "Db" file The "Db" file is holding information...
Definition: genconf.cpp:128
std::flush
T flush(T...args)

int configGenerator::genComponent | ( | const std::string & | libName,
|  | const std::string & | componentName,
|  | const std::string & | componentType,
|  | const vector< PropertyBase * > & | properties
| ) |  |
| private

Definition at line 654 of file genconf.cpp.

657 {
658 string cname = componentName;
659 pythonizeName( cname );
660
661 typedef GaudiUtils::HashMap<std::string, std::string> PropertyDoc_t;
662 PropertyDoc_t propDoc;
663
664 m_pyBuf << "\n";
665 m_pyBuf << "class " << cname << "( " << m_configurable[componentType] << " ) :"
666 << "\n";
667 m_pyBuf << " __slots__ = { \n";
668 for ( vector<PropertyBase*>::const_iterator it = properties.begin(); it != properties.end(); ++it ) {
669
670 const string pname = ( *it )->name();
671 // Validate property name (it must be a valid Python identifier)
672 if ( !boost::regex_match( pname, pythonIdentifier ) ) {
673 std::cout << "ERROR: invalid property name \"" << pname << "\" in component " << cname
674 << " (invalid Python identifier)" << std::endl;
675 // try to make the buffer at least more or less valid python code.
676 m_pyBuf << " #ERROR-invalid identifier '" << pname << "'\n"
677 << " }\n";
678 return 1;
679 }
680
681 string pvalue, ptype;
682 pythonizeValue( ( *it ), pvalue, ptype );
683 m_pyBuf << " '" << pname << "' : " << pvalue << ", # " << ptype << "\n";
684
685 if ( ( *it )->documentation() != "none" ) {
686 propDoc[pname] = ( *it )->documentation();
687 }
688 }
689 m_pyBuf << " }\n";
690 m_pyBuf << " _propertyDocDct = { \n";
691 for ( PropertyDoc_t::const_iterator iProp = propDoc.begin(); iProp != propDoc.end(); ++iProp ) {
692 m_pyBuf << std::setw( 5 ) << "'" << iProp->first << "' : "
693 << "\"\"\" " << iProp->second << " \"\"\",\n";
694 }
695 m_pyBuf << " }\n";
696
697 m_pyBuf << " def __init__(self, name = " << m_configurable["DefaultName"] << ", **kwargs):\n"
698 << " super(" << cname << ", self).__init__(name)\n"
699 << " for n,v in kwargs.items():\n"
700 << " setattr(self, n, v)\n"
701 << " def getDlls( self ):\n"
702 << " return '" << libName << "'\n"
703 << " def getType( self ):\n"
704 << " return '" << componentName << "'\n"
705 << " pass # class " << cname << "\n"
706 << flush;
707
708 // name of the auto-generated module
709 const string pyName = ( fs::path( m_outputDirName ) / fs::path( libName + "Conf.py" ) ).string();
710 const string modName = fs::basename( fs::path( pyName ).leaf() );
711
712 // now the db part
713 m_dbBuf << m_pkgName << "." << modName << " " << libName << " " << cname << "\n" << flush;
714
715 return 0;
716 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:772
configGenerator::pythonizeName
void pythonizeName(string &name)
Translates a valid C++ typename into a valid python one.
Definition: genconf.cpp:718
std::endl
T endl(T...args)
std::vector::end
T end(T...args)
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:135
configGenerator::m_pyBuf
stringstream m_pyBuf
buffer of auto-generated configurables
Definition: genconf.cpp:116
std::setw
T setw(T...args)
configGenerator::m_dbBuf
stringstream m_dbBuf
buffer of generated configurables informations for the "Db" file The "Db" file is holding information...
Definition: genconf.cpp:128
compareOutputFiles.pname
pname
Definition: compareOutputFiles.py:392
std::flush
T flush(T...args)
configGenerator::m_outputDirName
string m_outputDirName
absolute path to the directory where genconf will store auto-generated files (Configurables and Confi...
Definition: genconf.cpp:113
std::vector
STL class.
configGenerator::pythonizeValue
void pythonizeValue(const PropertyBase *prop, string &pvalue, string &ptype)
handle the "marshalling" of Properties
Definition: genconf.cpp:730
std::vector::begin
T begin(T...args)
GaudiUtils::HashMap< std::string, std::string >
configGenerator::m_pkgName
string m_pkgName
name of the package we are processing
Definition: genconf.cpp:109
std::cout
svn_tag_release.basename
def basename(url)
Definition: svn_tag_release.py:21

int configGenerator::genConfig | ( | const Strings_t & | modules,
|  | const string & | userModule
| ) |  |

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...

write-out files for this library

Definition at line 408 of file genconf.cpp.

410 {
411 //--- Disable checking StatusCode -------------------------------------------
412 StatusCode::disableChecking();
413
414 const Strings_t::const_iterator endLib = libs.end();
415
416 const std::string gaudiSvc = "GaudiCoreSvc";
417 const bool isGaudiSvc = ( std::find( libs.begin(), endLib, gaudiSvc ) != endLib );
418
419 //--- Instantiate ApplicationMgr --------------------------------------------
420 if ( !isGaudiSvc && createAppMgr() ) {
421 cout << "ERROR: ApplicationMgr can not be created. Check environment" << endl;
422 return EXIT_FAILURE;
423 }
424
425 //--- Iterate over component factories --------------------------------------
426 using Gaudi::PluginService::Details::Registry;
427 Registry& registry = Registry::instance();
428
429 std::set<std::string> bkgNames = registry.loadedFactories();
430
431 ISvcLocator* svcLoc = Gaudi::svcLocator();
432 IInterface* dummySvc = new Service( "DummySvc", svcLoc );
433 dummySvc->addRef();
434
435 bool allGood = true;
436
437 // iterate over all the requested libraries
438 for ( Strings_t::const_iterator iLib = libs.begin(); iLib != endLib; ++iLib ) {
439
440 LOG_INFO << ":::: processing library: " << *iLib << "...";
441
442 // reset state
443 m_importGaudiHandles = false;
444 m_importDataObjectHandles = false;
445 m_pyBuf.str( "" );
446 m_dbBuf.str( "" );
447
448 //--- Load component library ----------------------------------------------
449 System::ImageHandle handle;
450 unsigned long err = System::loadDynamicLib( *iLib, &handle );
451 if ( err != 1 ) {
452 LOG_ERROR << System::getLastErrorString();
453 allGood = false;
454 continue;
455 }
456
457 std::set<std::string> factories = registry.loadedFactories();
458
459 for ( std::set<std::string>::iterator it = factories.begin(); it != factories.end(); ++it ) {
460 const string ident = *it;
461 if ( bkgNames.find( ident ) != bkgNames.end() ) {
462 if ( Gaudi::PluginService::Details::logger().level() <= 1 ) {
463 LOG_INFO << "\t==> skipping [" << ident << "]...";
464 }
465 continue;
466 }
467
468 const Registry::FactoryInfo info = registry.getInfo( *it );
469 const string rtype = info.rtype;
470
471 // do not generate configurables for the Reflex-compatible aliases
472 if ( info.properties.find( "ReflexName" ) != info.properties.end() ) continue;
473
474 // Atlas contributed code (patch #1247)
475 // Skip the generation of configurables if the component does not come
476 // from the same library we are processing (i.e. we found a symbol that
477 // is coming from a library loaded by the linker).
478 if ( !DsoUtils::inDso( info.ptr, DsoUtils::libNativeName( *iLib ) ) ) {
479 LOG_WARNING << "library [" << *iLib << "] exposes factory [" << ident << "] which is declared in ["
480 << DsoUtils::dsoName( info.ptr ) << "] !!";
481 continue;
482 }
483
484 string type;
485 bool known = true;
486 if ( ident == "ApplicationMgr" )
487 type = "ApplicationMgr";
488 else if ( rtype == typeid( IInterface* ).name() )
489 type = "IInterface";
490 else if ( rtype == typeid( IAlgorithm* ).name() )
491 type = "Algorithm";
492 else if ( rtype == typeid( IService* ).name() )
493 type = "Service";
494 else if ( rtype == typeid( IAlgTool* ).name() )
495 type = "AlgTool";
496 else if ( rtype == typeid( IAuditor* ).name() )
497 type = "Auditor";
498 else if ( rtype == typeid( IConverter* ).name() )
499 type = "Converter";
500 else if ( rtype == typeid( DataObject* ).name() )
501 type = "DataObject";
502 else
503 type = "Unknown", known = false;
504 string name = ident;
505 // handle possible problems with templated components
506 boost::trim( name );
507
508 if ( type == "IInterface" ) {
511 continue;
512 }
513
514 if ( type == "Converter" || type == "DataObject" ) {
516 continue;
517 }
518
519 if ( !known ) {
520 LOG_WARNING << "Unknown (return) type [" << System::typeinfoName( rtype.c_str() ) << "] !!"
521 << " Component [" << ident << "] is skipped !";
522 continue;
523 }
524
525 LOG_INFO << " - component: " << info.className << " ("
526 << ( info.className != name ? ( name + ": " ) : std::string() ) << type << ")";
527
528 string cname = "DefaultName";
529 SmartIF<IProperty> prop;
530 try {
531 if ( type == "Algorithm" ) {
532 prop = SmartIF<IAlgorithm>( Algorithm::Factory::create( ident, cname, svcLoc ) );
533 } else if ( type == "Service" ) {
534 prop = SmartIF<IService>( Service::Factory::create( ident, cname, svcLoc ) );
535 } else if ( type == "AlgTool" ) {
536 prop = SmartIF<IAlgTool>( AlgTool::Factory::create( ident, cname, type, dummySvc ) );
537 // FIXME: AlgTool base class increase artificially by 1 the refcount.
538 prop->release();
539 } else if ( type == "Auditor" ) {
540 prop = SmartIF<IAuditor>( Auditor::Factory::create( ident, cname, svcLoc ) );
541 } else if ( type == "ApplicationMgr" ) {
542 prop = SmartIF<ISvcLocator>( svcLoc );
543 } else {
544 continue; // unknown
545 }
546 } catch ( exception& e ) {
547 LOG_ERROR << "Error instantiating " << name << " from " << *iLib;
548 LOG_ERROR << "Got exception: " << e.what();
549 allGood = false;
550 continue;
551 } catch ( ... ) {
552 LOG_ERROR << "Error instantiating " << name << " from " << *iLib;
553 allGood = false;
554 continue;
555 }
556 if ( prop ) {
557 if ( genComponent( *iLib, name, type, prop->getProperties() ) ) {
558 allGood = false;
559 }
560 prop.reset();
561 } else {
562 LOG_ERROR << "could not cast IInterface* object to an IProperty* !";
563 LOG_ERROR << "return type from PluginSvc is [" << rtype << "]...";
564 LOG_ERROR << "NO Configurable will be generated for [" << name << "] !";
565 allGood = false;
566 }
567 } //> end loop over factories
568
572 const std::string pyName = ( fs::path( m_outputDirName ) / fs::path( *iLib + "Conf.py" ) ).string();
573 const std::string dbName = ( fs::path( m_outputDirName ) / fs::path( *iLib + ".confdb" ) ).string();
574
575 std::fstream py( pyName, std::ios_base::out | std::ios_base::trunc );
576 std::fstream db( dbName, std::ios_base::out | std::ios_base::trunc );
577
578 genHeader( py, db );
579 if ( !userModule.empty() ) py << "from " << userModule << " import *" << endl;
580 genBody( py, db );
581 genTrailer( py, db );
582
583 } //> end loop over libraries
584
585 dummySvc->release();
586 dummySvc = 0;
587
588 return allGood ? EXIT_SUCCESS : EXIT_FAILURE;
589 }
SmartIF< IProperty >
std::string::empty
T empty(T...args)
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
IConverter
The data converters are responsible to translate data from one representation into another...
Definition: IConverter.h:57
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:772
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
Gaudi::PluginService::Details::Logger::level
Level level() const
Definition: PluginServiceDetails.h:213
LOG_ERROR
#define LOG_ERROR
Definition: genconf.cpp:83
std::endl
T endl(T...args)
std::set::end
T end(T...args)
System::ImageHandle
void * ImageHandle
Definition of an image handle.
Definition: ModuleInfo.h:30
configGenerator::m_pyBuf
stringstream m_pyBuf
buffer of auto-generated configurables
Definition: genconf.cpp:116
Gaudi::PluginService::Details::logger
GAUDIPS_API Logger & logger()
Return the current logger instance.
Definition: PluginService.cpp:344
configGenerator::genComponent
int genComponent(const std::string &libName, const std::string &componentName, const std::string &componentType, const vector< PropertyBase * > &properties)
Definition: genconf.cpp:654
std::string
STL class.
configGenerator::m_importDataObjectHandles
bool m_importDataObjectHandles
Definition: genconf.cpp:122
Gaudi::svcLocator
GAUDI_API ISvcLocator * svcLocator()
std::exception::what
T what(T...args)
LOG_INFO
#define LOG_INFO
Definition: genconf.cpp:85
IService
General service interface definition.
Definition: IService.h:18
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
gaudirun.type
type
Definition: gaudirun.py:125
std::fstream
STL class.
configGenerator::genHeader
void genHeader(std::ostream &pyOut, std::ostream &dbOut)
Definition: genconf.cpp:623
std::stringstream::str
T str(T...args)
GaudiPluginService.cpluginsvc.registry
def registry()
Definition: cpluginsvc.py:63
configGenerator::m_dbBuf
stringstream m_dbBuf
buffer of generated configurables informations for the "Db" file The "Db" file is holding information...
Definition: genconf.cpp:128
std::exception
STL class.
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:27
IProperty::getProperties
virtual const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const =0
Get list of properties.
std::find
T find(T...args)
std::set< std::string >
configGenerator::m_outputDirName
string m_outputDirName
absolute path to the directory where genconf will store auto-generated files (Configurables and Confi...
Definition: genconf.cpp:113
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
LOG_WARNING
#define LOG_WARNING
Definition: genconf.cpp:84
std::set::begin
T begin(T...args)
configGenerator::m_importGaudiHandles
bool m_importGaudiHandles
switch to decide if the generated configurables need to import GaudiHandles (ie: if one of the compon...
Definition: genconf.cpp:120
std::string::c_str
T c_str(T...args)
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
Gaudi::PluginService::Details::Registry
In-memory database of the loaded factories.
Definition: PluginServiceDetails.h:99
GaudiPluginService.cpluginsvc.factories
def factories()
Definition: cpluginsvc.py:72
IInterface::addRef
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
StatusCode::disableChecking
static GAUDI_API void disableChecking()
Definition: StatusCode.cpp:23
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
configGenerator::genTrailer
void genTrailer(std::ostream &pyOut, std::ostream &dbOut)
Definition: genconf.cpp:646
System::getLastErrorString
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
Definition: System.cpp:256
Service
Base class for all services.
Definition: Service.h:36
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
createAppMgr
int createAppMgr()
Definition: genconf.cpp:791
IAuditor
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:18
std::cout
DsoUtils::libNativeName
std::string libNativeName(const std::string &libName)
Definition: DsoUtils.h:18
configGenerator::genBody
void genBody(std::ostream &pyOut, std::ostream &dbOut)
Definition: genconf.cpp:182
System::loadDynamicLib
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.
Definition: System.cpp:126

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

Definition at line 623 of file genconf.cpp.

625 {
626 // python file part
627 std::string now = Gaudi::Time::current().format( true );
628 py << "#" << now //<< "\n"
629 << "\"\"\"Automatically generated. DO NOT EDIT please\"\"\"\n";
630 if ( m_importGaudiHandles ) {
631 py << "from GaudiKernel.GaudiHandles import *\n";
632 }
633
634 if ( m_importDataObjectHandles ) {
635 py << "from GaudiKernel.DataObjectHandleBase import *\n";
636 }
637
638 genImport( py, boost::format( "from %1%.Configurable import *" ) );
639
640 // db file part
641 db << "## -*- ascii -*- \n"
642 << "# db file automatically generated by genconf on: " << now << "\n"
643 << flush;
644 }
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
Gaudi::Time::current
static Time current(void)
Returns the current time.
Definition: Time.cpp:113
std::string
STL class.
configGenerator::m_importDataObjectHandles
bool m_importDataObjectHandles
Definition: genconf.cpp:122
std::flush
T flush(T...args)
configGenerator::genImport
void genImport(std::ostream &s, const boost::format &frmt, std::string indent)
Definition: genconf.cpp:591
configGenerator::m_importGaudiHandles
bool m_importGaudiHandles
switch to decide if the generated configurables need to import GaudiHandles (ie: if one of the compon...
Definition: genconf.cpp:120
Gaudi::Time::format
std::string format(bool local, std::string spec="%c") const
Format the time using strftime.
Definition: Time.cpp:279

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

Definition at line 591 of file genconf.cpp.

592 {
593
594 std::string::size_type pos = 0, nxtpos = 0;
595 std::string mod;
596
597 while ( std::string::npos != pos ) {
598 // find end of module name
599 nxtpos = m_configurable["Module"].find_first_of( ',', pos );
600
601 // Prepare import string
602 mod = m_configurable["Module"].substr( pos, nxtpos - pos );
603 std::ostringstream import;
604 import << boost::format( frmt ) % mod;
605
606 // append a normal import or a try/except enclosed one depending
607 // on availability of a fall-back module (next in the list)
608 if ( std::string::npos == nxtpos ) {
609 // last possible module
610 s << indent << import.str() << "\n" << flush;
611 pos = std::string::npos;
612 } else {
613 // we have a fallback for this
614 s << indent << "try:\n" << indent << py_tab << import.str() << "\n" << indent << "except ImportError:\n" << flush;
615 pos = nxtpos + 1;
616 }
617 // increase indentation level for next iteration
618 indent += py_tab;
619 }
620 }
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
Gaudi.CommonGaudiConfigurables.mod
mod
Definition: CommonGaudiConfigurables.py:22
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:135
std::string
STL class.
std::ostringstream
STL class.
std::flush
T flush(T...args)

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

Definition at line 646 of file genconf.cpp.

648 {
649 // db file part
650 db << "## " << m_pkgName << "\n" << std::flush;
651 }
std::flush
T flush(T...args)
configGenerator::m_pkgName
string m_pkgName
name of the package we are processing
Definition: genconf.cpp:109

void configGenerator::pythonizeName | ( | string & | name | ) |
| private

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

Definition at line 718 of file genconf.cpp.

720 {
721 static string in( "<>&*,: ()." );
722 static string out( "__rp__s___" );
723 boost::algorithm::replace_all( name, ", ", "," );
724 for ( string::iterator i = name.begin(); i != name.end(); ++i ) {
725 if ( in.find( *i ) != string::npos ) *i = out[in.find( *i )];
726 }
727 }
std::string::end
T end(T...args)
std::string::begin
T begin(T...args)

void configGenerator::pythonizeValue | ( | const PropertyBase * | prop,
|  | string & | pvalue,
|  | string & | ptype
| ) |  |
| private

handle the "marshalling" of Properties

Definition at line 730 of file genconf.cpp.

732 {
733 const std::string cvalue = p->toString();
734 const type_info& ti = *p->type_info();
735 if ( ti == typeid( bool ) ) {
736 pvalue = ( cvalue == "0" || cvalue == "False" || cvalue == "false" ) ? "False" : "True";
737 ptype = "bool";
738 } else if ( ti == typeid( char ) || ti == typeid( signed char ) || ti == typeid( unsigned char ) ||
739 ti == typeid( short ) || ti == typeid( unsigned short ) || ti == typeid( int ) ||
740 ti == typeid( unsigned int ) || ti == typeid( long ) || ti == typeid( unsigned long ) ) {
741 pvalue = cvalue;
742 ptype = "int";
743 } else if ( ti == typeid( long long ) || ti == typeid( unsigned long long ) ) {
744 pvalue = cvalue + "L";
745 ptype = "long";
746 } else if ( ti == typeid( float ) || ti == typeid( double ) ) {
747 // forces python to handle this as a float: put a dot in there...
748 pvalue = boost::to_lower_copy( cvalue );
749 if ( pvalue == "nan" ) {
750 pvalue = "float('nan')";
751 std::cout << "WARNING: default value for [" << p->name() << "] is NaN !!" << std::endl;
752 } else if ( std::string::npos == pvalue.find( "." ) && std::string::npos == pvalue.find( "e" ) ) {
753 pvalue = cvalue + ".0";
754 }
755 ptype = "float";
756 } else if ( ti == typeid( string ) ) {
757
758 pvalue = "'" + cvalue + "'";
759 ptype = "str";
760 } else if ( ti == typeid( GaudiHandleBase ) ) {
761 m_importGaudiHandles = true;
762 const GaudiHandleProperty& hdl = dynamic_cast<const GaudiHandleProperty&>( *p );
763 const GaudiHandleBase& base = hdl.value();
764
765 pvalue = base.pythonRepr();
766 ptype = "GaudiHandle";
767 } else if ( ti == typeid( GaudiHandleArrayBase ) ) {
768 m_importGaudiHandles = true;
769 const GaudiHandleArrayProperty& hdl = dynamic_cast<const GaudiHandleArrayProperty&>( *p );
770 const GaudiHandleArrayBase& base = hdl.value();
771
772 pvalue = base.pythonRepr();
773 ptype = "GaudiHandleArray";
774 } else if ( ti == typeid( DataObjectHandleBase ) ) {
775 m_importDataObjectHandles = true;
776 const DataObjectHandleProperty& hdl = dynamic_cast<const DataObjectHandleProperty&>( *p );
777 const DataObjectHandleBase& base = hdl.value();
778
779 pvalue = base.pythonRepr();
780 ptype = "DataObjectHandleBase";
781 } else {
782 std::ostringstream v_str;
783 v_str.setf( std::ios::showpoint ); // to correctly display floats
784 p->toStream( v_str );
785 pvalue = v_str.str();
786 ptype = "list";
787 }
788 }
std::ostringstream::setf
T setf(T...args)
std::endl
T endl(T...args)
GaudiHandleProperty
Definition: Property.h:794
DataObjectHandleProperty
DataObjectHandleProperty.h GaudiKernel/DataObjectHandleProperty.h.
Definition: DataObjectHandleProperty.h:23
std::type_info
std::string
STL class.
configGenerator::m_importDataObjectHandles
bool m_importDataObjectHandles
Definition: genconf.cpp:122
std::ostringstream
STL class.
GaudiHandleProperty::value
const GaudiHandleBase & value() const
Definition: Property.h:817
std::ostringstream::str
T str(T...args)
GaudiHandleArrayProperty::value
const GaudiHandleArrayBase & value() const
Definition: Property.h:857
GaudiHandleArrayBase::pythonRepr
std::string pythonRepr() const override
Python representation of array of handles, i.e.
Definition: GaudiHandle.cpp:94
std::string::find
T find(T...args)
GaudiHandleArrayBase
Base class of array&#39;s of various gaudihandles.
Definition: GaudiHandle.h:364
DataObjectHandleBase
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.
Definition: DataObjectHandleBase.h:24
GaudiHandleBase::pythonRepr
std::string pythonRepr() const override
Python representation of handle, i.e.
Definition: GaudiHandle.cpp:56
configGenerator::m_importGaudiHandles
bool m_importGaudiHandles
switch to decide if the generated configurables need to import GaudiHandles (ie: if one of the compon...
Definition: genconf.cpp:120
DataObjectHandleBase::pythonRepr
std::string pythonRepr() const override
Definition: DataObjectHandleBase.cpp:126
DataObjectHandleProperty::value
const DataObjectHandleBase & value() const
Definition: DataObjectHandleProperty.cpp:94
GaudiHandleBase
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
Definition: GaudiHandle.h:94
GaudiHandleArrayProperty
Definition: Property.h:834
std::cout

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

customize the configurable base class for Algorithm component

Definition at line 162 of file genconf.cpp.

162 { m_configurable["Algorithm"] = cfgAlgorithm; }
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:135

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

customize the configurable base class for AlgTool component

Definition at line 165 of file genconf.cpp.

165 { m_configurable["AlgTool"] = cfgAlgTool; }
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:135

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

customize the configurable base class for AlgTool component

Definition at line 168 of file genconf.cpp.

168 { m_configurable["Auditor"] = cfgAuditor; }
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:135

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

customize the default name for configurable instances

Definition at line 159 of file genconf.cpp.

159 { m_configurable["DefaultName"] = defaultName; }
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:135

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

customize the Module name where configurable base classes are defined

Definition at line 156 of file genconf.cpp.

156 { m_configurable["Module"] = moduleName; }
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:135
System::moduleName
GAUDI_API const std::string & moduleName()
Get the name of the (executable/DLL) file without file-type.
Definition: ModuleInfo.cpp:54

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

customize the configurable base class for Service component

Definition at line 171 of file genconf.cpp.

172 {
173 m_configurable["Service"] = cfgService;
174 m_configurable["ApplicationMgr"] = cfgService;
175 }
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:135

## Member Data Documentation

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 135 of file genconf.cpp.

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 128 of file genconf.cpp.

bool configGenerator::m_importDataObjectHandles
| private

Definition at line 122 of file genconf.cpp.

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 120 of file genconf.cpp.

string configGenerator::m_outputDirName
| private

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

Definition at line 113 of file genconf.cpp.

string configGenerator::m_pkgName
| private

name of the package we are processing

Definition at line 109 of file genconf.cpp.

stringstream configGenerator::m_pyBuf
| private

buffer of auto-generated configurables

Definition at line 116 of file genconf.cpp.

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

- GaudiKernel/src/Util/genconf.cpp