| The Gaudi Framework v27r1

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

## Constructor & Destructor Documentation

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

Definition at line 125 of file genconf.cpp.

126 :
127 m_pkgName ( pkgName ),
128 m_outputDirName ( outputDirName ),
129 m_pyBuf ( ),
130 m_importGaudiHandles( false ),
131 m_importDataObjectHandles( false ),
132 m_dbBuf ( ),
133 m_configurable ( )
134 {}
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:122
configGenerator::m_pyBuf
stringstream m_pyBuf
buffer of auto-generated configurables
Definition: genconf.cpp:103
configGenerator::m_importDataObjectHandles
bool m_importDataObjectHandles
Definition: genconf.cpp:109
configGenerator::m_dbBuf
stringstream m_dbBuf
buffer of generated configurables informations for the "Db" file The "Db" file is holding information...
Definition: genconf.cpp:115
configGenerator::m_outputDirName
string m_outputDirName
absolute path to the directory where genconf will store auto-generated files (Configurables and Confi...
Definition: genconf.cpp:100
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:107
configGenerator::m_pkgName
string m_pkgName
name of the package we are processing
Definition: genconf.cpp:96

## Member Function Documentation

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

Definition at line 186 of file genconf.cpp.

187 {
188 pyOut << m_pyBuf.str() << flush;
189 dbOut << m_dbBuf.str() << flush;
190 }
configGenerator::m_pyBuf
stringstream m_pyBuf
buffer of auto-generated configurables
Definition: genconf.cpp:103
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:115
std::flush
T flush(T...args)

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

Definition at line 703 of file genconf.cpp.

708 {
709 string cname = componentName;
710 pythonizeName(cname);
711
712 typedef GaudiUtils::HashMap<std::string, std::string> PropertyDoc_t;
713 PropertyDoc_t propDoc;
714
715 m_pyBuf << "\n";
716 m_pyBuf << "class " << cname
717 << "( " << m_configurable[componentType] << " ) :"
718 << "\n";
719 m_pyBuf << " __slots__ = { \n";
720 for ( vector<Property*>::const_iterator it = properties.begin() ;
721 it != properties.end(); ++it ) {
722
723 const string pname = (*it)->name();
724 // Validate property name (it must be a valid Python identifier)
725 if (!boost::regex_match(pname, pythonIdentifier)) {
726 std::cout << "ERROR: invalid property name \"" << pname
727 << "\" in component " << cname
728 << " (invalid Python identifier)" << std::endl;
729 // try to make the buffer at least more or less valid python code.
730 m_pyBuf << " #ERROR-invalid identifier '" << pname << "'\n"
731 << " }\n";
732 return 1;
733 }
734
735 string pvalue, ptype;
736 pythonizeValue( (*it), pvalue, ptype );
737 m_pyBuf << " '" << pname << "' : " << pvalue <<", # " << ptype << "\n";
738
739 if ( (*it)->documentation() != "none" ) {
740 propDoc[pname] = (*it)->documentation();
741 }
742
743 }
744 m_pyBuf << " }\n";
745 m_pyBuf << " _propertyDocDct = { \n";
746 for ( PropertyDoc_t::const_iterator iProp = propDoc.begin();
747 iProp != propDoc.end();
748 ++iProp ) {
749 m_pyBuf << std::setw(5)
750 << "'" << iProp->first << "' : "
751 << "\"\"\" " << iProp->second << " \"\"\",\n";
752 }
753 m_pyBuf << " }\n";
754
755 m_pyBuf
756 << " def __init__(self, name = " << m_configurable["DefaultName"]
757 << ", **kwargs):\n"
758 << " super(" << cname << ", self).__init__(name)\n"
759 << " for n,v in kwargs.items():\n"
760 << " setattr(self, n, v)\n"
761 << " def getDlls( self ):\n"
762 << " return '" << libName << "'\n"
763 << " def getType( self ):\n"
764 << " return '" << componentName << "'\n"
765 << " pass # class " << cname << "\n"
766 << flush;
767
768 // name of the auto-generated module
769 const string pyName = ( fs::path(m_outputDirName) /
770 fs::path(libName+"Conf.py") ).string();
771 const string modName = fs::basename( fs::path( pyName ).leaf() );
772
773 // now the db part
774 m_dbBuf
775 << m_pkgName << "." << modName << " "
776 << libName << " " << cname
777 << "\n"
778 << flush;
779
780 return 0;
781 }
configGenerator::pythonizeValue
void pythonizeValue(const Property *prop, string &pvalue, string &ptype)
handle the "marshalling" of Properties
Definition: genconf.cpp:795
configGenerator::pythonizeName
void pythonizeName(string &name)
Translates a valid C++ typename into a valid python one.
Definition: genconf.cpp:783
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:122
configGenerator::m_pyBuf
stringstream m_pyBuf
buffer of auto-generated configurables
Definition: genconf.cpp:103
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:115
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191
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:100
std::vector
STL class.
finalize_tags.basename
def basename(url)
Definition: finalize_tags.py:47
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:96
std::cout
compareOutputFiles.pname
list pname
Definition: compareOutputFiles.py:392

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

438 {
439 //--- Disable checking StatusCode -------------------------------------------
440 StatusCode::disableChecking();
441
442 const Strings_t::const_iterator endLib = libs.end();
443
444 const std::string gaudiSvc = "GaudiCoreSvc";
445 const bool isGaudiSvc = ( std::find( libs.begin(), endLib, gaudiSvc ) != endLib );
446
447 //--- Instantiate ApplicationMgr --------------------------------------------
448 if ( !isGaudiSvc && createAppMgr() ) {
449 cout << "ERROR: ApplicationMgr can not be created. Check environment" << endl;
450 return EXIT_FAILURE;
451 }
452
453 //--- Iterate over component factories --------------------------------------
454 using Gaudi::PluginService::Details::Registry;
455 Registry& registry = Registry::instance();
456
457 std::set<std::string> bkgNames = registry.loadedFactories();
458
459 ISvcLocator* svcLoc = Gaudi::svcLocator();
460 IInterface* dummySvc = new Service( "DummySvc", svcLoc );
461 dummySvc->addRef();
462
463 bool allGood = true;
464
465 // iterate over all the requested libraries
466 for ( Strings_t::const_iterator iLib=libs.begin(); iLib != endLib; ++iLib ) {
467
468 std::cout << ":::: processing library: " << *iLib << "..." << std::endl;
469
470 // reset state
471 m_importGaudiHandles = false;
472 m_importDataObjectHandles = false;
473 m_pyBuf.str("");
474 m_dbBuf.str("");
475
476 //--- Load component library ----------------------------------------------
477 System::ImageHandle handle;
478 unsigned long err = System::loadDynamicLib( *iLib, &handle );
479 if ( err != 1 ) {
480 cout << "ERROR: " << System::getLastErrorString() << endl;
481 allGood = false;
482 continue;
483 }
484
485 std::set<std::string> factories = registry.loadedFactories();
486
487 for ( std::set<std::string>::iterator it = factories.begin();
488 it != factories.end(); ++it ) {
489 const string ident = *it;
490 if ( bkgNames.find(ident) != bkgNames.end() ) {
491 if ( Gaudi::PluginService::Details::logger().level() <= 1 ) {
492 cout << "\t==> skipping [" << ident << "]..." << endl;
493 }
494 continue;
495 }
496
497 const Registry::FactoryInfo info = registry.getInfo(*it);
498 const string rtype = info.rtype;
499
500 // do not generate configurables for the Reflex-compatible aliases
501 if (info.properties.find("ReflexName") != info.properties.end())
502 continue;
503
504 // Atlas contributed code (patch #1247)
505 // Skip the generation of configurables if the component does not come
506 // from the same library we are processing (i.e. we found a symbol that
507 // is coming from a library loaded by the linker).
508 if ( !DsoUtils::inDso( info.ptr, DsoUtils::libNativeName(*iLib) ) ) {
509 cout << "WARNING: library [" << *iLib << "] exposes factory ["
510 << ident << "] which is declared in ["
511 << DsoUtils::dsoName(info.ptr) << "] !!" << endl;
512 continue;
513 }
514
515 string type;
516 bool known = true;
517 if ( ident == "ApplicationMgr" ) type = "ApplicationMgr";
518 else if ( rtype == typeid(IInterface*).name() ) type = "IInterface";
519 else if ( rtype == typeid(IAlgorithm*).name() ) type = "Algorithm";
520 else if ( rtype == typeid(IService* ).name() ) type = "Service";
521 else if ( rtype == typeid(IAlgTool* ).name() ) type = "AlgTool";
522 else if ( rtype == typeid(IAuditor* ).name() ) type = "Auditor";
523 else if ( rtype == typeid(IConverter*).name() ) type = "Converter";
524 else if ( rtype == typeid(DataObject*).name() ) type = "DataObject";
525 else type = "Unknown", known = false;
526 string name = ident;
527 // handle possible problems with templated components
528 boost::trim(name);
529
530 if ( type == "IInterface" ) {
533 continue;
534 }
535
536 if ( type == "Converter" || type == "DataObject" ) {
538 continue;
539 }
540
541 if ( !known ) {
542 cout << "WARNING: Unknown (return) type [" << System::typeinfoName(rtype.c_str()) << "] !!"
543 << " Component [" << ident << "] is skipped !"
544 << endl;
545 continue;
546 }
547
548 cout << " - component: " << info.className << " (";
549 if (info.className != name)
550 cout << name << ": ";
551 cout << type << ")" << endl;
552
553 string cname = "DefaultName";
554 SmartIF<IProperty> prop;
555 try {
556 if ( type == "Algorithm" ) {
557 prop = SmartIF<IAlgorithm>(Algorithm::Factory::create(ident, cname, svcLoc));
558 }
559 else if ( type == "Service") {
560 prop = SmartIF<IService>(Service::Factory::create(ident, cname, svcLoc));
561 }
562 else if ( type == "AlgTool") {
563 prop = SmartIF<IAlgTool>(AlgTool::Factory::create(ident, cname, type, dummySvc));
564 // FIXME: AlgTool base class increase artificially by 1 the refcount.
565 prop->release();
566 }
567 else if ( type == "Auditor") {
568 prop = SmartIF<IAuditor>(Auditor::Factory::create(ident, cname, svcLoc));
569 }
570 else if ( type == "ApplicationMgr") {
571 prop = SmartIF<ISvcLocator>(svcLoc);
572 }
573 else {
574 continue; // unknown
575 }
576 }
577 catch ( exception& e ) {
578 cout << "ERROR: Error instantiating " << name
579 << " from " << *iLib << endl;
580 cout << "ERROR: Got exception: " << e.what() << endl;
581 allGood = false;
582 continue;
583 }
584 catch ( ... ) {
585 cout << "ERROR: Error instantiating " << name
586 << " from " << *iLib << endl;
587 allGood = false;
588 continue;
589 }
590 if( prop ) {
591 if (genComponent( *iLib, name, type, prop->getProperties() )) {
592 allGood = false;
593 }
594 prop.reset();
595 } else {
596 cout << "ERROR: could not cast IInterface* object to an IProperty* !\n"
597 << "ERROR: return type from PluginSvc is [" << rtype << "]...\n"
598 << "ERROR: NO Configurable will be generated for ["
599 << name << "] !"
600 << endl;
601 allGood = false;
602 }
603 } //> end loop over factories
604
608 const std::string pyName = ( fs::path(m_outputDirName) /
609 fs::path(*iLib+"Conf.py") ).string();
610 const std::string dbName = ( fs::path(m_outputDirName) /
611 fs::path(*iLib+".confdb") ).string();
612
613 std::fstream py( pyName, std::ios_base::out|std::ios_base::trunc );
614 std::fstream db( dbName, std::ios_base::out|std::ios_base::trunc );
615
616 genHeader ( py, db );
617 if (!userModule.empty())
618 py << "from " << userModule << " import *" <<endl;
619 genBody ( py, db );
620 genTrailer( py, db );
621
622 } //> end loop over libraries
623
624 dummySvc->release();
625 dummySvc = 0;
626
627 return allGood ? EXIT_SUCCESS : EXIT_FAILURE;
628 }
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
IProperty::getProperties
virtual const std::vector< Property * > & getProperties() const =0
Get list of properties.
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:297
configGenerator::genComponent
int genComponent(const std::string &libName, const std::string &componentName, const std::string &componentType, const vector< Property * > &properties)
Definition: genconf.cpp:703
Gaudi::PluginService::Details::Logger::level
Level level() const
Definition: PluginServiceDetails.h:213
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:103
Gaudi::PluginService::Details::logger
GAUDIPS_API Logger & logger()
Return the current logger instance.
Definition: PluginService.cpp:337
std::string
STL class.
configGenerator::m_importDataObjectHandles
bool m_importDataObjectHandles
Definition: genconf.cpp:109
gaudirun.type
string type
Definition: gaudirun.py:151
Gaudi::svcLocator
GAUDI_API ISvcLocator * svcLocator()
std::exception::what
T what(T...args)
IService
General service interface definition.
Definition: IService.h:18
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
std::fstream
STL class.
configGenerator::genHeader
void genHeader(std::ostream &pyOut, std::ostream &dbOut)
Definition: genconf.cpp:666
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:115
std::exception
STL class.
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:25
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191
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:100
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
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:107
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:692
System::getLastErrorString
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
Definition: System.cpp:254
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:875
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:186
System::loadDynamicLib
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.
Definition: System.cpp:124

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

Definition at line 666 of file genconf.cpp.

669 {
670 // python file part
671 std::string now = Gaudi::Time::current().format(true);
672 py << "#" << now //<< "\n"
673 << "\"\"\"Automatically generated. DO NOT EDIT please\"\"\"\n";
674 if ( m_importGaudiHandles ) {
675 py << "from GaudiKernel.GaudiHandles import *\n";
676 }
677
678 if ( m_importDataObjectHandles ) {
679 py << "from GaudiKernel.DataObjectHandleBase import *\n";
680 }
681
682 genImport(py,boost::format("from %1%.Configurable import *"));
683
684 // db file part
685 db << "## -*- ascii -*- \n"
686 << "# db file automatically generated by genconf on: "
687 << now
688 << "\n"
689 << flush;
690 }
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:109
std::flush
T flush(T...args)
configGenerator::genImport
void genImport(std::ostream &s, const boost::format &frmt, std::string indent)
Definition: genconf.cpp:630
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:107
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 630 of file genconf.cpp.

632 {
633
634 std::string::size_type pos = 0, nxtpos = 0;
635 std::string mod;
636
637 while ( std::string::npos != pos ){
638 // find end of module name
639 nxtpos = m_configurable["Module"].find_first_of(',',pos);
640
641 // Prepare import string
642 mod = m_configurable["Module"].substr(pos,nxtpos-pos);
643 std::ostringstream import;
644 import << boost::format(frmt) % mod;
645
646 // append a normal import or a try/except enclosed one depending
647 // on availability of a fall-back module (next in the list)
648 if ( std::string::npos == nxtpos ) {
649 // last possible module
650 s << indent << import.str() << "\n" << flush;
651 pos = std::string::npos;
652 } else {
653 // we have a fallback for this
654 s << indent << "try:\n"
655 << indent << py_tab << import.str() << "\n"
656 << indent << "except ImportError:\n"
657 << flush;
658 pos = nxtpos+1;
659 }
660 // increase indentation level for next iteration
661 indent += py_tab;
662 }
663 }
Gaudi.CommonGaudiConfigurables.mod
tuple mod
Definition: CommonGaudiConfigurables.py:22
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:122
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 692 of file genconf.cpp.

695 {
696 // db file part
697 db << "## " << m_pkgName << "\n"
698 << std::flush;
699 }
std::flush
T flush(T...args)
configGenerator::m_pkgName
string m_pkgName
name of the package we are processing
Definition: genconf.cpp:96

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

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

Definition at line 783 of file genconf.cpp.

785 {
786 static string in("<>&*,: ().");
787 static string out("__rp__s___");
788 boost::algorithm::replace_all(name, ", ", ",");
789 for ( string::iterator i = name.begin(); i != name.end(); ++i ) {
790 if ( in.find(*i) != string::npos ) *i = out[in.find(*i)];
791 }
792 }
std::string::end
T end(T...args)
std::string::begin
T begin(T...args)
ana.i
list i
Definition: ana.py:128

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

handle the "marshalling" of Properties

Definition at line 795 of file genconf.cpp.

798 {
799 const std::string cvalue = p->toString();
800 const type_info& ti = *p->type_info();
801 if ( ti == typeid(bool) ) {
802 pvalue = ( cvalue == "0" || cvalue == "False" || cvalue == "false" )
803 ? "False"
804 : "True";
805 ptype = "bool";
806 }
807 else if ( ti == typeid(char) || ti == typeid(signed char)
808 || ti == typeid(unsigned char) ||
809 ti == typeid(short) || ti == typeid(unsigned short) ||
810 ti == typeid(int) || ti == typeid(unsigned int) ||
811 ti == typeid(long) || ti == typeid(unsigned long) ) {
812 pvalue = cvalue;
813 ptype = "int";
814 }
815 else if ( ti == typeid(long long) || ti == typeid(unsigned long long) ) {
816 pvalue = cvalue + "L";
817 ptype = "long";
818 }
819 else if ( ti == typeid(float) || ti == typeid(double) ) {
820 // forces python to handle this as a float: put a dot in there...
821 pvalue = boost::to_lower_copy(cvalue);
822 if ( pvalue == "nan" ) {
823 pvalue = "float('nan')";
824 std::cout << "WARNING: default value for ["
825 << p->name() << "] is NaN !!"
826 << std::endl;
827 } else if ( std::string::npos == pvalue.find(".") &&
828 std::string::npos == pvalue.find("e") ) {
829 pvalue = cvalue + ".0";
830 }
831 ptype = "float";
832 }
833 else if ( ti == typeid(string) ) {
834
835 pvalue = "'"+cvalue+"'";
836 ptype = "str";
837 }
838 else if ( ti == typeid(GaudiHandleBase) ) {
839 m_importGaudiHandles = true;
840 const GaudiHandleProperty& hdl
841 = dynamic_cast<const GaudiHandleProperty&>(*p);
842 const GaudiHandleBase& base = hdl.value();
843
844 pvalue = base.pythonRepr();
845 ptype = "GaudiHandle";
846 }
847 else if ( ti == typeid(GaudiHandleArrayBase) ) {
848 m_importGaudiHandles = true;
849 const GaudiHandleArrayProperty& hdl
850 = dynamic_cast<const GaudiHandleArrayProperty&>(*p);
851 const GaudiHandleArrayBase& base = hdl.value();
852
853 pvalue = base.pythonRepr();
854 ptype = "GaudiHandleArray";
855 }
856 else if ( ti == typeid(DataObjectHandleBase) ) {
857 m_importDataObjectHandles = true;
858 const DataObjectHandleProperty& hdl
859 = dynamic_cast<const DataObjectHandleProperty&>(*p);
860 const DataObjectHandleBase& base = hdl.value();
861
862 pvalue = base.pythonRepr();
863 ptype = "DataObjectHandleBase";
864 }
865 else {
866 std::ostringstream v_str;
867 v_str.setf(std::ios::fixed); // to correctly display floats
868 p->toStream(v_str);
869 pvalue = v_str.str();
870 ptype = "list";
871 }
872 }
GaudiHandleArrayProperty::value
const GaudiHandleArrayBase & value() const
Definition: Property.h:892
std::ostringstream::setf
T setf(T...args)
GaudiHandleBase::pythonRepr
virtual std::string pythonRepr() const
Python representation of handle, i.e.
Definition: GaudiHandle.cpp:56
DataObjectHandleBase::pythonRepr
const std::string pythonRepr() const
Definition: DataObjectHandleBase.cpp:48
std::endl
T endl(T...args)
GaudiHandleProperty
Definition: Property.h:783
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:109
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)
std::string::find
T find(T...args)
GaudiHandleArrayBase
Base class of array's of various gaudihandles.
Definition: GaudiHandle.h:320
DataObjectHandleBase
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.
Definition: DataObjectHandleBase.h:24
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:107
GaudiHandleProperty::value
const GaudiHandleBase & value() const
Definition: Property.h:832
DataObjectHandleProperty::value
const DataObjectHandleBase & value() const
Definition: DataObjectHandleProperty.cpp:202
GaudiHandleBase
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
Definition: GaudiHandle.h:93
GaudiHandleArrayProperty
Definition: Property.h:841
std::cout
GaudiHandleArrayBase::pythonRepr
std::string pythonRepr() const override
Python representation of array of handles, i.e.
Definition: GaudiHandle.cpp:94

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

customize the configurable base class for Algorithm component

Definition at line 155 of file genconf.cpp.

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

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

customize the configurable base class for AlgTool component

Definition at line 161 of file genconf.cpp.

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

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

customize the configurable base class for AlgTool component

Definition at line 167 of file genconf.cpp.

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

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

customize the default name for configurable instances

Definition at line 149 of file genconf.cpp.

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

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

customize the Module name where configurable base classes are defined

Definition at line 143 of file genconf.cpp.

144 {
145 m_configurable[ "Module" ] = moduleName;
146 }
configGenerator::m_configurable
GaudiUtils::HashMap< std::string, std::string > m_configurable
Configurable customization.
Definition: genconf.cpp:122
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 173 of file genconf.cpp.

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

## 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 122 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 115 of file genconf.cpp.

bool configGenerator::m_importDataObjectHandles
| private

Definition at line 109 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 107 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 100 of file genconf.cpp.

string configGenerator::m_pkgName
| private

name of the package we are processing

Definition at line 96 of file genconf.cpp.

stringstream configGenerator::m_pyBuf
| private

buffer of auto-generated configurables

Definition at line 103 of file genconf.cpp.

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

- GaudiKernel/src/Util/genconf.cpp