26 const std::string& condition_string ) {
28 std::stringstream msg;
29 msg <<
"Conditoin Failed: " << file_name <<
":" << line_no <<
" " << condition_string;
30 throw std::runtime_error( msg.str() );
35 std::string::size_type pos = full_name.rfind(
"." );
36 std::string::size_type pos2 = full_name.rfind(
"/" );
37 if ( pos == std::string::npos ) {
39 }
else if ( pos2 > pos ) {
42 return pos != std::string::npos ? full_name.substr( pos + 1 ) : full_name;
55 DEBUG_TRACE( std::cout <<
"DEBUG " <<
name() <<
" setDefaults" << base_name << std::endl; );
56 if ( base_name ==
"tool1" ) {
59 }
else if ( base_name ==
"tool2" ) {
63 }
else if ( base_name ==
"tool3" ) {
68 }
else if ( base_name ==
"tool4" ) {
72 }
else if ( base_name ==
"tool5" || base_name ==
"tool5Bug" ) {
77 }
else if ( base_name ==
"tool6" ) {
82 <<
", data handles:" <<
m_handles.size() << std::endl );
87 void renounce( [[maybe_unused]] std::string_view tool, [[maybe_unused]] std::string_view input )
override {
88 DEBUG_TRACE( std::cout <<
"renounce " << tool <<
" . " << input << std::endl );
93 m_keys.emplace_back( key );
98 m_keys.emplace_back( key );
107 DEBUG_TRACE( std::cout <<
"DEBUG " <<
name() <<
" initialize." << std::endl );
110 DEBUG_TRACE( std::cout <<
name() <<
" tool:" << handle.typeAndName() << std::endl );
111 handle.retrieve().ignore();
113 if ( base_name ==
"tool5" ) {
115 return data.mode() == Gaudi::DataHandle::Writer && data.objKey() ==
"Renounce";
120 <<
"Renounce" << std::endl );
122 ToolVisitor::visit(
tools(), visitor );
126 <<
", data handles:" <<
m_handles.size() << std::endl );
139 DEBUG_TRACE( std::cout <<
"DEBUG TestAlg ctor " <<
name() << std::endl );
141 addTool(
"GaudiTesting::TestTool/tool5Bug" );
144 addTool(
"GaudiTesting::TestTool/tool5" );
150 DEBUG_TRACE( std::cout <<
name() <<
" tool:" << handle.typeAndName() << std::endl );
156 void dumpData(
const std::string& pattern )
const {
157 auto dumper = [&pattern](
const IAlgTool* tool ) {
161 if ( handle->objKey().find( pattern ) != std::string::npos ) {
162 DEBUG_TRACE( std::cout <<
"DEBUG input Handle " << tool->name() <<
" . " << handle->objKey()
167 if ( handle->objKey().find( pattern ) != std::string::npos ) {
168 DEBUG_TRACE( std::cout <<
"DEBUG output Handle " << tool->name() <<
" . " << handle->objKey()
173 if ( elm.key().find( pattern ) != std::string::npos ) {
174 DEBUG_TRACE( std::cout <<
"DEBUGinput Handle " << tool->name() <<
" . " << elm.key() << std::endl );
179 ToolVisitor::visit(
tools(), dumper );
185 DEBUG_TRACE( std::cout <<
"DEBUG " <<
name() <<
" input:" << const_obj_id.key() << std::endl );
188 DEBUG_TRACE( std::cout <<
"DEBUG " <<
name() <<
" output:" << const_obj_id.key() << std::endl );
bool PyHelper setProperty(IInterface *p, char *name, char *value)
#define DECLARE_COMPONENT(type)
const DataObjIDColl & outputDataObjs() const override
std::vector< Gaudi::DataHandle * > inputHandles() const override
void declare(Gaudi::DataHandle &handle) override
std::vector< Gaudi::DataHandle * > outputHandles() const override
const DataObjIDColl & inputDataObjs() const override
const std::vector< IAlgTool * > & tools() const
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
StatusCode declareTool(ToolHandle< T > &handle, bool createIf=true)
const std::string & name() const override
The identifying name of the algorithm object.
void addTool(const std::string &name)
StatusCode execute() override
StatusCode finalize() override
StatusCode initialize() override
std::deque< ToolHandle< ITestTool > > m_algTools
TestAlg(const std::string &aname, ISvcLocator *svc_Locator)
void dumpData(const std::string &pattern) const
Definition of the basic interface.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
Base class used to extend a class implementing other interfaces.
void throwConditionFailed(bool condition, const std::string &file_name, int line_no, const std::string &condition_string)
std::string extractBaseName(const std::string &full_name)