The Gaudi Framework  master (37c0b60a)
ToolSvc::ToolList Class Reference

Common Tools. More...

Collaboration diagram for ToolSvc::ToolList:

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_multimap< std::string_view, IAlgTool * > m_map
 

Detailed Description

Common Tools.

Definition at line 112 of file ToolSvc.cpp.

Member Function Documentation

◆ begin()

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

Definition at line 157 of file ToolSvc.cpp.

157 { return m_tools.begin(); }

◆ contains() [1/2]

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

Definition at line 152 of file ToolSvc.cpp.

152  {
153  return m_tools.rend() != std::find( m_tools.rbegin(), m_tools.rend(), tool );
154  // return tool == find( tool->name(), tool->parent() ); //FIXME: is this faster?
155  }

◆ contains() [2/2]

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

Definition at line 151 of file ToolSvc.cpp.

151 { return m_map.find( name ) != m_map.end(); }

◆ end()

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

Definition at line 158 of file ToolSvc.cpp.

158 { return m_tools.end(); }

◆ find()

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

Definition at line 159 of file ToolSvc.cpp.

159  {
160  auto range = m_map.equal_range( name );
161 #ifdef __cpp_lib_generic_unordered_lookup
162  auto it = std::find_if( range.first, range.second, [&]( auto const& p ) { return p->parent() == parent; } );
163  return it != range.second ? *it : nullptr;
164 #else
165  auto it =
166  std::find_if( range.first, range.second, [&]( auto const& p ) { return p.second->parent() == parent; } );
167  return it != range.second ? it->second : nullptr;
168 #endif
169  }

◆ grab()

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

Definition at line 170 of file ToolSvc.cpp.

170  {
171  m_map.clear();
172  auto tools = std::move( m_tools );
173  return tools;
174  }

◆ push_back()

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

Definition at line 142 of file ToolSvc.cpp.

142  {
144 #ifdef __cpp_lib_generic_unordered_lookup
145  m_map.emplace( tool );
146 #else
147  m_map.emplace( tool->name(), tool );
148 #endif
149  }

◆ remove()

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

Definition at line 132 of file ToolSvc.cpp.

132  {
134  auto range = m_map.equal_range( tool->name() );
135 #ifdef __cpp_lib_generic_unordered_lookup
136  auto itm = std::find_if( range.first, range.second, [&]( auto const& p ) { return p == tool; } );
137 #else
138  auto itm = std::find_if( range.first, range.second, [&]( auto const& p ) { return p.second == tool; } );
139 #endif
140  if ( itm != range.second ) m_map.erase( itm );
141  }

◆ size()

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

Definition at line 156 of file ToolSvc.cpp.

156 { return m_tools.size(); }

Member Data Documentation

◆ m_map

std::unordered_multimap<std::string_view, IAlgTool*> ToolSvc::ToolList::m_map
private

Definition at line 128 of file ToolSvc.cpp.

◆ m_tools

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

Definition at line 113 of file ToolSvc.cpp.


The documentation for this class was generated from the following file:
std::move
T move(T... args)
std::find
T find(T... args)
std::vector::size
T size(T... args)
std::unordered_multimap::emplace
T emplace(T... args)
ToolSvc::ToolList::m_map
std::unordered_multimap< std::string_view, IAlgTool * > m_map
Definition: ToolSvc.cpp:128
std::unordered_multimap::clear
T clear(T... args)
std::vector::push_back
T push_back(T... args)
Service::tools
const std::vector< IAlgTool * > & tools() const
Definition: Service.cpp:409
bug_34121.tool
tool
Definition: bug_34121.py:18
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:332
std::vector::erase
T erase(T... args)
std::remove
T remove(T... args)
std::vector::rend
T rend(T... args)
std::unordered_multimap::equal_range
T equal_range(T... args)
std::vector::begin
T begin(T... args)
std::unordered_multimap::end
T end(T... args)
ToolSvc::ToolList::m_tools
std::vector< IAlgTool * > m_tools
Definition: ToolSvc.cpp:113
std::vector::rbegin
T rbegin(T... args)
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: details.h:97