Commit 006270f9 authored by Scott Snyder's avatar Scott Snyder Committed by Graeme Stewart
Browse files

Migrate AlgTool -> AthAlgTool. (AraTool-00-02-07)

parent 063cd93c
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef AraTool_ARAALGTOOLWRAPPER_H
#define AraTool_ARAALGTOOLWRAPPER_H
#include "AraTool/IAraAlgTool.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/MsgStream.h"
#include <string>
/////////////////////////////////////////////////////////////////////////////
//namespace ToolSpace {
template< class T >
class AraAlgToolWrapper : virtual public IAraAlgTool, virtual public AthAlgTool {
public:
AraAlgToolWrapper( const std::string&, const std::string&, const IInterface* );
// to allow access to the IAraAlgTool interface
StatusCode queryInterface( const InterfaceID& riid, void** ppvIf );
// setup/teardown functions, similar like those for Algorithm/Service
StatusCode initialize();
StatusCode finalize();
// the magic method this tool provides
// virtual StatusCode performTask( double& result );
public:
// to resolve possible conflicts with IProperty::interfaceID()
static const InterfaceID& interfaceID() { return IAraAlgTool::interfaceID(); }
T *operator->() const {
return m_ptool;
}
T* getTool() {return m_ptool;}
private:
T *m_ptool;
private:
MsgStream m_log;
private:
double m_factor;
};
//}
#include "AraAlgToolWrapper.icc"
#endif // !AraTool_ARAALGTOOLWRAPPER_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "GaudiKernel/PropertyMgr.h"
/////////////////////////////////////////////////////////////////////////////
template< class T >
AraAlgToolWrapper< T >::AraAlgToolWrapper( const std::string& type, const std::string& name,
const IInterface* parent )
: AthAlgTool( type, name, parent ), m_log( msgSvc(), name )
{
m_ptool=new T(getPropertyMgr());
}
//___________________________________________________________________________
template< class T >
StatusCode AraAlgToolWrapper< T >::queryInterface( const InterfaceID& riid, void** ppvIf )
{
if ( riid == IAraAlgTool::interfaceID() ) {
*ppvIf = (IAraAlgTool*)this;
addRef();
return StatusCode::SUCCESS;
}
return AthAlgTool::queryInterface( riid, ppvIf );
}
//___________________________________________________________________________
template< class T>
StatusCode AraAlgToolWrapper< T >::initialize()
{
m_log.setLevel( outputLevel() );
StatusCode sc=m_ptool->initialize();
return sc;
}
//___________________________________________________________________________
template< class T >
StatusCode AraAlgToolWrapper< T >::finalize()
{
// perform work done at shutdown
StatusCode sc=m_ptool->finalize();
return sc;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ARATOOLBASE_H
#define ARATOOLBASE_H
#include "GaudiKernel/Property.h"
#include "GaudiKernel/PropertyMgr.h"
#include "GaudiKernel/IAlgTool.h"
#include <string>
class AraToolBase
{
protected:
PropertyMgr *m_propertyMgr;
bool RunningARA;
public:
AraToolBase(PropertyMgr * pmgr=0);
virtual ~AraToolBase();
template<class TYPE>
Property* declareProperty
( const std::string& name ,
TYPE& value,
const std::string& doc = "none" ) ;
PropertyMgr* getPropertyMgr() {return m_propertyMgr;}
public:
};
template<class TYPE>
inline Property *
AraToolBase::declareProperty
( const std::string& name ,
TYPE& value,
const std::string& doc )
{
if(RunningARA) {
} else {
return m_propertyMgr->declareProperty(name, value, doc);
}
return 0;
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef AraTool_IARAALGTOOL_H
#define AraTool_IARAALGTOOL_H
#include "GaudiKernel/IAlgTool.h"
/////////////////////////////////////////////////////////////////////////////
class IAraAlgTool : virtual public IAlgTool {
public:
static const InterfaceID& interfaceID();
};
#endif // !AraTool_IARAALGTOOL_H
package AraTool
author Yushu Yao <yyao@lbl.gov>
use AtlasPolicy AtlasPolicy-*
use GaudiInterface GaudiInterface-* External
use AtlasROOT AtlasROOT-* External
use AtlasPython AtlasPython-* External
use AthenaBaseComps AthenaBaseComps-* Control
apply_pattern installed_library
library AraTool *.cxx
apply_pattern declare_python_modules files="*.py"
use AtlasReflex AtlasReflex-* External -no_auto_imports
#apply_pattern lcgdict dict=AraTool \
# selectionfile="selection.xml" \
# headerfiles="../AraTool/AraToolDict.h"
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
## @file __init__.py
## Hook for the AraTool py-module
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "AraTool/AraToolBase.h"
AraToolBase::AraToolBase(PropertyMgr *pmgr)
:m_propertyMgr(pmgr),RunningARA(false)
{
if(!m_propertyMgr) {
RunningARA=true;
}
}
AraToolBase::~AraToolBase()
{
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "AraTool/IAraAlgTool.h"
/////////////////////////////////////////////////////////////////////////////
static const InterfaceID IAraAlgToolID_( "IAraAlgTool", 1, 0 );
const InterfaceID& IAraAlgTool::interfaceID() {
return IAraAlgToolID_;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment