ATLAS Offline Software
SlotSpecificObj.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration.
3  */
4 // $Id$
15 #include "GaudiKernel/IHiveWhiteBoard.h"
16 #include "GaudiKernel/ServiceHandle.h"
17 
18 
19 
20 namespace {
21  // Name of the service to use to find the number of slots.
22  std::string getNSlots_hiveMgrName ATLAS_THREAD_SAFE = "EventDataSvc";
23 } // anonymous namespace
24 
25 
26 
27 namespace SG {
28 
29 
35 void setNSlotsHiveMgrName ATLAS_NOT_THREAD_SAFE (const std::string& s)
36 {
37  getNSlots_hiveMgrName = s;
38 }
39 
40 
47 {
48  ServiceHandle<IInterface> svc (getNSlots_hiveMgrName, "getNSlots_once");
49  if (!svc.retrieve().isSuccess())
50  return 1;
51  IHiveWhiteBoard* hivesvc = dynamic_cast<IHiveWhiteBoard*> (svc.get());
52  if (!hivesvc) return 1;
53  unsigned int nslots = hivesvc->getNumberOfStores();
54  if (nslots < 1) return 1;
55  return nslots;
56 }
57 
58 
64 size_t getNSlots()
65 {
66  const static size_t nslots = getNSlots_once();
67  return nslots;
68 }
69 
70 
71 } // namespace SG
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::getNSlots_once
size_t getNSlots_once()
Return the number of event slots.
Definition: SlotSpecificObj.cxx:46
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
SG::ATLAS_NOT_THREAD_SAFE
void setNSlotsHiveMgrName ATLAS_NOT_THREAD_SAFE(const std::string &s)
Allow setting the name of the whiteboard service.
Definition: SlotSpecificObj.cxx:35
SG::getNSlots
size_t getNSlots()
Return the number of event slots.
Definition: SlotSpecificObj.cxx:64
SlotSpecificObj.h
Maintain a set of objects, one per slot.
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
checker_macros.h
Define macros for attributes used to control the static checker.
ServiceHandle< IInterface >