The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
RenounceToolInputsVisitor Class Reference

Helper class to be used in conjunction with the recursive tool visitor to renounce certain inputs. More...

#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/RenounceToolInputsVisitor.h>

Collaboration diagram for RenounceToolInputsVisitor:

Classes

struct  ILogger
 Helper class interface to optionally log renounce operations. More...
 
class  Logger
 
struct  NoLogger
 A do-nothing helper class which implements the logger interface. More...
 

Public Member Functions

 RenounceToolInputsVisitor (std::vector< DataObjID > input_keys, ILogger &logger=s_noLogger)
 construct the renounce visitor helper object
 
void operator() (IAlgTool *)
 

Static Public Member Functions

static Logger createLogger (std::function< void(std::string_view, std::string_view)> func)
 Create a logger from a function.
 

Private Attributes

std::vector< DataObjIDm_renounceKeys
 
ILoggerm_logger
 

Static Private Attributes

static NoLogger s_noLogger USAGE_IS_THREAD_SAFE
 

Detailed Description

Helper class to be used in conjunction with the recursive tool visitor to renounce certain inputs.

Definition at line 27 of file RenounceToolInputsVisitor.h.

Constructor & Destructor Documentation

◆ RenounceToolInputsVisitor()

RenounceToolInputsVisitor::RenounceToolInputsVisitor ( std::vector< DataObjID > input_keys,
ILogger & logger = s_noLogger )
inline

construct the renounce visitor helper object

Parameters
input_keysa list of input keys to be renounced. @parame logger optional helper object to log inputs which are renounced. By default this renounce visitor will renounce inputs with keys found in the inputs_names list, and it operates silently.

Definition at line 68 of file RenounceToolInputsVisitor.h.

69 : m_renounceKeys( std::move( input_keys ) )
70 , m_logger( &logger ) // @TODO possible source of use after delete
71 {}
std::vector< DataObjID > m_renounceKeys

Member Function Documentation

◆ createLogger()

static Logger RenounceToolInputsVisitor::createLogger ( std::function< void(std::string_view, std::string_view)> func)
inlinestatic

Create a logger from a function.

usage:

* auto logger=RenounceToolInputsVisitor::createLogger( [this]( std::string_view tool_name, std::string_view key )
* { this->msg(MSG::INFO) << " Renounce " << tool_name << " . " << key << endmsg;
*                                                       });
* 

Definition at line 58 of file RenounceToolInputsVisitor.h.

58 {
59 return Logger{ std::move( func ) };
60 }

◆ operator()()

void RenounceToolInputsVisitor::operator() ( IAlgTool * alg_tool)

Definition at line 15 of file RenounceToolInputsVisitor.cpp.

15 {
16 IDataHandleHolder* dh_holder = dynamic_cast<IDataHandleHolder*>( alg_tool );
17 if ( dh_holder ) {
18 for ( const DataObjID& id : m_renounceKeys ) {
19 if ( dh_holder->renounceInput( id ) ) { m_logger->renounce( alg_tool->name(), id.key() ); }
20 }
21 }
22}
virtual bool renounceInput(const DataObjID &)=0
virtual const std::string & name() const =0
Retrieve the name of the instance.

Member Data Documentation

◆ m_logger

ILogger* RenounceToolInputsVisitor::m_logger
private

Definition at line 77 of file RenounceToolInputsVisitor.h.

◆ m_renounceKeys

std::vector<DataObjID> RenounceToolInputsVisitor::m_renounceKeys
private

Definition at line 76 of file RenounceToolInputsVisitor.h.

◆ USAGE_IS_THREAD_SAFE

NoLogger s_noLogger RenounceToolInputsVisitor::USAGE_IS_THREAD_SAFE
staticprivate

Definition at line 79 of file RenounceToolInputsVisitor.h.


The documentation for this class was generated from the following files: