Skip to content

Allow for empty ToolHandle properties

Frank Winklmeier requested to merge fwinkl/Gaudi:gaudi_empty_toolhandle into master

It is sometimes useful to declare an empty ToolHandle (e.g. ToolHandle<IMyTool>("", parent)) in case the tool is optional (e.g. a monitoring tool that is only attached to an algorithm for validation purposes). This is no longer possible with the auto-declaring ToolHandle (see !374 (merged)) as the following

ToolHandle<IMyTool> m_tool{this, "MyTool", "", "my tool"}

would create a tool of type/name "MyTool". With this change the empty type/name is respected and an empty ToolHandle is created. The third parameter now becomes mandatory, i.e. the following is no longer allowed:

ToolHandle<IMyTool> m_tool{this, "MyTool"}

which is probably a good idea as it seems unnecessary to couple a tool type/name to the property name (and in fact I didn't find a single instance in the Gaudi code where the third parameter was omitted). If people feel strongly we can of course create an overload that brings this form back.

Other change:

  • Add legacy property to one of the examples to make sure we are compiling the old-style declareProperty-ToolHandle at least once.
Edited by Frank Winklmeier

Merge request reports

Loading