The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
ToolSvc::ToolList Class Reference

Common Tools. More...

Collaboration diagram for ToolSvc::ToolList:

Classes

struct  Equal
 
struct  Hash
 

Public Member Functions

void remove (IAlgTool *tool)
 
void push_back (IAlgTool *tool)
 
bool contains (std::string_view name) const
 
bool contains (IAlgTool const *tool) const
 
auto size () const
 
auto begin () const
 
auto end () const
 
auto find (std::string_view name, const IInterface *parent) const
 
std::vector< IAlgTool * > grab () &&
 

Private Attributes

std::vector< IAlgTool * > m_tools
 
std::unordered_multiset< IAlgTool *, Hash, Equalm_map
 

Detailed Description

Common Tools.

Definition at line 106 of file ToolSvc.cpp.

Member Function Documentation

◆ begin()

auto ToolSvc::ToolList::begin ( ) const
inline

Definition at line 139 of file ToolSvc.cpp.

139{ return m_tools.begin(); }
std::vector< IAlgTool * > m_tools
Definition ToolSvc.cpp:107

◆ contains() [1/2]

bool ToolSvc::ToolList::contains ( IAlgTool const * tool) const
inline

Definition at line 134 of file ToolSvc.cpp.

134 {
135 return m_tools.rend() != std::find( m_tools.rbegin(), m_tools.rend(), tool );
136 // return tool == find( tool->name(), tool->parent() ); //FIXME: is this faster?
137 }

◆ contains() [2/2]

bool ToolSvc::ToolList::contains ( std::string_view name) const
inline

Definition at line 133 of file ToolSvc.cpp.

133{ return m_map.find( name ) != m_map.end(); }
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333
std::unordered_multiset< IAlgTool *, Hash, Equal > m_map
Definition ToolSvc.cpp:119

◆ end()

auto ToolSvc::ToolList::end ( ) const
inline

Definition at line 140 of file ToolSvc.cpp.

140{ return m_tools.end(); }

◆ find()

auto ToolSvc::ToolList::find ( std::string_view name,
const IInterface * parent ) const
inline

Definition at line 141 of file ToolSvc.cpp.

141 {
142 auto range = m_map.equal_range( name );
143 auto it = std::find_if( range.first, range.second, [&]( auto const& p ) { return p->parent() == parent; } );
144 return it != range.second ? *it : nullptr;
145 }
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition details.h:86

◆ grab()

std::vector< IAlgTool * > ToolSvc::ToolList::grab ( ) &&
inline

Definition at line 146 of file ToolSvc.cpp.

146 {
147 m_map.clear();
148 auto tools = std::move( m_tools );
149 return tools;
150 }
const std::vector< IAlgTool * > & tools() const
Definition Service.cpp:411

◆ push_back()

void ToolSvc::ToolList::push_back ( IAlgTool * tool)
inline

Definition at line 128 of file ToolSvc.cpp.

128 {
129 m_tools.push_back( tool );
130 m_map.emplace( tool );
131 }

◆ remove()

void ToolSvc::ToolList::remove ( IAlgTool * tool)
inline

Definition at line 122 of file ToolSvc.cpp.

122 {
123 m_tools.erase( std::remove( std::begin( m_tools ), std::end( m_tools ), tool ), std::end( m_tools ) );
124 auto range = m_map.equal_range( tool->name() );
125 auto itm = std::find_if( range.first, range.second, [&]( auto const& p ) { return p == tool; } );
126 if ( itm != range.second ) m_map.erase( itm );
127 }

◆ size()

auto ToolSvc::ToolList::size ( ) const
inline

Definition at line 138 of file ToolSvc.cpp.

138{ return m_tools.size(); }

Member Data Documentation

◆ m_map

std::unordered_multiset<IAlgTool*, Hash, Equal> ToolSvc::ToolList::m_map
private

Definition at line 119 of file ToolSvc.cpp.

◆ m_tools

std::vector<IAlgTool*> ToolSvc::ToolList::m_tools
private

Definition at line 107 of file ToolSvc.cpp.


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