Commit 785e13da authored by Nils Krumnack's avatar Nils Krumnack

update conditional compilation to use XAOD_STANDALONE

There was a large number of conditional compilation
macros/definitions, but there are only two or three separate cases
that are already covered by other macros, so I'm using those.
parent a33f6b28
# this makefile also gets parsed by shell scripts
# therefore it does not support full make syntax and features
# edit with care
# for full documentation check:
# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile
PACKAGE = AsgExampleTools
PACKAGE_PRELOAD =
PACKAGE_CXXFLAGS =
PACKAGE_OBJFLAGS = -DASGTOOL_STANDALONE -DASGTOOL_NOTEVENT
PACKAGE_LDFLAGS =
PACKAGE_BINFLAGS =
PACKAGE_LIBFLAGS =
PACKAGE_DEP = AsgTools
PACKAGE_TRYDEP =
PACKAGE_CLEAN =
PACKAGE_NOGRID =
PACKAGE_PEDANTIC = 1
PACKAGE_NOOPT = 0
PACKAGE_NOCC = 0
PACKAGE_REFLEX = 1
#PACKAGE_SRCFILES = $(wildcard ../src/*.cxx) $(wildcard ../src/standalone/*.cxx)
PACKAGE_PRGDIR = ../utils
include $(ROOTCOREDIR)/Makefile-common
package AsgExampleTools
author David Adams
public
use AtlasPolicy AtlasPolicy-*
use AsgTools AsgTools-* Control/AthToolSupport
private
use AthenaBaseComps AthenaBaseComps-* Control
use GaudiInterface GaudiInterface-* External
end_private
apply_pattern dual_use_library files="*.cxx ../Root/AsgHelloTool.cxx ../Root/UnitTestTool1.cxx ../Root/UnitTestTool2.cxx ../Root/UnitTestTool3.cxx ../Root/UnitTestTool1A.cxx"
private
# make the unit tests work
use TestTools TestTools-* AtlasTest
use AtlasGoogleTest AtlasGoogleTest-* External
apply_pattern UnitTest_run unit_test=gt_ToolHandle
apply_pattern UnitTest_run unit_test=gt_AnaToolHandle
macro_append all_dependencies " check "
macro_append gt_ToolHandle_test_dependencies " AsgExampleTools AsgExampleToolsMergeComponentsList "
macro_append gt_AnaToolHandle_test_dependencies " AsgExampleTools AsgExampleToolsMergeComponentsList "
# keep the debugging symbols
macro SEPARATEDEBUG ""
......@@ -11,7 +11,7 @@
using namespace testing;
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
struct ToolHandleTest : public Test
{
......
......@@ -9,14 +9,13 @@
#include <string>
// Local include(s):
#include "AsgMessaging/AsgMessagingConf.h"
#include "AsgMessaging/MsgStream.h"
#include "AsgMessaging/MsgStreamMacros.h"
// Gaudi/Athena include(s):
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
# include "AthenaBaseComps/AthMessaging.h"
#endif // ASGTOOL_ATHENA
#endif // not XAOD_STANDALONE
namespace asg {
......@@ -33,9 +32,9 @@ namespace asg {
/// $Date: 2014-09-09 16:27:03 +0200 (Tue, 09 Sep 2014) $
///
class AsgMessaging
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
: public ::AthMessaging
#endif // ASGTOOL_ATHENA
#endif // not XAOD_STANDALONE
{
public:
/// Constructor with a name
......@@ -69,10 +68,10 @@ namespace asg {
/// @}
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
private:
mutable MsgStream m_msg; ///< Message stream to be used by the object
#endif // ASGTOOL_STANDALONE
#endif // XAOD_STANDALONE
}; // class AsgMessaging
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef AsgMessagingConf_H
#define AsgMessagingConf_H
// Configuration file for the ASG tool environment.
// Flags:
// ASGTOOL_STANDALONE - Flag indicating that the base standalone ASG tool
// environment is to be provided.
// ASGTOOL_ATHENA - Flag indicating that the Athena ASG tool environment
// is to be provided.
// ASGTOOL_TEVENT - Flag indicating that TEvent is available in standalone.
// If this is not set, calls to the event store will fail. This flag is
// se unless the user sets ASGTOOL_NOTEVENT.
#if !defined(ASGTOOL_STANDALONE) && !defined(ASGTOOL_ATHENA)
#ifdef XAOD_STANDALONE
#define ASGTOOL_STANDALONE
#ifndef ASGTOOL_NOTEVENT
#define ASGTOOL_TEVENT
#endif
#else
#define ASGTOOL_ATHENA
#endif
#endif
#if defined(ASGTOOL_STANDALONE) && defined(ASGTOOL_ATHENA)
#error "Only one of ASGTOOL_STANDALONE and ASGTOOL_ATHENA may be defined."
#endif
#endif
......@@ -6,7 +6,6 @@
#define ASGMESSAGING_CHECK_H
// Local include(s):
#include "AsgMessaging/AsgMessagingConf.h"
#include "AsgMessaging/MsgStreamMacros.h"
/// Helper macro for checking the status code returned by a function call
......@@ -59,7 +58,7 @@
} while( 0 )
/// In standalone mode use the ASG specific macro as a replacement for ATH_CHECK
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
# define ATH_CHECK( EXP ) ASG_CHECK( EXP )
#else
# include "AthenaBaseComps/AthCheckMacros.h"
......
......@@ -16,10 +16,9 @@
#include <string>
// Local include(s):
#include "AsgMessaging/AsgMessagingConf.h"
// Pull in the definition from Gaudi in Athena:
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
# include "GaudiKernel/IMessageSvc.h"
#endif
......@@ -28,7 +27,7 @@
namespace MSG {
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
/// Message level definitions
enum Level {
......@@ -43,7 +42,7 @@ namespace MSG {
NUM_LEVELS
}; // enum Level
#endif // ASGTOOL_STANDALONE
#endif // XAOD_STANDALONE
/// Convenience function for translating message levels to strings
const std::string& name( Level lvl );
......
......@@ -10,13 +10,12 @@
#include <sstream>
// Local include(s):
#include "AsgMessaging/AsgMessagingConf.h"
#include "AsgMessaging/MsgLevel.h"
#include "AsgMessaging/INamedInterface.h"
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
# include "GaudiKernel/MsgStream.h"
#elif defined(ASGTOOL_STANDALONE)
#else // not XAOD_STANDALONE
/// A replacement of Gaudi's MsgStream class for ROOT analysis
///
......@@ -119,7 +118,5 @@ declarePropertyFor (T& parent)
/// Backwards compatibility definition
#define endreq endmsg
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // not XAOD_STANDALONE
#endif // ASGMESSAGING_MSGSTREAM_H
......@@ -6,13 +6,12 @@
#define ASGMESSAGING_MSGSTREAMMACROS_H
// Local include(s):
#include "AsgMessaging/AsgMessagingConf.h"
#include "AsgMessaging/MsgLevel.h"
// Pull in the definition from Athena:
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
# include "AthenaBaseComps/AthMsgStreamMacros.h"
#elif defined(ASGTOOL_STANDALONE)
#else // not XAOD_STANDALONE
// Not sure why this is needed...
#undef ERROR
......@@ -65,7 +64,5 @@
/// Macro printing messages that should always appear
#define ATH_MSG_ALWAYS( xmsg ) ATH_MSG_LVL_NOCHK( MSG::ALWAYS, xmsg )
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // not XAOD_STANDALONE
#endif // ASGMESSAGING_MSGSTREAMMACROS_H
......@@ -6,13 +6,12 @@
#define ASGMESSAGING_STATUSCODE_H
// Local include(s):
#include "AsgMessaging/AsgMessagingConf.h"
#include "AsgMessaging/Check.h"
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
// Pull in the definition from Gaudi:
# include "GaudiKernel/StatusCode.h"
#elif defined(ASGTOOL_STANDALONE)
#else // not XAOD_STANDALONE
/// Partial reimplementation of Gaudi's StatusCode for standalone usage
///
......@@ -73,5 +72,5 @@ private:
}; // class StatusCode
#endif // Environment selection
#endif // not XAOD_STANDALONE
#endif // ASGMESSAGING_STATUSCODE_H
......@@ -6,71 +6,61 @@
#include "AsgMessaging/AsgMessaging.h"
// Gaudi/Athena include(s):
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
# include "GaudiKernel/Bootstrap.h"
# include "GaudiKernel/ISvcLocator.h"
# include "GaudiKernel/IMessageSvc.h"
#endif // ASGTOOL_ATHENA
#endif // not XAOD_STANDALONE
namespace asg {
AsgMessaging::AsgMessaging( const std::string& name )
:
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
AthMessaging( Gaudi::svcLocator()->service< IMessageSvc >( "MessageSvc", false ),
name )
#elif defined(ASGTOOL_STANDALONE)
#else // not XAOD_STANDALONE
m_msg( name )
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // not XAOD_STANDALONE
{
}
AsgMessaging::AsgMessaging( const INamedInterface* tool )
:
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
AthMessaging( Gaudi::svcLocator()->service< IMessageSvc >( "MessageSvc", false ),
tool->name() )
#elif defined(ASGTOOL_STANDALONE)
#else // not XAOD_STANDALONE
m_msg( tool )
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // not XAOD_STANDALONE
{
}
bool AsgMessaging::msgLvl( const MSG::Level lvl ) const {
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
return ::AthMessaging::msgLvl( lvl );
#elif defined(ASGTOOL_STANDALONE)
#else // not XAOD_STANDALONE
return m_msg.msgLevel( lvl );
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // not XAOD_STANDALONE
}
MsgStream& AsgMessaging::msg() const {
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
return ::AthMessaging::msg();
#elif defined(ASGTOOL_STANDALONE)
#else // not XAOD_STANDALONE
return m_msg;
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // not XAOD_STANDALONE
}
MsgStream& AsgMessaging::msg( const MSG::Level lvl ) const {
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
return ::AthMessaging::msg( lvl );
#elif defined(ASGTOOL_STANDALONE)
#else // not XAOD_STANDALONE
m_msg << lvl;
return m_msg;
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // not XAOD_STANDALONE
}
} // namespace asg
......@@ -111,7 +111,7 @@ namespace asg
#ifndef ASGTOOL_STANDALONE
#ifndef XAOD_STANDALONE
#define ATLAS_GOOGLE_TEST_MAIN \
int main (int argc, char **argv) \
......
......@@ -12,6 +12,7 @@
// #warning "use of this file is deprecated, please include the header from AsgMessaging instead"
#include <AsgMessaging/AsgMessaging.h>
#include <AsgTools/AsgToolsConf.h>
#include <AsgTools/IAsgTool.h>
#endif
......@@ -12,5 +12,6 @@
// #warning "use of this file is deprecated, please include the header from AsgMessaging instead"
#include <AsgMessaging/AsgMessagingForward.h>
#include <AsgTools/AsgToolsConf.h>
#endif
......@@ -7,26 +7,24 @@
// Local include(s):
#include "AsgTools/AsgTool.h"
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
# include "AsgTools/SgTEventMeta.h"
# include "xAODRootAccess/TVirtualIncidentListener.h"
#elif defined(ASGTOOL_ATHENA)
#else // XAOD_STANDALONE
# include "GaudiKernel/IIncidentListener.h"
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // XAOD_STANDALONE
// Forward declaration(s):
class Incident;
namespace asg {
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
/// Typedef masquerading the standalone code as if it were Gaudi code
typedef xAOD::TVirtualIncidentListener IIncidentListener;
/// Typedef masquerading the standalone code as if it were Gaudi code
typedef xAOD::TIncident Incident;
#endif // ASGTOOL_STANDALONE
#endif // XAOD_STANDALONE
/// Base class for dual-use tools that provide file metadata access
///
......@@ -58,19 +56,17 @@ namespace asg {
/// @name Definition of the StoreGate-like object's definition
/// @{
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
/// Type of the metadata store object in standalone mode
typedef SgTEventMeta MetaStore_t;
/// Type of the metadata store pointer in standalone mode
typedef SgTEventMeta* MetaStorePtr_t;
#elif defined(ASGTOOL_ATHENA)
#else // XAOD_STANDALONE
/// Type of the metadata store object in Athena
typedef ServiceHandle< StoreGateSvc > MetaStore_t;
/// Type of the metadata store pointer in standalone mode
typedef ServiceHandle< StoreGateSvc >& MetaStorePtr_t;
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // XAOD_STANDALONE
/// @}
......
......@@ -5,7 +5,7 @@
#ifndef ASGTOOLS_ASGMETADATATOOL_ICC
#define ASGTOOLS_ASGMETADATATOOL_ICC
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
// Athena EDM include(s):
#include "IOVDbDataModel/IOVMetaDataContainer.h"
......@@ -51,7 +51,7 @@ namespace asg {
} // namespace asg
#elif defined(ASGTOOL_STANDALONE)
#else // not XAOD_STANDALONE
namespace asg {
......
......@@ -6,35 +6,30 @@
#define ASGTOOLS_ASGTOOL_H
// Local include(s):
#include "AsgMessaging/AsgMessagingConf.h"
#include "AsgTools/IAsgTool.h"
#include "AsgMessaging/MsgLevel.h"
#include "AsgMessaging/MessageCheck.h"
// Environment specific include(s):
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
# include "AsgMessaging/AsgMessaging.h"
# include "AsgTools/SgTEvent.h"
// Forward declaration(s):
class Property;
class PropertyMgr;
#elif defined(ASGTOOL_ATHENA)
#else // XAOD_STANDALONE
# include "AthenaBaseComps/AthAlgTool.h"
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // XAOD_STANDALONE
namespace asg {
// Declare the type name of AsgTool's base class
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
typedef ::AthAlgTool AsgToolBase;
#elif defined(ASGTOOL_STANDALONE)
#else // not XAOD_STANDALONE
typedef AsgMessaging AsgToolBase;
#else
# error "What environment are we in?!?"
#endif // Environment selection
#endif // not XAOD_STANDALONE
/// Base class for the dual-use tool implementation classes
///
......@@ -58,7 +53,7 @@ namespace asg {
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
/// Stand-alone, StoreGate-like accessor to the event store
SgTEvent* evtStore() const;
......@@ -95,14 +90,14 @@ namespace asg {
/// @}
#endif // ASGTOOL_STANDALONE
#endif // XAOD_STANDALONE
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
public:
/// Pull in the usage of the base class's getProperty function
using ::AthAlgTool::getProperty;
#endif // ASGTOOL_ATHENA
#endif // not XAOD_STANDALONE
/// @name Additional helper functions, not directly mimicking Athena
/// @{
......@@ -127,11 +122,11 @@ namespace asg {
virtual void print() const;
private:
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
std::string m_name; ///< The name of the tool instance
PropertyMgr* m_ppropmgr; ///< Standalone property manager
mutable SgTEvent m_event; ///< Wrapper around TEvent/TStore
#endif // ASGTOOL_STANDALONE
#endif // XAOD_STANDALONE
}; // class AsgTool
......
......@@ -5,7 +5,7 @@
#ifndef ASGTOOLS_ASGTOOL_ICC
#define ASGTOOLS_ASGTOOL_ICC
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
// Local include(s):
#include "AsgTools/PropertyMgr.h"
......@@ -53,9 +53,9 @@ namespace asg {
} // namespace asg
#endif // ASGTOOL_STANDALONE
#endif // XAOD_STANDALONE
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
// Gaudi/Athena include(s):
#include "GaudiKernel/Property.h"
......@@ -88,6 +88,6 @@ namespace asg {
} // namespace asg
#endif // ASGTOOL_ATHENA
#endif // not XAOD_STANDALONE
#endif // not ASGTOOLS_ASGTOOL_ICC
......@@ -10,7 +10,7 @@
//
// CPP macros that turn ASG tools into Athena tools.
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
// This is used in the body of the tool interface class declaration, e.g.
// class MyToolInterface:
......
......@@ -5,12 +5,30 @@
#ifndef FILE_AsgTools_AsgToolsConf_h
#define FILE_AsgTools_AsgToolsConf_h
// this file is likely used in a variety of places, so this warning is
// disabled in 21.2. once this gets swept to master it may be a good
// idea to include this warning and remove all the users.
// Configuration file for the ASG tool environment.
// #warning "use of this file is deprecated, please include the header from AsgMessaging instead"
// Flags:
// ASGTOOL_STANDALONE - Flag indicating that the base standalone ASG tool
// environment is to be provided.
// ASGTOOL_ATHENA - Flag indicating that the Athena ASG tool environment
// is to be provided.
// ASGTOOL_TEVENT - Flag indicating that TEvent is available in standalone.
// If this is not set, calls to the event store will fail. This flag is
// se unless the user sets ASGTOOL_NOTEVENT.
#include <AsgMessaging/AsgMessagingConf.h>
#if !defined(ASGTOOL_STANDALONE) && !defined(ASGTOOL_ATHENA)
#ifdef XAOD_STANDALONE
#define ASGTOOL_STANDALONE
#ifndef ASGTOOL_NOTEVENT
#define ASGTOOL_TEVENT
#endif
#else
#define ASGTOOL_ATHENA
#endif
#endif
#if defined(ASGTOOL_STANDALONE) && defined(ASGTOOL_ATHENA)
#error "Only one of ASGTOOL_STANDALONE and ASGTOOL_ATHENA may be defined."
#endif
#endif
......@@ -19,7 +19,7 @@
// The following is only needed for standalone usage. In Athena the
// setProperty(...) function(s) come(s) from the AlgTool base class, with all
// the necessary dictionaries declared in GaudiKernel.
#ifdef ASGTOOL_STANDALONE
#ifdef XAOD_STANDALONE
// Helper macro for declaring the setProperty functions to the dictionary:
#define SETPROPERTY_INSTAN( TYPE ) \
......@@ -56,5 +56,5 @@ SETPROPERTY_INSTAN( std::vector< std::string > );
// Make the compiler forget about this macro now...
#undef SETPROPERTY_INSTAN
#endif // ASGTOOL_STANDALONE
#endif // XAOD_STANDALONE
#endif // not ASGTOOLS_ASGTOOLSDICT_H
......@@ -15,7 +15,7 @@
// Set this flag to show calls to CLASS_DEF in stanadlone environments.
//#define CLASSDEF_SHOWDEFS
#ifdef ASGTOOL_ATHENA
#ifndef XAOD_STANDALONE
#undef CLASSDEF_SHOWDEFS
#endif
......@@ -27,7 +27,7 @@ int announce(const char* name, int clid) {
}
#endif
#ifdef ASGTOOL_ATHENA