ATLAS Offline Software
AthCheckedComponent.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ATHENABASECOMPS_ATHCHECKEDCOMPONENT_ICC
6 #define ATHENABASECOMPS_ATHCHECKEDCOMPONENT_ICC
7 
8 #include "Gaudi/Interfaces/IOptionsSvc.h"
9 #include "GaudiKernel/ISvcLocator.h"
10 
11 template <class PBASE>
12 StatusCode AthCheckedComponent<PBASE>::sysInitialize()
13 {
14  ATH_CHECK( PBASE::sysInitialize() );
15  ATH_CHECK( isConfigured() );
16  return StatusCode::SUCCESS;
17 }
18 
19 template <class PBASE>
20 StatusCode AthCheckedComponent<PBASE>::isConfigured()
21 {
22  Gaudi::Interfaces::IOptionsSvc& joSvc = this->serviceLocator()->getOptsSvc();
23 
24  // Check that at least one of my properties has been set:
25  for (const auto prop : this->getProperties()) {
26  if (joSvc.isSet(this->name() + "." + prop->name())) return StatusCode::SUCCESS;
27  }
28 
29  ATH_MSG_ERROR("No job properties found. This is not allowed for an AthCheckedComponent.");
30  return StatusCode::FAILURE;
31 }
32 
33 #endif