The Gaudi Framework  master (37c0b60a)
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 More...
 
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. More...
 

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 69 of file RenounceToolInputsVisitor.h.

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

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 59 of file RenounceToolInputsVisitor.h.

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

◆ 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 }

Member Data Documentation

◆ m_logger

ILogger* RenounceToolInputsVisitor::m_logger
private

Definition at line 78 of file RenounceToolInputsVisitor.h.

◆ m_renounceKeys

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

Definition at line 77 of file RenounceToolInputsVisitor.h.

◆ USAGE_IS_THREAD_SAFE

NoLogger s_noLogger RenounceToolInputsVisitor::USAGE_IS_THREAD_SAFE
staticprivate

Definition at line 80 of file RenounceToolInputsVisitor.h.


The documentation for this class was generated from the following files:
IDataHandleHolder
Definition: IDataHandleHolder.h:24
RenounceToolInputsVisitor::m_renounceKeys
std::vector< DataObjID > m_renounceKeys
Definition: RenounceToolInputsVisitor.h:77
RenounceToolInputsVisitor::m_logger
ILogger * m_logger
Definition: RenounceToolInputsVisitor.h:78
std::move
T move(T... args)
RenounceToolInputsVisitor::ILogger::renounce
virtual void renounce(std::string_view tool_name, std::string_view key)=0
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
cpluginsvc.func
func
Definition: cpluginsvc.py:235
DataObjID
Definition: DataObjID.h:47
IDataHandleHolder::renounceInput
virtual bool renounceInput(const DataObjID &)=0
Gaudi::PluginService::v1::Details::logger
GAUDIPS_API Logger & logger()
Return the current logger instance.
Definition: PluginServiceV1.cpp:318