Commit ea9a3228 authored by Walter Lampl's avatar Walter Lampl Committed by Marco Clemencic
Browse files

genconf: Use 'PublicToolHandle', 'PrivateToolHandle' and 'ServiceHandle'...

genconf: Use 'PublicToolHandle', 'PrivateToolHandle' and 'ServiceHandle' instead of GaudiHandleBase (same for handle-arrays)
parent 2c7e21d5
......@@ -235,6 +235,12 @@ class Configurable(ConfigMetaHelper):
def is_property_set(self, propname):
return self._descriptors[propname].__is_set__(self, type(self))
def getGaudiType(self):
return self.__component_type__
def getName(self):
return self.name
def merge(self, other):
'''
Merge the properties of the other instance into the current one.
......
......@@ -91,9 +91,12 @@ def test_parent_handling():
t = SimpleOptsAlgTool('ATool', parent=p)
assert t.name == 'Dummy.ATool'
assert t.getName() == 'Dummy.ATool'
assert t.getGaudiType() == 'AlgTool'
t = SimpleOptsAlgTool('BTool', parent='Dummy.ATool')
assert t.name == 'Dummy.ATool.BTool'
assert t.getName() == 'Dummy.ATool.BTool'
@with_setup(setup_func, teardown_func)
......
......@@ -249,7 +249,7 @@ private:
void genTrailer( std::ostream& pyOut, std::ostream& dbOut );
/// handle the "marshalling" of Properties
void pythonizeValue( const PropertyBase* prop, string& pvalue, string& ptype );
void pythonizeValue( const PropertyBase* prop, string& pvalue, string& ptype, string& ptype2 );
};
int createAppMgr();
......@@ -737,12 +737,12 @@ bool configGenerator::genComponent( const std::string& libName, const std::strin
return false;
}
string pvalue, ptype;
pythonizeValue( prop, pvalue, ptype );
string pvalue, ptype, ptype2;
pythonizeValue( prop, pvalue, ptype, ptype2 );
m_pyBuf << " '" << pname << "' : " << pvalue << ", # " << ptype << "\n";
m_db2Buf << " '" << pname << "': ('" << System::typeinfoName( *prop->type_info() ) << "', " << pvalue
<< ", '''" << prop->documentation() << " [" << prop->ownerTypeName() << "]'''";
m_db2Buf << " '" << pname << "': ('" << ptype2 << "', " << pvalue << ", '''" << prop->documentation()
<< " [" << prop->ownerTypeName() << "]'''";
auto sem = prop->semantics();
if ( !sem.empty() ) { m_db2Buf << ", '" << sem << '\''; }
m_db2Buf << "),\n";
......@@ -783,11 +783,13 @@ bool configGenerator::genComponent( const std::string& libName, const std::strin
}
//-----------------------------------------------------------------------------
void configGenerator::pythonizeValue( const PropertyBase* p, string& pvalue, string& ptype )
void configGenerator::pythonizeValue( const PropertyBase* p, string& pvalue, string& ptype, string& ptype2 )
//-----------------------------------------------------------------------------
{
const std::string cvalue = p->toString();
const std::type_index ti = std::type_index( *p->type_info() );
ptype2 = System::typeinfoName( *p->type_info() );
if ( ti == typeIndex<bool>() ) {
pvalue = ( cvalue == "0" || cvalue == "False" || cvalue == "false" ) ? "False" : "True";
ptype = "bool";
......@@ -816,6 +818,7 @@ void configGenerator::pythonizeValue( const PropertyBase* p, string& pvalue, str
pvalue = base.pythonRepr();
ptype = "GaudiHandle";
ptype2 = base.pythonPropertyClassName();
m_importGaudiHandles = true;
} else if ( ti == typeIndex<GaudiHandleArrayBase>() ) {
const GaudiHandleArrayProperty& hdl = dynamic_cast<const GaudiHandleArrayProperty&>( *p );
......@@ -823,6 +826,7 @@ void configGenerator::pythonizeValue( const PropertyBase* p, string& pvalue, str
pvalue = base.pythonRepr();
ptype = "GaudiHandleArray";
ptype2 = base.pythonPropertyClassName();
m_importGaudiHandles = true;
} else if ( ti == typeIndex<DataObjectHandleBase>() ) {
const DataObjectHandleProperty& hdl = dynamic_cast<const DataObjectHandleProperty&>( *p );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment