Skip to content
Snippets Groups Projects
Commit 6817d4bf authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

AsgServices: use auto-declaring interfaces

parent e7e74890
No related branches found
No related tags found
No related merge requests found
/* /*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/ */
/// @author Nils Krumnack /// @author Nils Krumnack
...@@ -38,8 +38,12 @@ namespace asg ...@@ -38,8 +38,12 @@ namespace asg
/// ///
/// Loosely based on the \ref AsgTool implementation. /// Loosely based on the \ref AsgTool implementation.
class AsgService : public virtual IAsgService, class AsgService :
public AsgServiceBase #ifndef XAOD_STANDALONE
public extends<AsgServiceBase, IAsgService>
#else
public AsgServiceBase, public virtual IAsgService
#endif
{ {
public: public:
AsgService (const std::string& name, AsgService (const std::string& name,
...@@ -60,11 +64,8 @@ namespace asg ...@@ -60,11 +64,8 @@ namespace asg
#ifndef XAOD_STANDALONE #ifndef XAOD_STANDALONE
/// query interface for gaudi
virtual StatusCode queryInterface (const InterfaceID& riid, void **ppvi);
/// list of interfaces we have
private: private:
/// list of interfaces we have
std::vector<std::pair<const InterfaceID& (*)(),void *(*)(AsgService*)>> m_interfaces; std::vector<std::pair<const InterfaceID& (*)(),void *(*)(AsgService*)>> m_interfaces;
#endif #endif
......
/* /*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/ */
/// @author Nils Krumnack /// @author Nils Krumnack
...@@ -18,13 +18,11 @@ namespace asg ...@@ -18,13 +18,11 @@ namespace asg
AsgService :: AsgService ::
AsgService( const std::string& name, AsgService( const std::string& name,
ISvcLocator* pSvcLocator ) ISvcLocator* pSvcLocator )
: AsgServiceBase(
#ifndef XAOD_STANDALONE #ifndef XAOD_STANDALONE
name, pSvcLocator : base_class(name, pSvcLocator)
#else // not XAOD_STANDALONE #else
name : AsgServiceBase(name)
#endif // not XAOD_STANDALONE #endif
)
{ {
(void) pSvcLocator; (void) pSvcLocator;
} }
...@@ -51,23 +49,4 @@ namespace asg ...@@ -51,23 +49,4 @@ namespace asg
return; return;
} }
#ifndef XAOD_STANDALONE
StatusCode AsgService ::
queryInterface (const InterfaceID& riid, void **ppvi)
{
for (const auto& interface : m_interfaces)
{
if (riid == interface.first())
{
*ppvi = interface.second (this);
addRef();
return StatusCode::SUCCESS;
}
}
return AsgServiceBase::queryInterface (riid, ppvi);
}
#endif
} // namespace asg } // namespace asg
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment