Skip to content

GMR-385: Allow for empty ToolHandle properties

Charles Leggett requested to merge leggett/AtlasGaudi:dev/GMR-385 into atlas/v28r2

see gaudi/Gaudi!385 (merged)

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 gaudi/Gaudi!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.

Merge request reports