The Gaudi Framework  master (37c0b60a)
DetDataSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef DETECTORDATASVC_DETDATASVC_H
12 #define DETECTORDATASVC_DETDATASVC_H
13 
14 // Base classes
15 // #include "GaudiKernel/DataSvc.h"
16 // D. Piparo: Change to the new thread safe version
19 #include <GaudiKernel/IRegistry.h>
20 #include <GaudiKernel/Time.h>
21 #include <GaudiKernel/TsDataSvc.h>
22 
23 // Forward declarations
24 class StatusCode;
25 class IAddressCreator;
26 
28  //--------------------------------------------------------------------------
38 
39 class DetDataSvc : public extends<TsDataSvc, IDetDataSvc, IIncidentListener> {
40 
41  // unhides DataSvc updateObject methods
43 
44 public:
45  // Overloaded DataSvc methods
46 
48  StatusCode initialize() override;
49 
51  StatusCode reinitialize() override;
52 
54  StatusCode finalize() override;
55 
57  StatusCode clearStore() override;
58 
60  StatusCode updateObject( DataObject* toUpdate ) override;
61 
63  DetDataSvc( const std::string& name, ISvcLocator* svc );
64 
66  ~DetDataSvc() override = default;
67 
68 private:
71 
73  StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode ) override final {
75  return TsDataSvc::loadObject( pLoader, pNode );
76  }
77  error() << "Trying to load " << pNode->identifier() << " while RUNNING" << endmsg;
78  return StatusCode::FAILURE;
79  }
80 
81 public:
82  // Implementation of the IDetDataSvc interface
83 
86  bool validEventTime() const override;
87 
89  const Gaudi::Time& eventTime() const override;
90 
92  void setEventTime( const Gaudi::Time& time ) override;
93 
94 public:
95  // Implementation of the IIncidentListener interface
96 
98  void handle( const Incident& ) override;
99 
100 private:
102  "Detector Data Persistency Storage type" };
103  Gaudi::Property<std::string> m_detDbLocation{ this, "DetDbLocation", "empty",
104  "location of detector Db (filename,URL)" };
106  "DetDbRootName",
107  "dd",
108  [this]( Gaudi::Details::PropertyBase& ) {
109  this->setProperty( "RootName", "/" + this->m_detDbRootName ).ignore();
110  },
112  "name of the root node of the detector" };
113  Gaudi::Property<bool> m_usePersistency{ this, "UsePersistency", false, "control if the persistency is required" };
114  Gaudi::Property<std::string> m_persistencySvcName{ this, "PersistencySvc", "DetectorPersistencySvc",
115  "name of the persistency service" };
116 
117  Gaudi::Property<bool> m_allowLoadInRunning{ this, "AllowLoadInRunning", true,
118  "if set to false, no new object can be loaded while in running state "
119  "(updates are still allowed), this forces preloading of the geometry" };
120 
123 
126 };
127 
128 #endif // DETECTORDATASVC_DETDATASVC_H
TsDataSvc::loadObject
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:472
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:35
DetDataSvc::m_detDbRootName
Gaudi::Property< std::string > m_detDbRootName
Definition: DetDataSvc.h:105
IAddressCreator
Definition: IAddressCreator.h:38
std::string
STL class.
TsDataSvc.h
DetDataSvc::initialize
StatusCode initialize() override
Initialize the service.
Definition: DetDataSvc.cpp:37
PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
Set the property from a property.
Definition: IProperty.h:39
ISvcLocator
Definition: ISvcLocator.h:46
IRegistry
Definition: IRegistry.h:32
DetDataSvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition: DetDataSvc.h:125
DetDataSvc::setEventTime
void setEventTime(const Gaudi::Time &time) override
Set the new event time.
Definition: DetDataSvc.cpp:181
DetDataSvc::updateObject
StatusCode updateObject(DataObject *toUpdate) override
Update object.
Definition: DetDataSvc.cpp:203
Service::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:62
Gaudi::Time
Definition: Time.h:241
DetDataSvc
Definition: DetDataSvc.h:39
DetDataSvc::m_allowLoadInRunning
Gaudi::Property< bool > m_allowLoadInRunning
Definition: DetDataSvc.h:117
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:332
StatusCode
Definition: StatusCode.h:65
Gaudi::tagged_bool_ns::tagged_bool
Definition: TaggedBool.h:16
DetDataSvc::loadObject
StatusCode loadObject(IConversionSvc *pLoader, IRegistry *pNode) override final
Invoke Persistency service to create transient object from its persistent representation.
Definition: DetDataSvc.h:73
DetDataSvc::m_usePersistency
Gaudi::Property< bool > m_usePersistency
Definition: DetDataSvc.h:113
XML_StorageType
const long XML_StorageType
Definition: ClassID.h:67
DetDataSvc::validEventTime
bool validEventTime() const override
Check if the event time has been set.
Definition: DetDataSvc.cpp:187
DetDataSvc::~DetDataSvc
~DetDataSvc() override=default
Standard Destructor.
SmartIF< IAddressCreator >
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
IDetDataSvc.h
DetDataSvc::DetDataSvc
DetDataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: DetDataSvc.cpp:176
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
IRegistry.h
Gaudi::StateMachine::RUNNING
@ RUNNING
Definition: StateMachine.h:26
plotSpeedupsPyRoot.time
time
Definition: plotSpeedupsPyRoot.py:180
DetDataSvc::finalize
StatusCode finalize() override
Finalize the service.
Definition: DetDataSvc.cpp:135
DetDataSvc::m_persistencySvcName
Gaudi::Property< std::string > m_persistencySvcName
Definition: DetDataSvc.h:114
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
DetDataSvc::eventTime
const Gaudi::Time & eventTime() const override
Get the event time.
Definition: DetDataSvc.cpp:190
DetDataSvc::setupDetectorDescription
StatusCode setupDetectorDescription()
Deal with Detector Description initialization.
Definition: DetDataSvc.cpp:65
DetDataSvc::m_detDbLocation
Gaudi::Property< std::string > m_detDbLocation
Definition: DetDataSvc.h:103
Time.h
IIncidentListener.h
TsDataSvc::updateObject
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: TsDataSvc.cpp:662
DetDataSvc::reinitialize
StatusCode reinitialize() override
Initialize the service.
Definition: DetDataSvc.cpp:117
DataObject
Definition: DataObject.h:36
DetDataSvc::clearStore
StatusCode clearStore() override
Remove all data objects in the data store.
Definition: DetDataSvc.cpp:153
DetDataSvc::handle
void handle(const Incident &) override
Inform that a new incident has occured.
Definition: DetDataSvc.cpp:193
DetDataSvc::m_detStorageType
Gaudi::Property< int > m_detStorageType
Definition: DetDataSvc.h:101
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Incident
Definition: Incident.h:27
Gaudi::Property< int >
DetDataSvc::m_eventTime
Gaudi::Time m_eventTime
Current event time.
Definition: DetDataSvc.h:122
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition: Service.cpp:335
IConversionSvc
Definition: IConversionSvc.h:47