|  | 
| bool | genComponent (const std::string &libName, const std::string &componentName, component_t componentType, const vector< PropertyBase * > &properties, const Gaudi::PluginService::Details::Registry::FactoryInfo &info) | 
|  | 
| bool | genComponent2 (const std::string &componentName, component_t componentType, const vector< PropertyBase * > &properties, const std::vector< std::string > &interfaces, const Gaudi::PluginService::Details::Registry::FactoryInfo &info) | 
|  | 
| void | genImport (std::ostream &s, std::string_view 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... 
 | 
|  | 
Definition at line 170 of file genconf.cpp.
 
◆ configGenerator()
  
  | 
        
          | configGenerator::configGenerator | ( | const string & | pkgName, |  
          |  |  | const string & | outputDirName |  
          |  | ) |  |  |  | inline | 
 
 
◆ genBody()
◆ genComponent()
  
  | 
        
          | bool configGenerator::genComponent | ( | const std::string & | libName, |  
          |  |  | const std::string & | componentName, |  
          |  |  | component_t | componentType, |  
          |  |  | const vector< PropertyBase * > & | properties, |  
          |  |  | const Gaudi::PluginService::Details::Registry::FactoryInfo & | info |  
          |  | ) |  |  |  | private | 
 
Definition at line 704 of file genconf.cpp.
  709   auto       cname    = pythonizeName( componentName );
 
  710   const auto decl_loc = info.getprop( 
"declaration_location" );
 
  716   m_pyBuf << 
"  __slots__ = { \n";
 
  718     const string& 
pname = prop->name();
 
  720     if ( !boost::regex_match( 
pname, pythonIdentifier ) ) {
 
  721       LOG_ERROR << 
"invalid property name \"" << 
pname << 
"\" in component " << cname << 
" (invalid Python identifier)" 
  724       m_pyBuf << 
" #ERROR-invalid identifier '" << 
pname << 
"'\n" 
  729     string pvalue, ptype;
 
  733     if ( prop->documentation() != 
"none" ) {
 
  734       propDoc.
emplace_back( 
pname, prop->documentation() + 
" [" + prop->ownerTypeName() + 
"]" );
 
  738   m_pyBuf << 
"  _propertyDocDct = { \n";
 
  739   for ( 
const auto& prop : propDoc ) {
 
  741             << 
"\"\"\" " << prop.second << 
" \"\"\",\n";
 
  745   if ( !decl_loc.empty() ) { 
m_pyBuf << 
"  __declaration_location__ = '" << decl_loc << 
"'\n"; }
 
  746   m_pyBuf << 
"  def __init__(self, name = " << 
m_configurable[component_t::DefaultName] << 
", **kwargs):\n" 
  747           << 
"      super(" << cname << 
", self).__init__(name)\n" 
  748           << 
"      for n,v in kwargs.items():\n" 
  749           << 
"         setattr(self, n, v)\n" 
  750           << 
"  def getDlls( self ):\n" 
  751           << 
"      return '" << libName << 
"'\n" 
  752           << 
"  def getType( self ):\n" 
  753           << 
"      return '" << componentName << 
"'\n" 
  754           << 
"  pass # class " << cname << 
"\n" 
  759   const string modName = 
fs::path( pyName ).filename().stem().string();
 
 
 
 
◆ genComponent2()
  
  | 
        
          | bool configGenerator::genComponent2 | ( | const std::string & | componentName, |  
          |  |  | component_t | componentType, |  
          |  |  | const vector< PropertyBase * > & | properties, |  
          |  |  | const std::vector< std::string > & | interfaces, |  
          |  |  | const Gaudi::PluginService::Details::Registry::FactoryInfo & | info |  
          |  | ) |  |  |  | private | 
 
Definition at line 768 of file genconf.cpp.
  773   m_db2Buf << 
"    '" << componentName << 
"': {\n";
 
  774   m_db2Buf << 
"        '__component_type__': '";
 
  775   switch ( componentType ) {
 
  776   case component_t::Algorithm:
 
  779   case component_t::AlgTool:
 
  782   case component_t::ApplicationMgr: 
 
  783   case component_t::Service:
 
  786   case component_t::Auditor:
 
  793   const auto decl_loc = info.getprop( 
"declaration_location" );
 
  794   if ( !decl_loc.empty() ) { 
m_db2Buf << 
"',\n        '__declaration_location__': '" << decl_loc; }
 
  796   m_db2Buf << 
"',\n        '__interfaces__': (";
 
  798     if ( ignored_interfaces.find( intf ) == 
end( ignored_interfaces ) ) { 
m_db2Buf << 
'\'' << intf << 
"', "; }
 
  800   m_db2Buf << 
"),\n        'properties': {\n";
 
  804     const string& 
pname = prop->name();
 
  806     if ( !boost::regex_match( 
pname, pythonIdentifier ) ) {
 
  807       LOG_ERROR << 
"invalid property name \"" << 
pname << 
"\" in component " << componentName
 
  808                 << 
" (invalid Python identifier)" << 
std::endl;
 
  809       m_db2Buf << 
" #ERROR-invalid identifier '" << 
pname << 
"'\n";
 
  814     string pvalue, ptype;
 
  817     m_db2Buf << 
"            '" << 
pname << 
"': ('" << ptype << 
"', " << pvalue << 
", '''" << prop->documentation()
 
  818              << 
" [" << prop->ownerTypeName() << 
"]'''";
 
  819     auto sem = prop->semantics();
 
  820     if ( !sem.empty() ) { 
m_db2Buf << 
", '" << sem << 
'\''; }
 
 
 
 
◆ genConfig()
      
        
          | 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 
write-out files for this library
Definition at line 465 of file genconf.cpp.
  468   const auto endLib = libs.end();
 
  470   static const std::string gaudiSvc = 
"GaudiCoreSvc";
 
  471   const bool               isGaudiSvc =
 
  473         return s.find( gaudiSvc ) != std::string::npos; 
 
  478     cout << 
"ERROR: ApplicationMgr can not be created. Check environment" << 
endl;
 
  483   using Gaudi::PluginService::Details::Registry;
 
  484   const Registry& 
registry = Registry::instance();
 
  486   auto bkgNames = 
registry.loadedFactoryNames();
 
  489   IInterface*  dummySvc = 
new Service( 
"DummySvc", svcLoc );
 
  495   for ( 
const auto& iLib : libs ) {
 
  497     if ( lib.
compare( 0, 3, 
"lib" ) == 0 ) {
 
  500     LOG_INFO << 
":::: processing library: " << iLib << 
"...";
 
  519     for ( 
const auto& factoryName : 
registry.loadedFactoryNames() ) {
 
  520       if ( bkgNames.find( factoryName ) != bkgNames.end() ) {
 
  522           LOG_INFO << 
"\t==> skipping [" << factoryName << 
"]...";
 
  526       auto entry = 
factories.find( factoryName );
 
  528         LOG_ERROR << 
"inconsistency in component factories list: I cannot find anymore " << factoryName;
 
  531       const auto& info = entry->second;
 
  532       if ( !info.is_set() ) 
continue;
 
  535       if ( !info.getprop( 
"ReflexName" ).empty() ) 
continue;
 
  541       if ( libNativeName( lib ) != info.library ) {
 
  542         LOG_WARNING << 
"library [" << lib << 
"] exposes factory [" << factoryName << 
"] which is declared in [" 
  543                     << info.library << 
"] !!";
 
  547       component_t 
type = component_t::Unknown;
 
  549         const auto ft = allowedFactories.find( info.factory.type().name() );
 
  550         if ( ft != allowedFactories.end() ) {
 
  552         } 
else if ( factoryName == 
"ApplicationMgr" ) {
 
  553           type = component_t::ApplicationMgr;
 
  561       const auto className = info.getprop( 
"ClassName" );
 
  565       string             cname = 
"DefaultName";
 
  569         case component_t::Algorithm:
 
  572         case component_t::Service:
 
  575         case component_t::AlgTool:
 
  581         case component_t::Auditor:
 
  584         case component_t::ApplicationMgr:
 
  591         LOG_ERROR << 
"Error instantiating " << 
name << 
" from " << iLib;
 
  596         LOG_ERROR << 
"Error instantiating " << 
name << 
" from " << iLib;
 
  610         LOG_ERROR << 
"could not cast IInterface* object to an IProperty* !";
 
  611         LOG_ERROR << 
"NO Configurable will be generated for [" << 
name << 
"] !";
 
  627       if ( !userModule.
empty() ) py << 
"from " << userModule << 
" import *" << 
endl;
 
  642   return allGood ? EXIT_SUCCESS : EXIT_FAILURE;
 
 
 
 
◆ genHeader()
Definition at line 676 of file genconf.cpp.
  682      << 
"\"\"\"Automatically generated. DO NOT EDIT please\"\"\"\n";
 
  688   genImport( py, 
"from {}.Configurable import *" );
 
  691   db << 
"##  -*- ascii -*-  \n" 
  692      << 
"# db file automatically generated by genconf on: " << now << 
"\n" 
 
 
 
◆ genImport()
Definition at line 645 of file genconf.cpp.
  647   std::string::size_type pos = 0, nxtpos = 0;
 
  650   while ( std::string::npos != pos ) {
 
  652     nxtpos = 
m_configurable[component_t::Module].find_first_of( 
',', pos );
 
  661     if ( std::string::npos == nxtpos ) {
 
  663       s << indent << 
import.str() << 
"\n" << 
flush;
 
  664       pos = std::string::npos;
 
  667       s << indent << 
"try:\n" << indent << py_tab << 
import.str() << 
"\n" << indent << 
"except ImportError:\n" << 
flush;
 
 
 
 
◆ genTrailer()
◆ pythonizeValue()
handle the "marshalling" of Properties 
Definition at line 830 of file genconf.cpp.
  837   if ( ti == typeIndex<bool>() ) {
 
  838     pvalue = ( cvalue == 
"0" || cvalue == 
"False" || cvalue == 
"false" ) ? 
"False" : 
"True";
 
  839   } 
else if ( ti == typeIndex<char>() || ti == typeIndex<signed char>() || ti == typeIndex<unsigned char>() ||
 
  840               ti == typeIndex<short>() || ti == typeIndex<unsigned short>() || ti == typeIndex<int>() ||
 
  841               ti == typeIndex<unsigned int>() || ti == typeIndex<long>() || ti == typeIndex<unsigned long>() ||
 
  842               ti == typeIndex<long long>() || ti == typeIndex<unsigned long long>() ) {
 
  844   } 
else if ( ti == typeIndex<float>() || ti == typeIndex<double>() ) {
 
  846     pvalue = boost::to_lower_copy( cvalue );
 
  847     if ( std::string::npos != pvalue.
find( 
"nan" ) ) {
 
  848       pvalue = 
"float('nan')";
 
  849     } 
else if ( std::string::npos == pvalue.
find( 
"." ) && std::string::npos == pvalue.
find( 
"e" ) ) {
 
  850       pvalue = cvalue + 
".0";
 
  852   } 
else if ( ti == typeIndex<string>() ) {
 
  853     pvalue = quote( cvalue );
 
  854   } 
else if ( ti == typeIndex<GaudiHandleBase>() ) {
 
  858     pvalue               = 
base.pythonRepr();
 
  859     ptype                = 
base.pythonPropertyClassName();
 
  861   } 
else if ( ti == typeIndex<GaudiHandleArrayBase>() ) {
 
  865     pvalue               = 
base.pythonRepr();
 
  866     ptype                = 
base.pythonPropertyClassName();
 
  872     pvalue              = 
base.pythonRepr();
 
  876     v_str.
setf( std::ios::showpoint ); 
 
  877     p->toStream( v_str );
 
  878     pvalue = v_str.
str();
 
 
 
 
◆ setConfigurableAlgorithm()
  
  | 
        
          | void configGenerator::setConfigurableAlgorithm | ( | const std::string & | cfgAlgorithm | ) |  |  | inline | 
 
 
◆ setConfigurableAlgTool()
  
  | 
        
          | void configGenerator::setConfigurableAlgTool | ( | const std::string & | cfgAlgTool | ) |  |  | inline | 
 
 
◆ setConfigurableAuditor()
  
  | 
        
          | void configGenerator::setConfigurableAuditor | ( | const std::string & | cfgAuditor | ) |  |  | inline | 
 
 
◆ setConfigurableDefaultName()
  
  | 
        
          | void configGenerator::setConfigurableDefaultName | ( | const std::string & | defaultName | ) |  |  | inline | 
 
customize the default name for configurable instances 
Definition at line 222 of file genconf.cpp.
 
 
◆ setConfigurableModule()
  
  | 
        
          | void configGenerator::setConfigurableModule | ( | const std::string & | moduleName | ) |  |  | inline | 
 
customize the Module name where configurable base classes are defined 
Definition at line 219 of file genconf.cpp.
 
 
◆ setConfigurableService()
  
  | 
        
          | void configGenerator::setConfigurableService | ( | const std::string & | cfgService | ) |  |  | inline | 
 
 
◆ setConfigurableTypes()
  
  | 
        
          | void configGenerator::setConfigurableTypes | ( | const std::set< conf_t > & | types | ) |  |  | inline | 
 
customize configurable types to generate 
Definition at line 216 of file genconf.cpp.
 
 
◆ m_configurable
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 203 of file genconf.cpp.
 
 
◆ m_confTypes
  
  | 
        
          | std::set<conf_t> configGenerator::m_confTypes |  | private | 
 
Types of configurables to generate. 
Definition at line 187 of file genconf.cpp.
 
 
◆ m_db2Buf
◆ 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,... 
Definition at line 193 of file genconf.cpp.
 
 
◆ m_importDataHandles
  
  | 
        
          | bool configGenerator::m_importDataHandles = false |  | private | 
 
 
◆ m_importGaudiHandles
  
  | 
        
          | bool configGenerator::m_importGaudiHandles = false |  | 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 183 of file genconf.cpp.
 
 
◆ m_outputDirName
  
  | 
        
          | string configGenerator::m_outputDirName |  | private | 
 
absolute path to the directory where genconf will store auto-generated files (Configurables and ConfigurableDb) 
Definition at line 176 of file genconf.cpp.
 
 
◆ m_pkgName
  
  | 
        
          | string configGenerator::m_pkgName |  | private | 
 
name of the package we are processing 
Definition at line 172 of file genconf.cpp.
 
 
◆ m_pyBuf
buffer of auto-generated configurables 
Definition at line 179 of file genconf.cpp.
 
 
The documentation for this class was generated from the following file:
 
 
void genTrailer(std::ostream &pyOut, std::ostream &dbOut)
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.
const GaudiHandleArrayBase & value() const
bool genComponent(const std::string &libName, const std::string &componentName, component_t componentType, const vector< PropertyBase * > &properties, const Gaudi::PluginService::Details::Registry::FactoryInfo &info)
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
DataHandleProperty.h GaudiKernel/DataHandleProperty.h.
std::set< conf_t > m_confTypes
Types of configurables to generate.
void * ImageHandle
Definition of an image handle.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
stringstream m_dbBuf
buffer of generated configurables informations for the "Db" file The "Db" file is holding information...
bool m_importGaudiHandles
switch to decide if the generated configurables need to import GaudiHandles (ie: if one of the compon...
stringstream m_pyBuf
buffer of auto-generated configurables
GAUDI_API ISvcLocator * svcLocator()
AttribStringParser::Iterator begin(const AttribStringParser &parser)
std::string format(bool local, std::string spec="%c") const
Format the time using strftime.
bool genComponent2(const std::string &componentName, component_t componentType, const vector< PropertyBase * > &properties, const std::vector< std::string > &interfaces, const Gaudi::PluginService::Details::Registry::FactoryInfo &info)
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
const GaudiHandleBase & value() const
string m_pkgName
name of the package we are processing
void genImport(std::ostream &s, std::string_view frmt, std::string indent)
std::map< component_t, std::string > m_configurable
Configurable customization.
GAUDI_API const std::string & moduleName()
Get the name of the (executable/DLL) file without file-type.
Base class of array's of various gaudihandles.
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
T emplace_back(T... args)
GAUDIPS_API Logger & logger()
Return the current logger instance.
void genHeader(std::ostream &pyOut, std::ostream &dbOut)
static Time current()
Returns the current time.
string m_outputDirName
absolute path to the directory where genconf will store auto-generated files (Configurables and Confi...
stringstream m_db2Buf
buffer of generated GaudiConfig2 configurables
virtual unsigned long release()=0
Release Interface instance.
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
void pythonizeValue(const PropertyBase *prop, string &pvalue, string &ptype)
handle the "marshalling" of Properties
void genBody(std::ostream &pyOut, std::ostream &dbOut)
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.