The Gaudi Framework  master (1304469f)
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 112 of file ToolSvc.cpp.

Member Function Documentation

◆ begin()

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

Definition at line 145 of file ToolSvc.cpp.

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

◆ contains() [1/2]

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

Definition at line 140 of file ToolSvc.cpp.

140 {
141 return m_tools.rend() != std::find( m_tools.rbegin(), m_tools.rend(), tool );
142 // return tool == find( tool->name(), tool->parent() ); //FIXME: is this faster?
143 }

◆ contains() [2/2]

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

Definition at line 139 of file ToolSvc.cpp.

139{ 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:125

◆ end()

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

Definition at line 146 of file ToolSvc.cpp.

146{ return m_tools.end(); }

◆ find()

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

Definition at line 147 of file ToolSvc.cpp.

147 {
148 auto range = m_map.equal_range( name );
149 auto it = std::find_if( range.first, range.second, [&]( auto const& p ) { return p->parent() == parent; } );
150 return it != range.second ? *it : nullptr;
151 }
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition details.h:81

◆ grab()

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

Definition at line 152 of file ToolSvc.cpp.

152 {
153 m_map.clear();
154 auto tools = std::move( m_tools );
155 return tools;
156 }
const std::vector< IAlgTool * > & tools() const
Definition Service.cpp:411

◆ push_back()

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

Definition at line 134 of file ToolSvc.cpp.

134 {
135 m_tools.push_back( tool );
136 m_map.emplace( tool );
137 }

◆ remove()

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

Definition at line 128 of file ToolSvc.cpp.

128 {
129 m_tools.erase( std::remove( std::begin( m_tools ), std::end( m_tools ), tool ), std::end( m_tools ) );
130 auto range = m_map.equal_range( tool->name() );
131 auto itm = std::find_if( range.first, range.second, [&]( auto const& p ) { return p == tool; } );
132 if ( itm != range.second ) m_map.erase( itm );
133 }

◆ size()

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

Definition at line 144 of file ToolSvc.cpp.

144{ return m_tools.size(); }

Member Data Documentation

◆ m_map

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

Definition at line 125 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: